Define OLED address instead of hard-coding
Closed this issue · 6 comments
Define OLED address like Screen Width/Height rather than hard-coding.
if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3C for 128x32
if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3D)) { // Address 0x3D for 128x64
you can set the width/height on instantiation, thats where the allocation happens as well.
Agree but it would be nicer to use like:
...
#define SCREEN_HEIGHT 32 // OLED display height, in pixels
#define SCREEN_ADDRESS 0x3D ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32
...
if(!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
...
I'd be happy to do a PR.
that is not possible to do, a #define does not change the allocation inside the library
wait, do mean just changing the examples? or the API?
Just the examples so SCREEN_ADDRESS
(or preferred name) is identified more clearly.
oooh ok yes thats ok! sorry we get tons of people trying to change the API... yes a PR is welcome, please note it has to pass CI
https://learn.adafruit.com/contribute-to-arduino-with-git-and-github