1from __future__ import print_function
2
3import ttfw_idf
4
5EXPECT_TIMEOUT = 20
6
7
8@ttfw_idf.idf_example_test(env_tag='Example_RMT_IR_PROTOCOLS')
9def test_examples_rmt_ir_protocols(env, extra_data):
10    dut = env.get_dut('ir_protocols_example', 'examples/peripherals/rmt/ir_protocols', app_config_name='nec')
11    print('Using binary path: {}'.format(dut.app.binary_path))
12    dut.start_app()
13    dut.expect('example: Send command 0x20 to address 0x10', timeout=EXPECT_TIMEOUT)
14    dut.expect('Scan Code  --- addr: 0x0010 cmd: 0x0020', timeout=EXPECT_TIMEOUT)
15    dut.expect('Scan Code (repeat) --- addr: 0x0010 cmd: 0x0020', timeout=EXPECT_TIMEOUT)
16    env.close_dut(dut.name)
17
18    dut = env.get_dut('ir_protocols_example', 'examples/peripherals/rmt/ir_protocols', app_config_name='rc5')
19    print('Using binary path: {}'.format(dut.app.binary_path))
20    dut.start_app()
21    dut.expect('example: Send command 0x20 to address 0x10', timeout=EXPECT_TIMEOUT)
22    dut.expect('Scan Code  --- addr: 0x0010 cmd: 0x0020', timeout=EXPECT_TIMEOUT)
23    dut.expect('Scan Code (repeat) --- addr: 0x0010 cmd: 0x0020', timeout=EXPECT_TIMEOUT)
24    env.close_dut(dut.name)
25
26
27if __name__ == '__main__':
28    test_examples_rmt_ir_protocols()
29