CLI for managing an SSD1306-based display
Go to file
2023-03-29 11:32:40 -07:00
src basic working text sample 2023-03-29 11:32:40 -07:00
.gitignore add basic poc - works with imagemagick 2023-03-09 12:47:22 -08:00
build.zig update to zig 0.11.0-dev.2157+f56f3c582 2023-03-19 10:56:20 -07:00
build.zig.zon update to zig 0.11.0-dev.2157+f56f3c582 2023-03-19 10:56:20 -07:00
LICENSE add basic poc - works with imagemagick 2023-03-09 12:47:22 -08:00
README.md add basic poc - works with imagemagick 2023-03-09 12:47:22 -08: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