-
Notifications
You must be signed in to change notification settings - Fork 1
apds9960: Add test scenario for gesture and color sensor. #48
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 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
d064af5
apds9960: Add test scenario for gesture and color sensor.
nedseb fa0e009
apds9960: Split device ID test for mock and hardware modes.
nedseb 6e4ad56
tests: Add mock_pins and hardware_init support to test framework.
nedseb 04ac2f1
apds9960: Enable sensors in hardware init for valid readings.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| driver: apds9960 | ||
| driver_class: uAPDS9960 | ||
| i2c_address: 0x39 | ||
|
|
||
| # I2C config for hardware tests (STeaMi board - STM32WB55) | ||
| i2c: | ||
| id: 1 | ||
|
|
||
| # Register values for mock tests | ||
| mock_registers: | ||
| # ID register (0x92): expected 0xAB | ||
| 0x92: 0xAB | ||
| # ENABLE (0x80): power off at start | ||
| 0x80: 0x00 | ||
| # CONTROL (0x8F): used by read-modify-write in init | ||
| 0x8F: 0x00 | ||
| # CONFIG2 (0x90): default | ||
| 0x90: 0x01 | ||
| # CONFIG3 (0x9F): default | ||
| 0x9F: 0x00 | ||
| # GCONF2 (0xA3): used by gesture config | ||
| 0xA3: 0x00 | ||
| # GCONF4 (0xAB): used by gesture config | ||
| 0xAB: 0x00 | ||
| # STATUS (0x93): AVALID + PVALID | ||
| 0x93: 0x03 | ||
| # Ambient light: clear channel = 256 (0x0100) | ||
| 0x94: 0x00 # CDATAL | ||
| 0x95: 0x01 # CDATAH | ||
| # Red = 128 | ||
| 0x96: 0x80 # RDATAL | ||
| 0x97: 0x00 # RDATAH | ||
| # Green = 64 | ||
| 0x98: 0x40 # GDATAL | ||
| 0x99: 0x00 # GDATAH | ||
| # Blue = 32 | ||
| 0x9A: 0x20 # BDATAL | ||
| 0x9B: 0x00 # BDATAH | ||
| # Proximity = 80 | ||
| 0x9C: 0x50 | ||
|
|
||
| tests: | ||
| - name: "Verify device ID register" | ||
| action: call | ||
| method: _read_byte_data | ||
| args: [0x92] | ||
| expect: 0xAB | ||
| mode: [mock, hardware] | ||
|
|
||
| - name: "Read ambient light returns expected value" | ||
| action: call | ||
| method: readAmbientLight | ||
| expect: 256 | ||
| mode: [mock] | ||
|
|
||
| - name: "Read proximity returns expected value" | ||
| action: call | ||
| method: readProximity | ||
| expect: 80 | ||
| mode: [mock] | ||
|
|
||
| - name: "Read red light returns expected value" | ||
| action: call | ||
| method: readRedLight | ||
| expect: 128 | ||
| mode: [mock] | ||
|
|
||
| - name: "Ambient light in plausible range" | ||
| action: call | ||
| method: readAmbientLight | ||
| expect_range: [0, 65535] | ||
| mode: [hardware] | ||
|
|
||
| - name: "Proximity in plausible range" | ||
| action: call | ||
| method: readProximity | ||
| expect_range: [0, 255] | ||
| mode: [hardware] | ||
|
|
||
| - name: "Light and proximity values feel correct" | ||
| action: manual | ||
| display: | ||
| - method: readAmbientLight | ||
| label: "Ambient light" | ||
| unit: "" | ||
| - method: readProximity | ||
| label: "Proximity" | ||
| unit: "" | ||
| prompt: "Les valeurs de lumière ambiante et de proximité sont-elles cohérentes ?" | ||
| expect_true: true | ||
| mode: [hardware] | ||
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.