ThingPulse / esp8266-oled-ssd1306

Driver for the SSD1306 and SH1106 based 128x64, 128x32, 64x48 pixel OLED display running on ESP8266/ESP32
https://thingpulse.com
Other
2.02k stars 640 forks source link

Support multiple display resolutions #133

Closed DaveRichmond closed 6 years ago

DaveRichmond commented 7 years ago

Here's basic support for displays of different sizes. I only have an I2C 64x48 SSD1306 and 128x64 SSD1306 display to test with and have only implemented it for the Wire backend (tried it with brzo but had issues elsewhere with timing).

Hopefully it gives a good starting point if someone has other displays to test with as the display/interface-specific code is fairly minimal.

micooke commented 7 years ago

First of all, thanks for the mod. Im looking at using this for a 64x32 oled.

Secondly, and this is more a general question, but why are we using signed integers? The screens we are talking about all fit in to a uint8_t. You save memory and do not require negative checks if you use uint8_t.

micooke commented 7 years ago

With this pull request, you only consider the default case so (unless im missing something) there is currently no way to propogate a non-default height, width to the child classes like SSD1306 SPI et al who have constructors with pin assignments.

A second thing, the internal use of width() instead of the internal _width parameter adds unnecessary overhead due to the additional function calls.

The use of public width() like this is designed so that external calls dont have direct access to internal variables.

squix78 commented 6 years ago

Thank you so much for your contribution and sorry for my late response. Your changes were superseded by other PRs and are now in one or another form part of the code base.