guyc / py-gaugette

Python library to support building hardware gadgets with the Raspberry Pi and BeagleBone Black

Home Page:http://guy.carpenter.id.au/gaugette/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for 128x64 oled

stephen-mw opened this issue · comments

Thanks so much for the awesome library to power an ssd1306 on a rpi. I saw in the forum that you added support for the 128x64 oled but I don't see the changes in the code. Is support for the larger oled coming soon?

Oh I found it https://github.com/guyc/py-gaugette/blob/master/gaugette/ssd1306.py#L148

So basically I can just set the rows=64 when I first begin. Thanks again for all of your hard work. I really appreciate it.

Yep, that's exactly right. Remember that because the 64-line display has no hidden-memory, the vertical scrolling methods in the library won't work as they do on the 32-line unit. I've been discussing adding vertical scrolling support for the 64-line display on the forum, but it hasn't happened yet.

Does that also mean that horizontal scrolling isn't supported?

I think it should work, but I have never tested it (or anything else) on that display.

You would create a buffer that is wider than 128 columns:
bitmap = ssd1306.Bitmap(buffer_width, 64)

Draw to the bitmap:
bitmap.draw_text(x,y,text,font)

Display the bitmap:
ssd1306.display_block(bitmap, 0, 0, 64, col_offset)

col_offset is the scroll position. A value of 0 is unscrolled, a value of 5 redraws the display starting from the 5th column, which has the effect of scrolling left 5 pixels. Each call to display_block resends the entire 1K data block, so you will want the fastest SPI rate available to keep if from sucking too badly performance-wise. Valid values of col_offset are 0 through (buffer_width - display_width).