add scroll function
Dependents: I2C_SSD1306_nucleo_l432KCc I2C_SSD1306_nucleo_l432KC
Fork of Adafruit_GFX by
Diff: Adafruit_SSD1306.h
- Revision:
- 19:e31b31e3128a
- Parent:
- 15:77feec1c0684
diff -r 3112550cc6a3 -r e31b31e3128a Adafruit_SSD1306.h --- a/Adafruit_SSD1306.h Tue Jun 23 09:49:01 2015 +0000 +++ b/Adafruit_SSD1306.h Fri Sep 21 08:24:03 2018 +0000 @@ -38,9 +38,50 @@ DigitalOut2& operator= (DigitalOut2& rhs) { write(rhs.read()); return *this; }; operator int() { return read(); }; }; - +#define SSD1306_LCDWIDTH 128 +#define SSD1306_LCDHEIGHT 64 #define SSD1306_EXTERNALVCC 0x1 #define SSD1306_SWITCHCAPVCC 0x2 +#define SSD1306_ACTIVATE_SCROLL 0x2F +#define SSD1306_DEACTIVATE_SCROLL 0x2E +#define SSD1306_SET_VERTICAL_SCROLL_AREA 0xA3 +#define SSD1306_RIGHT_HORIZONTAL_SCROLL 0x26 +#define SSD1306_LEFT_HORIZONTAL_SCROLL 0x27 +#define SSD1306_VERTICAL_AND_RIGHT_HORIZONTAL_SCROLL 0x29 +#define SSD1306_VERTICAL_AND_LEFT_HORIZONTAL_SCROLL 0x2A +#define SSD1306_SETCONTRAST 0x81 +#define SSD1306_DISPLAYALLON_RESUME 0xA4 +#define SSD1306_DISPLAYALLON 0xA5 +#define SSD1306_NORMALDISPLAY 0xA6 +#define SSD1306_INVERTDISPLAY 0xA7 +#define SSD1306_DISPLAYOFF 0xAE +#define SSD1306_DISPLAYON 0xAF + +#define SSD1306_SETDISPLAYOFFSET 0xD3 +#define SSD1306_SETCOMPINS 0xDA + +#define SSD1306_SETVCOMDETECT 0xDB + +#define SSD1306_SETDISPLAYCLOCKDIV 0xD5 +#define SSD1306_SETPRECHARGE 0xD9 + +#define SSD1306_SETMULTIPLEX 0xA8 + +#define SSD1306_SETLOWCOLUMN 0x00 +#define SSD1306_SETHIGHCOLUMN 0x10 + +#define SSD1306_SETSTARTLINE 0x40 + +#define SSD1306_MEMORYMODE 0x20 +#define SSD1306_COLUMNADDR 0x21 +#define SSD1306_PAGEADDR 0x22 + +#define SSD1306_COMSCANINC 0xC0 +#define SSD1306_COMSCANDEC 0xC8 + +#define SSD1306_SEGREMAP 0xA0 + +#define SSD1306_CHARGEPUMP 0x8D /** The pure base class for the SSD1306 display driver. * @@ -63,6 +104,7 @@ virtual void command(uint8_t c) = 0; virtual void data(uint8_t c) = 0; virtual void drawPixel(int16_t x, int16_t y, uint16_t color); + //virtual void drawCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color); /// Clear the display buffer void clearDisplay(void); @@ -70,6 +112,12 @@ /// Cause the display to be updated with the buffer content. void display(); + /// Scroll + virtual void startscrollright(uint8_t start, uint8_t stop); + virtual void startscrollleft(uint8_t start, uint8_t stop); + virtual void startscrolldiagright(uint8_t start, uint8_t stop); + virtual void startscrolldiagleft(uint8_t start, uint8_t stop); + void stopscroll(void); /// Fill the buffer with the AdaFruit splash screen. virtual void splash(); @@ -158,7 +206,7 @@ class Adafruit_SSD1306_I2c : public Adafruit_SSD1306 { public: - #define SSD_I2C_ADDRESS 0x78 + #define SSD_I2C_ADDRESS 0x78//0x78 /** Create a SSD1306 I2C transport display driver instance with the specified RST pin name, the I2C address, as well as the display dimensions * * Required parameters