|
2 | 2 |
|
3 | 3 | This example code shows how to interface the Raspberry Pi Pico with an 128x32 OLED display board based on the SSD1306 display driver, datasheet https://cdn-shop.adafruit.com/datasheets/SSD1306.pdf[here].
|
4 | 4 |
|
5 |
| -The code displays a series of tiny raspberries that scroll horizontally, in the process showing you how to initialize the display, write to the entire display, write to only a portion of the display, and configure scrolling. |
| 5 | +The code displays a series of small demo graphics; tiny raspberries that scroll horizontally, some text, and some line drawing, in the process showing you how to initialize the display, write to the entire display, write to only a portion of the display, configure scrolling, invert the display etc. |
6 | 6 |
|
7 | 7 | The SSD1306 is operated via a list of versatile commands (see datasheet) that allows the user to access all the capabilities of the driver. After sending a slave address, the data that follows can be either a command, flags to follow up a command or data to be written directly into the display's RAM. A control byte is required for each write after the slave address so that the driver knows what type of data is being sent.
|
8 | 8 |
|
9 |
| -This display is 32 pixels high by 128 pixels wide. These 32 vertical pixels are partitioned into 4 pages, each 8 pixels in height. In RAM, this looks roughly like: |
| 9 | +The example code supports displays of 32 pixel or 64 pixels high by 128 pixels wide by changing a define at the top of the code. |
10 | 10 |
|
11 |
| -[NOTE] |
12 |
| -====== |
13 |
| -The SSD1306 can drive displays that are up to 64 pixels high and 128 pixels wide. |
14 |
| -====== |
| 11 | +In the 32 vertical pixels case, the display is partitioned into 4 pages, each 8 pixels in height. In RAM, this looks roughly like: |
15 | 12 |
|
16 | 13 | ----
|
17 | 14 | | COL0 | COL1 | COL2 | COL3 | ... | COL126 | COL127 |
|
@@ -42,30 +39,24 @@ The driver has 3 modes of transferring the pixels in RAM to the display (provide
|
42 | 39 |
|
43 | 40 | Horizontal addressing mode has the key advantage that we can keep one single 512 byte buffer (128 columns x 4 pages and each byte fills a page's rows) and write this in one go to the RAM (column address auto increments on writes as well as reads) instead of working with 2D matrices of pixels and adding more overhead.
|
44 | 41 |
|
45 |
| -[NOTE] |
46 |
| -====== |
47 |
| -* The SSD1306 is able to drive 128x64 displays but as our display is 128x32, only half of the COM (common) pins are connected to the display. |
48 |
| -* The specific display model being used is UG-2832HSWEG02 |
49 |
| -====== |
50 |
| - |
51 | 42 | == Wiring information
|
52 | 43 |
|
53 | 44 | Wiring up the device requires 4 jumpers, to connect VCC (3.3v), GND, SDA and SCL and optionally a 5th jumper for the driver RESET pin. The example here uses the default I2C port 0, which is assigned to GPIO 4 (SDA) and 5 (SCL) in software. Power is supplied from the 3.3V pin from the Pico.
|
54 | 45 |
|
55 |
| -[[oled_i2c_wiring]] |
| 46 | +[[ssd1306_i2c_wiring]] |
56 | 47 | [pdfwidth=75%]
|
57 | 48 | .Wiring Diagram for oled display via I2C.
|
58 |
| -image::oled_i2c_bb.png[] |
| 49 | +image::ssd1306_i2c_bb.png[] |
59 | 50 |
|
60 | 51 | == List of Files
|
61 | 52 |
|
62 | 53 | CMakeLists.txt:: CMake file to incorporate the example into the examples build tree.
|
63 |
| -oled_i2c.c:: The example code. |
| 54 | +sd1306_i2c.c:: The example code. |
64 | 55 |
|
65 | 56 | == Bill of Materials
|
66 | 57 |
|
67 | 58 | .A list of materials required for the example
|
68 |
| -[[oled_i2c-bom-table]] |
| 59 | +[[ssd1306_i2c-bom-table]] |
69 | 60 | [cols=3]
|
70 | 61 | |===
|
71 | 62 | | *Item* | *Quantity* | Details
|
|
0 commit comments