A derived version of the BSD licensed Adafrut GFX library for the SSD1306 controller for an OLED 128x32 or 128x64 display using SPI or I2C.
Fork of Adafruit_GFX by
Diff: Adafruit_SSD1306.h
- Revision:
- 17:cbd14e83142c
- Parent:
- 15:77feec1c0684
--- a/Adafruit_SSD1306.h Tue Nov 11 22:08:20 2014 +0000 +++ b/Adafruit_SSD1306.h Sun Mar 29 15:29:50 2015 +0000 @@ -130,22 +130,48 @@ }; protected: + virtual void setPageAddress(uint8_t add) + { + add=0xb0|add; + this->command(add); + } + + virtual void setColumnAddress(uint8_t add) + { + this->command((0x10|(add>>4))+0x02); + this->command((0x0f&add)); + } + virtual void sendDisplayBuffer() { - cs = 1; - dc = 1; - cs = 0; - - for(uint16_t i=0, q=buffer.size(); i<q; i++) - mspi.write(buffer[i]); - - if(height() == 32) - { + if (height() == 48 && width() == 64) { + uint8_t i, j; + for (i=0; i<6; i++) { + this->setPageAddress(i); + this->setColumnAddress(0); + for (j=0;j<0x40;j++) { + this->data(buffer[i*0x40+j]); + } + } + + } else { + cs = 1; + dc = 1; + cs = 0; + for(uint16_t i=0, q=buffer.size(); i<q; i++) - mspi.write(0); + mspi.write(buffer[i]); + + if(height() == 32) + { + for(uint16_t i=0, q=buffer.size(); i<q; i++) + mspi.write(0); + } + + cs = 1; } - cs = 1; + }; DigitalOut2 cs, dc;