-
Notifications
You must be signed in to change notification settings - Fork 1
tests: Extend test framework for driverless board qualification scenarios. #89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
b81cf80
tests: Extend test framework for driverless board qualification scena…
nedseb bc70f05
tests: Add hardware marker and guard board scenarios against driver a…
nedseb 222efc2
tests: Add board qualification tests for user pins.
nedseb 9679596
tests: Clarify pin tests as smoke tests and simplify ADC assertions.
nedseb 6ad9b3a
tests: Skip printing bare boolean results in test output.
nedseb 4922d57
tests: Return raw values in pin tests for visual control.
nedseb bd31220
tests: Add board qualification tests for buzzer.
nedseb 88d4474
tests: Fix buzzer tests to use pyb.Timer instead of machine.PWM.
nedseb 7223472
tests: Fix buzzer sweep timing and remove double initial note.
nedseb 0569351
tests: Add Ode to Joy melody test for buzzer qualification.
nedseb c3c4578
tests: Add board qualification tests for A/B/Menu buttons.
nedseb 84c12e4
tests: Add released-state check and use wait false for button tests.
nedseb 2d80e7b
tests: Add interrupt tests and rename existing to polling for buttons.
nedseb 0aaac6b
tests: Add D-PAD buttons and timeout on release-wait loops.
nedseb 273e2bb
tests: Add board qualification tests for user LEDs.
nedseb 6cc9cf9
tests: Add pre_prompt to LED tests and align white duration.
nedseb d57c678
tests: Remove unnecessary pre_prompt pauses between LED tests.
nedseb 2f1d107
tests: Rephrase pre_prompt to clarify Enter starts the test.
nedseb 89cb612
tests: Add board qualification test for I2C bus scan.
nedseb f38ec8c
tests: Return missing/unexpected addresses for better diagnostics.
nedseb fbc2643
tests: Fix I2C scan addresses and add WHO_AM_I checks per device.
nedseb b0699ff
tests: Add LIS2MDL to expected I2C addresses list.
nedseb dcd9d67
tests: Release MCP23009E from reset before D-PAD button tests.
nedseb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,287 @@ | ||
| type: board | ||
| name: "board_buttons" | ||
|
|
||
| # --- Polling tests (one per button) --- | ||
| # LED_GREEN signals when the board is ready to read the button. | ||
|
|
||
| tests: | ||
| - name: "Button A press (polling)" | ||
| action: hardware_script | ||
| pre_prompt: "Test polling boutons : appuyez sur chaque bouton quand la LED verte s'allume (5s). Commençons par A." | ||
| wait: false | ||
| script: | | ||
| from machine import Pin | ||
| from time import sleep_ms, ticks_ms, ticks_diff | ||
| led = Pin("LED_GREEN", Pin.OUT) | ||
| btn = Pin("A_BUTTON", Pin.IN, Pin.PULL_UP) | ||
| t_rel = ticks_ms() | ||
| while btn.value() == 0: | ||
| if ticks_diff(ticks_ms(), t_rel) > 3000: | ||
| break | ||
| sleep_ms(20) | ||
| led.on() | ||
| detected = False | ||
| t0 = ticks_ms() | ||
| while ticks_diff(ticks_ms(), t0) < 5000: | ||
| if btn.value() == 0: | ||
| detected = True | ||
| break | ||
| sleep_ms(20) | ||
| led.off() | ||
| result = detected | ||
| expect_true: true | ||
| mode: [hardware] | ||
|
|
||
| - name: "Button B press (polling)" | ||
| action: hardware_script | ||
| pre_prompt: "Bouton B" | ||
| wait: false | ||
| script: | | ||
| from machine import Pin | ||
| from time import sleep_ms, ticks_ms, ticks_diff | ||
| led = Pin("LED_GREEN", Pin.OUT) | ||
| btn = Pin("B_BUTTON", Pin.IN, Pin.PULL_UP) | ||
| t_rel = ticks_ms() | ||
| while btn.value() == 0: | ||
| if ticks_diff(ticks_ms(), t_rel) > 3000: | ||
| break | ||
| sleep_ms(20) | ||
| led.on() | ||
| detected = False | ||
| t0 = ticks_ms() | ||
| while ticks_diff(ticks_ms(), t0) < 5000: | ||
| if btn.value() == 0: | ||
| detected = True | ||
| break | ||
| sleep_ms(20) | ||
| led.off() | ||
| result = detected | ||
| expect_true: true | ||
| mode: [hardware] | ||
|
|
||
| - name: "Button MENU press (polling)" | ||
| action: hardware_script | ||
| pre_prompt: "Bouton MENU" | ||
| wait: false | ||
| script: | | ||
| from machine import Pin | ||
| from time import sleep_ms, ticks_ms, ticks_diff | ||
| led = Pin("LED_GREEN", Pin.OUT) | ||
| btn = Pin("MENU_BUTTON", Pin.IN, Pin.PULL_UP) | ||
| t_rel = ticks_ms() | ||
| while btn.value() == 0: | ||
| if ticks_diff(ticks_ms(), t_rel) > 3000: | ||
| break | ||
| sleep_ms(20) | ||
| led.on() | ||
| detected = False | ||
| t0 = ticks_ms() | ||
| while ticks_diff(ticks_ms(), t0) < 5000: | ||
| if btn.value() == 0: | ||
| detected = True | ||
| break | ||
| sleep_ms(20) | ||
| led.off() | ||
| result = detected | ||
| expect_true: true | ||
| mode: [hardware] | ||
|
|
||
| # --- D-PAD buttons via MCP23009E (I2C 0x20, GPIO register 0x09) --- | ||
| # Read directly via I2C without importing the driver. | ||
| # Bit mapping: UP=bit7, DOWN=bit5, LEFT=bit6, RIGHT=bit4. | ||
|
|
||
| - name: "D-PAD UP press (polling)" | ||
| action: hardware_script | ||
| pre_prompt: "Test polling D-PAD : appuyez sur chaque bouton quand la LED verte s'allume (5s). Commençons par UP." | ||
| wait: false | ||
| script: | | ||
| from machine import Pin, I2C | ||
| from time import sleep_ms, ticks_ms, ticks_diff | ||
| # Release MCP23009E from reset | ||
| rst = Pin("RST_EXPANDER", Pin.OUT) | ||
| rst.on() | ||
| sleep_ms(10) | ||
| led = Pin("LED_GREEN", Pin.OUT) | ||
| i2c = I2C(1) | ||
| bit = 7 | ||
| led.on() | ||
| detected = False | ||
| t0 = ticks_ms() | ||
| while ticks_diff(ticks_ms(), t0) < 5000: | ||
| gpio = i2c.readfrom_mem(0x20, 0x09, 1)[0] | ||
| if not (gpio & (1 << bit)): | ||
| detected = True | ||
| break | ||
| sleep_ms(20) | ||
| led.off() | ||
| result = detected | ||
| expect_true: true | ||
| mode: [hardware] | ||
|
|
||
| - name: "D-PAD DOWN press (polling)" | ||
| action: hardware_script | ||
| pre_prompt: "Bouton DOWN" | ||
| wait: false | ||
| script: | | ||
| from machine import Pin, I2C | ||
| from time import sleep_ms, ticks_ms, ticks_diff | ||
| led = Pin("LED_GREEN", Pin.OUT) | ||
| i2c = I2C(1) | ||
| bit = 5 | ||
| led.on() | ||
|
nedseb marked this conversation as resolved.
|
||
| detected = False | ||
| t0 = ticks_ms() | ||
| while ticks_diff(ticks_ms(), t0) < 5000: | ||
| gpio = i2c.readfrom_mem(0x20, 0x09, 1)[0] | ||
| if not (gpio & (1 << bit)): | ||
| detected = True | ||
| break | ||
| sleep_ms(20) | ||
| led.off() | ||
| result = detected | ||
| expect_true: true | ||
| mode: [hardware] | ||
|
|
||
| - name: "D-PAD LEFT press (polling)" | ||
| action: hardware_script | ||
| pre_prompt: "Bouton LEFT" | ||
| wait: false | ||
| script: | | ||
| from machine import Pin, I2C | ||
| from time import sleep_ms, ticks_ms, ticks_diff | ||
| led = Pin("LED_GREEN", Pin.OUT) | ||
| i2c = I2C(1) | ||
| bit = 6 | ||
| led.on() | ||
|
nedseb marked this conversation as resolved.
|
||
| detected = False | ||
| t0 = ticks_ms() | ||
| while ticks_diff(ticks_ms(), t0) < 5000: | ||
| gpio = i2c.readfrom_mem(0x20, 0x09, 1)[0] | ||
| if not (gpio & (1 << bit)): | ||
| detected = True | ||
| break | ||
| sleep_ms(20) | ||
| led.off() | ||
| result = detected | ||
| expect_true: true | ||
| mode: [hardware] | ||
|
|
||
| - name: "D-PAD RIGHT press (polling)" | ||
| action: hardware_script | ||
| pre_prompt: "Bouton RIGHT" | ||
| wait: false | ||
| script: | | ||
| from machine import Pin, I2C | ||
| from time import sleep_ms, ticks_ms, ticks_diff | ||
| led = Pin("LED_GREEN", Pin.OUT) | ||
| i2c = I2C(1) | ||
| bit = 4 | ||
| led.on() | ||
|
nedseb marked this conversation as resolved.
|
||
| detected = False | ||
| t0 = ticks_ms() | ||
| while ticks_diff(ticks_ms(), t0) < 5000: | ||
| gpio = i2c.readfrom_mem(0x20, 0x09, 1)[0] | ||
| if not (gpio & (1 << bit)): | ||
| detected = True | ||
| break | ||
| sleep_ms(20) | ||
| led.off() | ||
| result = detected | ||
| expect_true: true | ||
| mode: [hardware] | ||
|
|
||
| # --- Interrupt tests (GPIO direct buttons) --- | ||
| # LED_GREEN signals when the board is ready; uses Pin.irq() to detect press. | ||
|
|
||
| - name: "Button A press (interrupt)" | ||
| action: hardware_script | ||
| pre_prompt: "Test interrupt boutons : appuyez brièvement sur chaque bouton quand la LED verte s'allume (5s). Commençons par A." | ||
| wait: false | ||
| script: | | ||
| from machine import Pin | ||
| from time import sleep_ms, ticks_ms, ticks_diff | ||
| led = Pin("LED_GREEN", Pin.OUT) | ||
| btn = Pin("A_BUTTON", Pin.IN, Pin.PULL_UP) | ||
| t_rel = ticks_ms() | ||
| while btn.value() == 0: | ||
| if ticks_diff(ticks_ms(), t_rel) > 3000: | ||
| break | ||
| sleep_ms(20) | ||
| detected = False | ||
| def on_press(pin): | ||
| global detected | ||
| detected = True | ||
| btn.irq(trigger=Pin.IRQ_FALLING, handler=on_press) | ||
| led.on() | ||
| t0 = ticks_ms() | ||
| while ticks_diff(ticks_ms(), t0) < 5000: | ||
| if detected: | ||
| break | ||
| sleep_ms(20) | ||
| btn.irq(handler=None) | ||
| led.off() | ||
| result = detected | ||
| expect_true: true | ||
| mode: [hardware] | ||
|
|
||
| - name: "Button B press (interrupt)" | ||
| action: hardware_script | ||
| pre_prompt: "Bouton B" | ||
| wait: false | ||
| script: | | ||
| from machine import Pin | ||
| from time import sleep_ms, ticks_ms, ticks_diff | ||
| led = Pin("LED_GREEN", Pin.OUT) | ||
| btn = Pin("B_BUTTON", Pin.IN, Pin.PULL_UP) | ||
| t_rel = ticks_ms() | ||
| while btn.value() == 0: | ||
| if ticks_diff(ticks_ms(), t_rel) > 3000: | ||
| break | ||
| sleep_ms(20) | ||
| detected = False | ||
| def on_press(pin): | ||
| global detected | ||
| detected = True | ||
| btn.irq(trigger=Pin.IRQ_FALLING, handler=on_press) | ||
| led.on() | ||
| t0 = ticks_ms() | ||
| while ticks_diff(ticks_ms(), t0) < 5000: | ||
| if detected: | ||
| break | ||
| sleep_ms(20) | ||
| btn.irq(handler=None) | ||
| led.off() | ||
| result = detected | ||
| expect_true: true | ||
| mode: [hardware] | ||
|
|
||
| - name: "Button MENU press (interrupt)" | ||
| action: hardware_script | ||
| pre_prompt: "Bouton MENU" | ||
| wait: false | ||
| script: | | ||
| from machine import Pin | ||
| from time import sleep_ms, ticks_ms, ticks_diff | ||
| led = Pin("LED_GREEN", Pin.OUT) | ||
| btn = Pin("MENU_BUTTON", Pin.IN, Pin.PULL_UP) | ||
| t_rel = ticks_ms() | ||
| while btn.value() == 0: | ||
| if ticks_diff(ticks_ms(), t_rel) > 3000: | ||
| break | ||
| sleep_ms(20) | ||
| detected = False | ||
| def on_press(pin): | ||
| global detected | ||
| detected = True | ||
| btn.irq(trigger=Pin.IRQ_FALLING, handler=on_press) | ||
| led.on() | ||
| t0 = ticks_ms() | ||
| while ticks_diff(ticks_ms(), t0) < 5000: | ||
| if detected: | ||
| break | ||
| sleep_ms(20) | ||
| btn.irq(handler=None) | ||
| led.off() | ||
| result = detected | ||
| expect_true: true | ||
| mode: [hardware] | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.