Skip to content

Commit e56ada4

Browse files
committed
tests: Add board qualification test for I2C bus scan.
1 parent bc70f05 commit e56ada4

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
type: board
2+
name: "board_i2c_scan"
3+
4+
tests:
5+
- name: "I2C bus scan finds expected devices"
6+
action: hardware_script
7+
script: |
8+
from machine import I2C
9+
i2c = I2C(1)
10+
found = i2c.scan()
11+
# Expected I2C addresses on STeaMi board:
12+
# 0x20=MCP23009E, 0x29=VL53L1X, 0x39=APDS9960
13+
# 0x55=BQ27441, 0x5C=WSEN-HIDS, 0x5D=WSEN-PADS, 0x5F=HTS221
14+
expected = [0x20, 0x29, 0x39, 0x55, 0x5C, 0x5D, 0x5F]
15+
missing = [hex(a) for a in expected if a not in found]
16+
result = len(missing) == 0
17+
expect_true: true
18+
mode: [hardware]
19+
20+
- name: "No unexpected I2C devices"
21+
action: hardware_script
22+
script: |
23+
from machine import I2C
24+
i2c = I2C(1)
25+
found = i2c.scan()
26+
known = [0x1E, 0x20, 0x29, 0x39, 0x55, 0x5C, 0x5D, 0x5F]
27+
unexpected = [hex(a) for a in found if a not in known]
28+
result = len(unexpected) == 0
29+
expect_true: true
30+
mode: [hardware]

0 commit comments

Comments
 (0)