[2025-04-14] Fix typos in Microzig post, SDD -> SSD

This commit is contained in:
Andrew Conlin 2025-04-14 17:23:37 +01:00
parent 41f6b9d2c0
commit 297e1774d9

View File

@ -4,7 +4,7 @@ category: blog
title: Writing an OLED display driver in MicroZig title: Writing an OLED display driver in MicroZig
--- ---
**Update 2025-03-06** / There is now an SDD1306 driver available in the [official MicroZig repository](https://github.com/ZigEmbeddedGroup/microzig/blob/main/drivers/display/ssd1306.zig). **Update 2025-03-06** / There is now an SSD1306 driver available in the [official MicroZig repository](https://github.com/ZigEmbeddedGroup/microzig/blob/main/drivers/display/ssd1306.zig).
# # Beginnings # # Beginnings
Recently, I have been messing around with a Rapsberry Pi Pico. Initially, I started out with MicroPython, as this is what most of the documentation for working with the Pico uses. However, this was honestly a little boring, as I seem to end up doing every project in Python. I wanted something a little more engaging for my brain, a little *spicier*. It's Friday afternoon! Recently, I have been messing around with a Rapsberry Pi Pico. Initially, I started out with MicroPython, as this is what most of the documentation for working with the Pico uses. However, this was honestly a little boring, as I seem to end up doing every project in Python. I wanted something a little more engaging for my brain, a little *spicier*. It's Friday afternoon!
@ -17,7 +17,7 @@ This project is great. It is still in the early-ish stages, with full support on
This is exactly what I needed, so I jumped right in. Following along with the [Raspberry Pi examples](https://github.com/ZigEmbeddedGroup/microzig/tree/main/examples/raspberrypi-rp2040), I quickly had some working code for flashing some LEDs. Cool! This is exactly what I needed, so I jumped right in. Following along with the [Raspberry Pi examples](https://github.com/ZigEmbeddedGroup/microzig/tree/main/examples/raspberrypi-rp2040), I quickly had some working code for flashing some LEDs. Cool!
At this point, I remembered about a small OLED screen that I had, perfect for exactly this kind of tinkering. Time to get to work on on driving this bad boy. As is always the first step with hardware, I went off on a datasheet hunt. It took me an embarassingly long time to find, but I eventually figured out that I was the proud owner of an [SDD1306 OLED screen](https://cdn-shop.adafruit.com/datasheets/SSD1306.pdf). (This is the datasheet for the 128x64 version, but I have the 128x32). At this point, I remembered about a small OLED screen that I had, perfect for exactly this kind of tinkering. Time to get to work on on driving this bad boy. As is always the first step with hardware, I went off on a datasheet hunt. It took me an embarassingly long time to find, but I eventually figured out that I was the proud owner of an [SSD1306 OLED screen](https://cdn-shop.adafruit.com/datasheets/SSD1306.pdf). (This is the datasheet for the 128x64 version, but I have the 128x32).
Now, as datasheets go, this is pretty good. We have all of the available commands, and instructions for how to write to the display RAM (for showing stuff on the screen). But how do we send these commands? This is also in the datasheet: [I2C](https://en.wikipedia.org/wiki/I%C2%B2C). There is a brief explanation in there about what the device is expecting, but I needed to do some more digging, as this is my first time dabbling directly in I2C communication. Now, as datasheets go, this is pretty good. We have all of the available commands, and instructions for how to write to the display RAM (for showing stuff on the screen). But how do we send these commands? This is also in the datasheet: [I2C](https://en.wikipedia.org/wiki/I%C2%B2C). There is a brief explanation in there about what the device is expecting, but I needed to do some more digging, as this is my first time dabbling directly in I2C communication.
@ -53,7 +53,7 @@ pub fn send(bytes: []const u8) !void {
} }
``` ```
The SDD1306, stood firm, resolutely denying me even a single pixel. There is no feedback for any of this, except a single flashing LED to let me know my code is running. I am shooting from the hip (and missing). The SSD1306, stood firm, resolutely denying me even a single pixel. There is no feedback for any of this, except a single flashing LED to let me know my code is running. I am shooting from the hip (and missing).
It was at this point that I became really impressed with Zig's compilation, and in particular the caching. As part of this process, I was messing around a lot with my code, and then building and loading onto the Pico with the following command: It was at this point that I became really impressed with Zig's compilation, and in particular the caching. As part of this process, I was messing around a lot with my code, and then building and loading onto the Pico with the following command: