I just published the library of drivers for SSD1306 and SH1106 monochrome OLED displays. There is a driver for SSD1306 displays in MicroPython's repository, but I wasn't satisfied with it. The drivers in this library are minimalist, each version is in a separate self-contained file, so that you only need to copy that one file onto your device (you usually only use one display at a time anyways). They also avoid allocating memory and all sorts of indirection (inheritance, wrapping, etc.) to get around speed penalties. Because of that the code is not as readable, and there is quite a lot of repetition, but I'm willing to accept that. I also added support for some hardware functions of the display, like flipping, scrolling, etc.
The code is at https://bitbucket.org/thesheep/micropython-oled
OLED Drivers
Re: OLED Drivers
I will try this tomorrow, have you tried on the 8266 ?
Re: OLED Drivers
Yes, I mostly tested this on the ESP8266.
Re: OLED Drivers
This is nice. Thanks again for your efforts.
I know I should look at the framebuf source, but do you know if the framebuf handles out-of-range values? What I mean is, if I have a coordinate bug and try to set a pixel out of range... does framebuf quietly ignore such an invalid command?
I know I should look at the framebuf source, but do you know if the framebuf handles out-of-range values? What I mean is, if I have a coordinate bug and try to set a pixel out of range... does framebuf quietly ignore such an invalid command?
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: OLED Drivers
It ignores them: https://github.com/micropython/micropyt ... #L286-L299.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: OLED Drivers
Thank you!pythoncoder wrote: ↑Tue Oct 17, 2017 4:23 pmIt ignores them: https://github.com/micropython/micropyt ... #L286-L299.
I have replaced the standard ssd1306.py with a copy of the OP's I2C version. I did write my own wrapper layer to add some other features but the cost was worth it to me. It still runs faster than the original wrapper I had for the regular driver. Anyway, everything seems to work flawlessly.
I love removing code and getting better performance.