File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ driver : mcp23009e
2+ driver_class : MCP23009E
3+ i2c_address : 0x20
4+
5+ # I2C config for hardware tests (STeaMi board - STM32WB55)
6+ i2c :
7+ id : 1
8+
9+ # Extra constructor pins (FakePin instances for mock tests)
10+ mock_pins :
11+ reset_pin : 0
12+
13+ # Custom hardware init (MCP23009E requires a reset pin)
14+ hardware_init : |
15+ from machine import Pin
16+ dev = MCP23009E(i2c, address=0x20, reset_pin=Pin("RST_EXPANDER", Pin.OUT))
17+
18+ # Register values for mock tests
19+ mock_registers :
20+ # IODIR (0x00): all inputs by default (0xFF)
21+ 0x00 : 0xFF
22+ # IPOL (0x01): no inversion
23+ 0x01 : 0x00
24+ # GPINTEN (0x02): interrupts disabled
25+ 0x02 : 0x00
26+ # DEFVAL (0x03): default
27+ 0x03 : 0x00
28+ # INTCON (0x04): default
29+ 0x04 : 0x00
30+ # IOCON (0x05): default config
31+ 0x05 : 0x00
32+ # GPPU (0x06): no pull-ups
33+ 0x06 : 0x00
34+ # INTF (0x07): no interrupt flags
35+ 0x07 : 0x00
36+ # INTCAP (0x08): default
37+ 0x08 : 0x00
38+ # GPIO (0x09): D-PAD buttons (bits 4-7 as inputs with pull-ups)
39+ 0x09 : 0xF0
40+ # OLAT (0x0A): default
41+ 0x0A : 0x00
42+
43+ tests :
44+ - name : " Read IODIR default value"
45+ action : call
46+ method : get_iodir
47+ expect : 0xFF
48+ mode : [mock, hardware]
49+
50+ - name : " Read GPIO register"
51+ action : call
52+ method : get_gpio
53+ expect_not_none : true
54+ mode : [mock, hardware]
55+
56+ - name : " Read individual GPIO level"
57+ action : call
58+ method : get_level
59+ args : [0]
60+ expect_not_none : true
61+ mode : [mock]
62+
63+ - name : " D-PAD buttons state"
64+ action : manual
65+ display :
66+ - method : get_gpio
67+ label : " GPIO register"
68+ unit : " "
69+ prompt : " La valeur du registre GPIO est-elle cohérente (boutons D-PAD non pressés) ?"
70+ expect_true : true
71+ mode : [hardware]
You can’t perform that action at this time.
0 commit comments