add scroll function
Dependents: I2C_SSD1306_nucleo_l432KCc I2C_SSD1306_nucleo_l432KC
Fork of Adafruit_GFX by
Diff: Adafruit_SSD1306.cpp
- Revision:
- 19:e31b31e3128a
- Parent:
- 17:e42e6f9c84e0
--- a/Adafruit_SSD1306.cpp Tue Jun 23 09:49:01 2015 +0000 +++ b/Adafruit_SSD1306.cpp Fri Sep 21 08:24:03 2018 +0000 @@ -143,7 +143,72 @@ sendDisplayBuffer(); command(SSD1306_DISPLAYON); } +// startscrollright +// Activate a right handed scroll for rows start through stop +// Hint, the display is 16 rows tall. To scroll the whole display, run: +// display.scrollright(0x00, 0x0F) +void Adafruit_SSD1306::startscrollright(uint8_t start, uint8_t stop){ + command(SSD1306_RIGHT_HORIZONTAL_SCROLL); + command(0X00); + command(start); + command(0X00); + command(stop); + command(0X00); + command(0XFF); + command(SSD1306_ACTIVATE_SCROLL); +} +// startscrollleft +// Activate a right handed scroll for rows start through stop +// Hint, the display is 16 rows tall. To scroll the whole display, run: +// display.scrollright(0x00, 0x0F) +void Adafruit_SSD1306::startscrollleft(uint8_t start, uint8_t stop){ + command(SSD1306_LEFT_HORIZONTAL_SCROLL); + command(0X00); + command(start); + command(0X00); + command(stop); + command(0X00); + command(0XFF); + command(SSD1306_ACTIVATE_SCROLL); +} + +// startscrolldiagright +// Activate a diagonal scroll for rows start through stop +// Hint, the display is 16 rows tall. To scroll the whole display, run: +// display.scrollright(0x00, 0x0F) +void Adafruit_SSD1306::startscrolldiagright(uint8_t start, uint8_t stop){ + command(SSD1306_SET_VERTICAL_SCROLL_AREA); + command(0X00); + command(SSD1306_LCDHEIGHT); + command(SSD1306_VERTICAL_AND_RIGHT_HORIZONTAL_SCROLL); + command(0X00); + command(start); + command(0X00); + command(stop); + command(0X01); + command(SSD1306_ACTIVATE_SCROLL); +} + +// startscrolldiagleft +// Activate a diagonal scroll for rows start through stop +// Hint, the display is 16 rows tall. To scroll the whole display, run: +// display.scrollright(0x00, 0x0F) +void Adafruit_SSD1306::startscrolldiagleft(uint8_t start, uint8_t stop){ + command(SSD1306_SET_VERTICAL_SCROLL_AREA); + command(0X00); + command(SSD1306_LCDHEIGHT); + command(SSD1306_VERTICAL_AND_LEFT_HORIZONTAL_SCROLL); + command(0X00); + command(start); + command(0X00); + command(stop); + command(0X01); + command(SSD1306_ACTIVATE_SCROLL); +} +void Adafruit_SSD1306::stopscroll(void){ + command(SSD1306_DEACTIVATE_SCROLL); +} // Clear the display buffer. Requires a display() call at some point afterwards void Adafruit_SSD1306::clearDisplay(void) {