i2c version has an offset due to wrong copy of temp buffer to display buffer, fixed in Adafruit_SSD1306.h
Dependents: ezSBC_MPU9250 Test_OLED_Display untodoenuno OledI2CDisplay ... more
Fork of Adafruit_GFX by
Diff: Adafruit_SSD1306.h
- Revision:
- 18:6aa925f254d6
- Parent:
- 17:f0cf0e1210be
- Child:
- 20:04822be0efcd
--- a/Adafruit_SSD1306.h Mon Nov 17 22:55:42 2014 +0000 +++ b/Adafruit_SSD1306.h Wed Mar 04 20:19:52 2015 +0000 @@ -40,9 +40,10 @@ class Adafruit_SSD1306 : public Adafruit_GFX { public: - Adafruit_SSD1306(PinName RST, uint8_t rawHeight = 32, uint8_t rawWidth = 128) + Adafruit_SSD1306(PinName RST, uint8_t rawHeight = 32, uint8_t rawWidth = 128, bool _flipVertical=false) : Adafruit_GFX(rawWidth,rawHeight) , rst(RST,false) + , flipVertical(_flipVertical) { buffer.resize(rawHeight * rawWidth / 8); }; @@ -66,6 +67,7 @@ protected: virtual void sendDisplayBuffer() = 0; DigitalOut rst; + bool flipVertical; // the memory buffer for the LCD std::vector<uint8_t> buffer; @@ -90,8 +92,8 @@ * @param rawHeight - the vertical number of pixels for the display, defaults to 32 * @param rawWidth - the horizonal number of pixels for the display, defaults to 128 */ - Adafruit_SSD1306_Spi(SPI &spi, PinName DC, PinName RST, PinName CS, uint8_t rawHieght = 32, uint8_t rawWidth = 128) - : Adafruit_SSD1306(RST, rawHieght, rawWidth) + Adafruit_SSD1306_Spi(SPI &spi, PinName DC, PinName RST, PinName CS, uint8_t rawHieght = 32, uint8_t rawWidth = 128, bool flipVertical = false) + : Adafruit_SSD1306(RST, rawHieght, rawWidth, flipVertical) , cs(CS,true) , dc(DC,false) , mspi(spi) @@ -160,8 +162,8 @@ * @param rawHeight - The vertical number of pixels for the display, defaults to 32 * @param rawWidth - The horizonal number of pixels for the display, defaults to 128 */ - Adafruit_SSD1306_I2c(I2C &i2c, PinName RST, uint8_t i2cAddress = SSD_I2C_ADDRESS, uint8_t rawHeight = 32, uint8_t rawWidth = 128) - : Adafruit_SSD1306(RST, rawHeight, rawWidth) + Adafruit_SSD1306_I2c(I2C &i2c, PinName RST, uint8_t i2cAddress = SSD_I2C_ADDRESS, uint8_t rawHeight = 32, uint8_t rawWidth = 128, bool flipVertical = false) + : Adafruit_SSD1306(RST, rawHeight, rawWidth, flipVertical) , mi2c(i2c) , mi2cAddress(i2cAddress) {