pimoroni / BreakoutGarden

0 stars 0 forks source link

SH1106 (1.12" OLED) #9

Open Gadgetoid opened 3 years ago

Gadgetoid commented 3 years ago

CPython TODO

Check Luma submodules and see if we can update the script to use upstream, or see what needs to happen to do this.

CircuitPython TODO

Test CircuitPython library on Pico with 1.12" OLED.

Gadgetoid commented 3 years ago

C++ library kindly contributed by Simon - https://github.com/pimoroni/pimoroni-pico/pull/81

Gadgetoid commented 3 years ago

I have evaluated this library and begun making changes so that @ZodiusInfuser can Python bind it.

Crucially we have to remove any compile-time macros, since MicroPython will only compile this library once. In lieu of these my changes will store an spi and i2c instance, and use SPI if the instance is not a nullptr.

It would be possible to init both SPI and I2C with a single instance of this library and switch between the two, but the resulting constructor would be a baffling list of pins and... well who'd find that useful anyway!?

I've attempted to change as little as possible, but have also removed the const width/height and framebuffer, following the pattern of our other display drivers. MicroPython should now be able to alloc and pass in a buffer. The library uses a 129-byte write buffer for i2c (maximum row size plus register byte) but that shouldn't be an issue.

See a relatively concise diff of my changes-in-progress here - https://github.com/simon3270/pimoroni-pico/pull/1/files

TODO