This is the firmware repo for the Core Electronics PiicoDev® OLED Module
This module depends on the PiicoDev Unified Library, include PiicoDev_Unified.py
in the project directory on your MicroPython device.
See the Quickstart Guide
Parameter | Type | Range | Default | Description |
---|---|---|---|---|
bus | int | 0,1 | Raspberry Pi Pico: 0, Raspberry Pi: 1 | I2C Bus. Ignored on Micro:bit |
freq | int | 100-1000000 | Device dependent | I2C Bus frequency (Hz). Ignored on Raspberry Pi |
sda | machine.Pin | Device Dependent | Device Dependent | I2C SDA Pin. Implemented on Raspberry Pi Pico only |
scl | machine.Pin | Device Dependent | Device Dependent | I2C SCL Pin. Implemented on Raspberry Pi Pico only |
address | int | 0x3C | 0x3C, 0x3D | This address needs to match the PiicoDev OLED SSD1306 hardware address configured by the jumper |
This command is required to send the image assembled using the commands below to the display for viewing.
Parameter | Type | Range | Description |
---|---|---|---|
c | int | 0 - 1 | Fill the display with a single colour (0: Black, 1: White) |
Parameter | Type | Range | Description |
---|---|---|---|
x | int | 0 - 127 | X coordinate |
y | int | 0 - 63 | Y coordinate |
c | int | 0 - 1 | Set the specified pixel to the given color (0: Black, 1: White) |
Draw a horizontal line with a given length using the given colour and a thickness of 1 pixel.
Parameter | Type | Range | Description |
---|---|---|---|
x | int | 0 - 127 | X coordinate |
y | int | 0 - 63 | Y coordinate |
l | int | 1 - 128 | Length |
c | int | 0 - 1 | Set the line to the given color (0: Black, 1: White) |
Draw a vertical line with a given length using the given colour and a thickness of 1 pixel.
Parameter | Type | Range | Description |
---|---|---|---|
x | int | 0 - 127 | X coordinate |
y | int | 0 - 63 | Y coordinate |
l | int | 1 - 64 | Length |
c | int | 0 - 1 | Set the line to the given color (0: Black, 1: White) |
Draw a line from a set of coordinates using the given colour and a thickness of 1 pixel up to a second set of coordinates.
Parameter | Type | Range | Description |
---|---|---|---|
x1 | int | 0 - 127 | X1 coordinate |
y1 | int | 0 - 63 | Y1 coordinate |
x2 | int | 0 - 127 | X2 coordinate |
y2 | int | 0 - 63 | Y2 coordinate |
c | int | 0 - 1 | Set the line to the given color (0: Black, 1: White) |
Draw a rectangle at the given location, size and color. Draws only a 1 pixel outline.
Parameter | Type | Range | Description |
---|---|---|---|
x | int | 0 - 127 | X coordinate |
y | int | 0 - 63 | Y coordinate |
w | int | 1 - 128 | Width |
h | int | 1 - 64 | Height |
c | int | 0 - 1 | Set the line to the given color (0: Black, 1: White) |
Draw a rectangle at the given location, size and color. Draws both the outline and interior.
Parameter | Type | Range | Description |
---|---|---|---|
x | int | 0 - 127 | X coordinate |
y | int | 0 - 63 | Y coordinate |
w | int | 1 - 128 | Width |
h | int | 1 - 64 | Height |
c | int | 0 - 1 | Set the line to the given color (0: Black, 1: White) |
Draw a circle at the given location, with radius and set thickness.
Parameter | Type | Range | Description |
---|---|---|---|
x | int | 0 - 127 | X coordinate |
y | int | 0 - 63 | Y coordinate |
r | int | 0 - 144 | Radius of the circle |
t | float | 0.0 - 1.0 | How filled the circle is, starting from the outer edge, 0 being a line and 1 being fully filled |
c | int | 0 - 1 | Set the line to the given color (0: Black, 1: White) |
Draw an arc at the given location, with radius, start angle, end angle and set thickness.
Parameter | Type | Range | Description |
---|---|---|---|
x | int | 0 - 127 | X coordinate |
y | int | 0 - 63 | Y coordinate |
r | int | 0 - 144 | Radius of the arc |
stAng | int | 0 - 359 | Starting angle of the arc, must be less than the ending angle |
enAng | int | 1 - 360 | Ending angle of the arc, must be greater than the starting angle |
t | float | 0.0 - 1.0 | How filled the arc is, starting from the outer edge, 0 being a line and 1 being fully filled |
c | int | 0 - 1 | Set the line to the given color (0: Black, 1: White) |
Write text to the FrameBuffer using the the coordinates as the upper-left corner of the text.
Dimensions are 8 x 8. There is no way to change the font.
Parameter | Type | Range | Default | Description |
---|---|---|---|---|
s | string | 16 characters max | Text to display. If the text is longer than 16 characters, it will be truncated. | |
x | int | 0 - 127 | X coordinate | |
y | int | 0 - 127 | Y coordinate | |
c | int | 0 - 1 | 1 | Set the line to the given color (0: Black, 1: White) |
Load a pbm file to the FrameBuffer.
It is recommended to use a pbm file generated by the GNU Image Manipulation Program (GIMP).
Parameter | Type | Range | Description |
---|---|---|---|
filename | string | Image to display | |
c | int | 0 - 1 | Only pixels with this colour will be drawn (0: Black, 1: White) |
A graph2D object will be drawn to a rectangular region specified by the origin, width, and height.
This graph type is explicitly designed to draw time series data.
Parameter | Type | Range | Default | Description |
---|---|---|---|---|
originX | int | 0 - 127 | 0 | The x coordinate of the graph's origin (lower left corner). |
originY | int | 0 - 63 | 63 | The y coordinate of the graph's origin (lower left corner). |
width | int | 1-128 | 128 | The width, in pixels, of the graph's drawing area. |
height | int | 1-64 | 64 | The height, in pixels, of the graph's drawing area |
minValue | int | 0 | The value which will be mapped to the bottom edge. | |
maxValue | int | 255 | The value which will be mapped to the upper edge. | |
c | int | 0 - 1 | 1 | Colour value. (0: Black, 1: White) |
bars | Filled chart |
Updates a 2D graph with a new value.
Parameter | Type | Description |
---|---|---|
graph | graph | A graph2D object created graph2D |
value | int | A new value to draw to the graph. This value will be drawn on the right edge and the oldest value will be deleted. |
Raspberry Pi Pico and Pycom only. Shift the contents of the FrameBuffer by the given vector. This may leave a footprint of the previous colors in the FrameBuffer.
Parameter | Type | Range | Description |
---|---|---|---|
xstep | int | 0 - 127 | X coordinate |
ystep | int | 0 - 63 | Y coordinate |
Raspberry Pi Pico and Pycom only. Draw another FrameBuffer on top of the current one at the given coordinates. If key is specified then it should be a color integer and the corresponding color will be considered transparent: all pixels with that color value will not be drawn.
Parameter | Type | Range | Default | Description |
---|---|---|---|---|
fbuf | FrameBuffer | 1024 bytes max | Image to display | |
x | int | 0 - 127 | X coordinate | |
y | int | 0 - 63 | Y coordinate | |
key | int | 0 - 1 | -1 | Key |
Turns off the display.
Turns on the display.
Parameter | Type | Range | Default | Description |
---|---|---|---|---|
contrast | int | 0 - 255 | 255 | Set the contrast. |
Parameter | Type | Range | Default | Description |
---|---|---|---|---|
rotate | int | 0 - 1 | 1 | Rotate the image by 180 degrees (1: Normal, 0: Inverted). |
Parameter | Type | Range | Default | Description |
---|---|---|---|---|
invert | int | 0 - 1 | 0 | Invert the image so black is white and white is black (0: Normal, 1: Inverted). |
This project is open source - please review the LICENSE.md file for further licensing information.
If you have any technical questions, or concerns about licensing, please contact technical support on the Core Electronics forums.
"PiicoDev" and the PiicoDev logo are trademarks of Core Electronics Pty Ltd.