You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
= Simple graphics and stdout text on an OLED display via SPI
2
+
3
+
Ths example displays text and graphics on one of the widely-available small OLED panels based on the *SSD1309* controller. It should also work with compatible devices such as the *SSD1306* (not tested).
4
+
5
+
These modules typically support either I2C or SPI. For this example you will need one configured for SPI.
6
+
7
+
The code renders content onto a frame buffer that is transferred to the SPI port in the background, by a DMA channel under the control of a frame timer. A simple driver is used to copy _stdout_ to the frame buffer and some basic graphics functions are provided.
8
+
9
+
The interface uses one of the Pico's onboard SPI peripherals and two extra GPIO pins as shown below. Note that in SPI mode the SSD1309 is a receive-only device.
10
+
11
+
For details of the commands supported by the SSD1309 controller and its addressing modes see the manufacturer's datasheet: https://www.hpinfotech.ro/SSD1309.pdf.
12
+
13
+
14
+
== Wiring information
15
+
16
+
Wiring up the device requires seven jumpers as follows:
The example uses SPI device 0 and powers the display from the Pico 3.3v output. If you power the display from an external supply then ensure that the Pico's logic pins are not exposed to any voltage higher than 3.3v.
27
+
28
+
[NOTE]
29
+
======
30
+
The pins on your board may be labelled slightly differently to the list above. Check the documentation for your display.
31
+
32
+
You can change the code to use different pins if you like, but the ones for CSn, TX and SCK must match your SPI device: see the GPIO Function Select Table in the datasheet.
33
+
======
34
+
35
+
36
+
[[wiring_diagram.png]]
37
+
[pdfwidth=75%]
38
+
.Wiring Diagram for SSD1309 with SPI interface
39
+
image::wiring_diagram.png[]
40
+
41
+
== List of Files
42
+
43
+
CMakeLists.txt:: A file to configure the CMake build system for the example.
44
+
ssd1309_stdout_spi.c:: The example code.
45
+
font.h:: A basic 8x8 bit font table used by the example.
46
+
47
+
48
+
== Bill of Materials
49
+
50
+
.A list of materials required for the example
51
+
[[SSD1309-bom-table]]
52
+
[cols=3]
53
+
|===
54
+
| *Item* | *Quantity* | Details
55
+
| Breadboard | 1 | generic part
56
+
| Raspberry Pi Pico or Pico 2 | 1 | https://www.raspberrypi.com/products/raspberry-pi-pico/
57
+
| SSD1309-based OLED display panel with SPI interface| 1 | generic part
0 commit comments