-
Notifications
You must be signed in to change notification settings - Fork 1
docs: Expand README for ssd1327 driver. #218
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,9 +1,174 @@ | ||||||
| # MicroPython library for SSD1327 128x128 4-bit greyscale OLED displays | ||||||
| # SSD1327 MicroPython Driver | ||||||
|
|
||||||
| This library is a port of the [MicroPython library for SSD1327 128x128 4-bit greyscale OLED displays](https://github.com/mcauser/micropython-ssd1327). | ||||||
| MicroPython driver for the **SSD1327 128x128 4-bit greyscale OLED display controller**. | ||||||
|
|
||||||
| The examples could be easily tested with [mpremote](https://docs.micropython.org/en/latest/reference/mpremote.html) with the following command : | ||||||
| This library is a port of the original MicroPython SSD1327 driver. | ||||||
|
|
||||||
| ```sh | ||||||
| mpremote mount . run examples/hello_world.py | ||||||
| ## Features | ||||||
|
|
||||||
| * 128x128 **OLED display support** | ||||||
| * **4-bit greyscale** (16 levels) | ||||||
| * I²C and SPI interfaces | ||||||
| * Full **frame buffer integration** | ||||||
| * Drawing primitives: | ||||||
| * pixels, lines, text | ||||||
| * scrolling | ||||||
| * Display control: | ||||||
| * contrast | ||||||
| * invert | ||||||
| * rotation | ||||||
| * Power management: | ||||||
| * display on/off | ||||||
| * Optimized buffer rendering | ||||||
|
|
||||||
| ## Display Specifications | ||||||
|
|
||||||
| | Feature | Value | | ||||||
| | ----------- | ----------------- | | ||||||
| | Resolution | 128 × 128 pixels | | ||||||
| | Color depth | 4-bit (16 levels) | | ||||||
| | Controller | SSD1327 | | ||||||
| | Interfaces | I²C, SPI | | ||||||
|
|
||||||
| ## I2C Address | ||||||
|
|
||||||
| Default I²C address: | ||||||
|
|
||||||
| ``` | ||||||
| 0x3C | ||||||
| ``` | ||||||
|
|
||||||
| ## Basic Usage | ||||||
|
|
||||||
| ```python | ||||||
| from machine import I2C | ||||||
| from ssd1327 import WS_OLED_128X128_I2C | ||||||
|
|
||||||
| # Init I2C | ||||||
| i2c = I2C(1) | ||||||
|
|
||||||
| # Init display | ||||||
| display = WS_OLED_128X128_I2C(i2c) | ||||||
|
|
||||||
| # Draw | ||||||
| display.fill(0) | ||||||
| display.text("Hello STeaMi", 0, 0) | ||||||
|
|
||||||
| # Update screen | ||||||
| display.show() | ||||||
| ``` | ||||||
|
|
||||||
| ## FrameBuffer Integration | ||||||
|
|
||||||
| The driver internally uses `framebuf.FrameBuffer`, meaning **all standard drawing methods are available**. | ||||||
|
|
||||||
| This allows you to use: | ||||||
|
|
||||||
| * `fill()` | ||||||
| * `pixel()` | ||||||
| * `line()` | ||||||
| * `rect()` | ||||||
| * `text()` | ||||||
| * `scroll()` | ||||||
|
||||||
|
|
||||||
| Example: | ||||||
|
|
||||||
| ```python | ||||||
| display.line(0, 0, 127, 127, 15) | ||||||
| display.pixel(10, 10, 8) | ||||||
| display.show() # Required to update the screen | ||||||
| ``` | ||||||
|
|
||||||
| The buffer is stored in **4-bit greyscale format (GS4_HMSB)**. | ||||||
|
|
||||||
| ## API Reference | ||||||
|
|
||||||
| ### Initialization | ||||||
|
|
||||||
| #### I2C | ||||||
|
|
||||||
| ```python | ||||||
| SSD1327_I2C(width, height, i2c, address=0x3C) | ||||||
| WS_OLED_128X128_I2C(i2c, address=0x3C) | ||||||
| ``` | ||||||
|
|
||||||
| #### SPI | ||||||
|
|
||||||
| ```python | ||||||
| SSD1327_SPI(width, height, spi, dc, res, cs) | ||||||
| WS_OLED_128X128_SPI(spi, dc, res, cs) | ||||||
| ``` | ||||||
|
Comment on lines
+69
to
+73
|
||||||
|
|
||||||
| ### Drawing Methods (FrameBuffer) | ||||||
|
|
||||||
| * `fill(color)` | ||||||
| * `pixel(x, y, color)` | ||||||
| * `line(x1, y1, x2, y2, color)` | ||||||
| * `text(string, x, y, color=15)` | ||||||
| * `scroll(dx, dy)` | ||||||
|
|
||||||
| ### Display Control | ||||||
|
|
||||||
| * `show()` — update display with buffer | ||||||
| * `contrast(value)` — set brightness (0–255) | ||||||
| * `invert(enable)` — enable/disable inversion | ||||||
| * `rotate(enable)` — rotate display | ||||||
|
|
||||||
| ### Power Management | ||||||
|
|
||||||
| * `power_on()` — turn display on | ||||||
| * `power_off()` — turn display off (low power mode) | ||||||
|
|
||||||
| ### Low-Level | ||||||
|
|
||||||
| * `write_cmd(cmd)` | ||||||
| * `write_data(buf)` | ||||||
|
|
||||||
| (Implemented internally for I²C/SPI communication) | ||||||
|
|
||||||
| ## Examples | ||||||
|
|
||||||
| This driver includes many examples available in the `examples/` folder: | ||||||
|
|
||||||
| | File | Description | | ||||||
| | -------------- | ------------------ | | ||||||
| | bitmap.py | Image display | | ||||||
| | framebuf_lines.py | Draw a line | | ||||||
| | framebuf_pixel.py | Draw a pixel | | ||||||
| | framebuf_rect.py | Draw a rectangle | | ||||||
| | framebuf_scroll.py | Scroll a text | | ||||||
| | framebuf_text.py | Display a text | | ||||||
| | hello_world.py | Display "Hello World" | | ||||||
| | illusion.py | Display an optic illusion | | ||||||
| | invert.py | invert greyscale lookup table | | ||||||
| | lookup_table.py | Display gradiant | | ||||||
|
||||||
| | lookup_table.py | Display gradiant | | |
| | lookup_table.py | Display gradient | |
Copilot
AI
Mar 23, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Several example filenames in the table don't match the actual files in lib/ssd1327/examples/ (e.g., framebuf_pixels.py, framebuf_rects.py, random_pixels.py, rotating_3d_cube.py). Please update the table so each row links to/mentions the correct filename, otherwise users will get "file not found" when trying to run them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The feature bullet "Optimized buffer rendering" looks inaccurate for this driver:
show()always writes the full framebuffer (self.write_data(self.buffer)), with no partial/dirty-rectangle updates. Consider rewording this bullet to avoid implying incremental rendering, or document what is actually optimized here (if anything).