CLI for managing an SSD1306-based display
Go to file
Emil Lerch 542ae15889
All checks were successful
Generic zig build / build (push) Successful in 5m32s
use splitScalar specifically
2024-07-01 16:04:59 -07:00
.github/workflows upgrade to zig 0.13.0 2024-06-08 10:31:23 -07:00
lib/i2cdriver add return code handling 2023-03-30 12:05:24 -07:00
src use splitScalar specifically 2024-07-01 16:04:59 -07:00
.gitignore add fontgen output to git ignore 2023-04-06 13:27:15 -07:00
AsciiPrintableStep.zig upgrade to zig 0.12.0 2024-04-30 21:27:37 -07:00
build.zig upgrade to zig 0.13.0 2024-06-08 10:31:23 -07:00
build.zig.zon upgrade to zig 0.12.0 2024-04-30 21:27:37 -07:00
LICENSE add basic poc - works with imagemagick 2023-03-09 12:47:22 -08:00
README.md adjust readme 2024-04-30 21:31:16 -07:00

Phenominal walkthrough of a bunch of this stuff

Hardware

SSD1306 display, 128x64.

The first incarnation was done via GIMP. We can get what we need though with ImageMagick:

magick openlogo.svg -resize 128x64 -background white -gravity center -extent 128x64 -monochrome txt:-

White pixels are #FC24FC24FC24, and black is #000000000.

We need to be in a format like openlogo.bits (for the moment)

From there, we can send to the display. Over Linux i2c, we can send a max of 32 bytes at a time, so we need to split up into multiple runs (4 horizontal or 2 vertical)

Reference

Using linux i2c native

i2cset 0 0x3c 0x00 0x21 0x00 0x7F i
       ^^ i2c bus number. These are /dev/i2c-n in Linux
          To find the things, use i2cdetect -y -r <bus number>

i2cset 0 0x3c 0x40 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 i

USB i2c mini

Driver

./bitmap_to_i2ccl openlogo.bits > ~/i2cdriver/c/build/bytes
./i2ccl /dev/ttyUSB0 w 0x3c 0x00,0x20,0x00
                                   ^^ command

./i2ccl /dev/ttyUSB0 w 0x3c 0x40,`cat bytes`
                            ^^ i2c bus number
                                  ^^ data

i2ccl is doing more stuff for us though...

Initialization sequence:

0x00 0x8d 0x14 # Enable charge pump
0x00 0xaf      # Turn on display

Note that most real applications do a bunch of other things so as not to assume any specific state on startup.

Reference