💾 Archived View for gem.librehacker.com › gemlog › starlog › 20230614-0.gmi captured on 2023-07-22 at 16:59:45. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-06-16)

-=-=-=-=-=-=-

Learning Zeptoforth: OLED Display

I have Zeptoforth 1.0.1 installed on my Pico, and I'm learning how to use the bitmap drawing interface for ssd1306-based displays. This communicates over I²C. Here is my display, which is using the string printing interface to display a counter of the microsecond timer register, updating every 10ms:

OLED driven by Rpi Pico and Zeptoforth.

Here is the boilerplate from the example code:

oo import
bitmap import
ssd1306 import
font import
simple-font import

128 constant my-width
64 constant my-height

my-width my-height bitmap-buf-size constant my-buf-size
my-buf-size 4 align buffer: my-buf
<ssd1306> class-size buffer: my-ssd1306
14 15 my-buf my-width my-height SSD1306_I2C_ADDR 1 <ssd1306> my-ssd1306 init-object

init-simple-font

And here is the counter display code:

: my-draw-string op-set my-ssd1306 a-simple-font draw-string ;

: my-update-display my-ssd1306 update-display ;

: display-us-counter begin us-counter <# #s #> 1 1 my-draw-string my-update-display 10 ms again ;