-
Notifications
You must be signed in to change notification settings - Fork 1
ssd1327: Harmonize driver and add test scenario. #55
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
4 commits
Select commit
Hold shift + click to select a range
a8301fd
ssd1327: Harmonize driver with project conventions.
nedseb 12ed6f5
ssd1327: Add test scenario for OLED display driver.
nedseb 0225f78
tests: Use single keypress for manual test prompts.
nedseb 5aac341
tests: Address Copilot review feedback on PR #55.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| """Stub for the MicroPython framebuf module.""" | ||
|
|
||
| GS4_HMSB = 2 | ||
|
|
||
|
|
||
| class FrameBuffer: | ||
| """Minimal FrameBuffer stub for testing display drivers on CPython.""" | ||
|
|
||
| def __init__(self, buffer, width, height, fmt): | ||
| self.buffer = buffer | ||
| self.width = width | ||
| self.height = height | ||
| self.format = fmt | ||
|
|
||
| def fill(self, col): | ||
| val = (col & 0x0F) | ((col & 0x0F) << 4) | ||
| for i in range(len(self.buffer)): | ||
| self.buffer[i] = val | ||
|
|
||
| def pixel(self, x, y, col=None): | ||
| pass | ||
|
|
||
| def text(self, string, x, y, col=15): | ||
| pass | ||
|
|
||
| def line(self, x1, y1, x2, y2, col): | ||
| pass | ||
|
|
||
| def scroll(self, dx, dy): | ||
| pass |
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,116 @@ | ||
| driver: ssd1327 | ||
| driver_class: WS_OLED_128X128_I2C | ||
| i2c_address: 0x3C | ||
|
|
||
| # I2C config for hardware tests (STeaMi board - STM32WB55) | ||
| # The display uses SPI on hardware, but i2c config is required by the bridge. | ||
| i2c: | ||
| id: 1 | ||
|
|
||
| # Custom hardware init (STeaMi display is on SPI, not I2C) | ||
| hardware_init: | | ||
| from ssd1327.device import WS_OLED_128X128_SPI | ||
| from machine import SPI, Pin | ||
| spi = SPI(1) | ||
| dc = Pin("DATA_COMMAND_DISPLAY") | ||
| res = Pin("RST_DISPLAY") | ||
| cs = Pin("CS_DISPLAY") | ||
| dev = WS_OLED_128X128_SPI(spi, dc, res, cs) | ||
|
|
||
| tests: | ||
| - name: "Fill black does not crash" | ||
| action: call | ||
| method: fill | ||
| args: [0] | ||
| mode: [mock] | ||
|
|
||
| - name: "Fill white does not crash" | ||
| action: call | ||
| method: fill | ||
| args: [15] | ||
| mode: [mock] | ||
|
|
||
| - name: "Text rendering does not crash" | ||
| action: call | ||
| method: text | ||
| args: ["Test", 0, 0, 15] | ||
| mode: [mock] | ||
|
|
||
| - name: "Show does not crash" | ||
| action: call | ||
| method: show | ||
| mode: [mock] | ||
|
|
||
| - name: "Display white screen" | ||
| action: hardware_script | ||
| script: | | ||
| dev.fill(15) | ||
| dev.show() | ||
| result = True | ||
| expect_true: true | ||
| mode: [hardware] | ||
|
|
||
| - name: "Screen is white" | ||
| action: manual | ||
| prompt: "L'écran affiche-t-il un fond blanc uniforme ?" | ||
| expect_true: true | ||
| mode: [hardware] | ||
|
|
||
| - name: "Display text" | ||
| action: hardware_script | ||
| script: | | ||
| dev.fill(0) | ||
| dev.text("STeaMi", 35, 56, 15) | ||
| dev.text("Test OK", 32, 68, 15) | ||
| dev.show() | ||
| result = True | ||
| expect_true: true | ||
| mode: [hardware] | ||
|
|
||
| - name: "Text is visible" | ||
| action: manual | ||
| prompt: "L'écran affiche-t-il 'STeaMi' et 'Test OK' sur fond noir ?" | ||
| expect_true: true | ||
| mode: [hardware] | ||
|
|
||
| - name: "Display grayscale gradient" | ||
| action: hardware_script | ||
| script: | | ||
| dev.fill(0) | ||
| w = 128 // 16 | ||
| for level in range(16): | ||
| x = level * w | ||
| for row in range(128): | ||
| for col in range(x, x + w): | ||
| dev.pixel(col, row, level) | ||
| dev.show() | ||
| result = True | ||
| expect_true: true | ||
| mode: [hardware] | ||
|
|
||
| - name: "Grayscale gradient is visible" | ||
| action: manual | ||
| prompt: "L'écran affiche-t-il 16 bandes verticales du noir au blanc ?" | ||
| expect_true: true | ||
| mode: [hardware] | ||
|
|
||
| - name: "Scrolling animation" | ||
| action: hardware_script | ||
| script: | | ||
| from time import sleep_ms | ||
| dev.fill(0) | ||
| dev.text("STeaMi", 35, 60, 15) | ||
| dev.show() | ||
| for i in range(128): | ||
| dev.scroll(1, 0) | ||
| dev.show() | ||
| sleep_ms(20) | ||
| result = True | ||
| expect_true: true | ||
| mode: [hardware] | ||
|
|
||
| - name: "Animation was smooth" | ||
| action: manual | ||
| prompt: "Le texte 'STeaMi' a-t-il defile horizontalement de maniere fluide ?" | ||
| expect_true: true | ||
| mode: [hardware] |
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
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.