Driver for the Seeedstudio RGB OLED module for the xadow M0
Diff: src/SSD1331.cpp
- Revision:
- 8:ff74bd4d94d6
- Parent:
- 7:5250c825c7bb
- Child:
- 9:5a7bf0ce8518
--- a/src/SSD1331.cpp Sun Nov 15 23:07:48 2015 +0000 +++ b/src/SSD1331.cpp Tue Nov 17 08:43:15 2015 +0000 @@ -129,6 +129,18 @@ } //------------------------------------------------------------------------------------ +void SSD1331::drawRect(uint8_t left_x, uint8_t top_y, uint8_t width, uint8_t height, uint16_t color) +{ + if (left_x >= RGB_OLED_WIDTH) left_x = RGB_OLED_XMAX; + if (top_y >= RGB_OLED_HEIGHT) top_y = RGB_OLED_YMAX; + + drawLine(left_x, top_y, left_x+width, top_y, color); // horizontal + drawLine(left_x, top_y, left_x, top_y+height, color); // vertical + drawLine(left_x, top_y+height, left_x+width, top_y+height, color); //horizontal + drawLine(left_x+width, top_y, left_x+width, top_y+height, color); // vertical +} + +//------------------------------------------------------------------------------------ void SSD1331::drawFrame(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1, uint16_t outColor, uint16_t fillColor) { if (x0 >= RGB_OLED_WIDTH) x0 = RGB_OLED_XMAX; @@ -194,6 +206,12 @@ } //------------------------------------------------------------------------------------ +void SSD1331::fillScreen(uint16_t color) +{ + drawFrame(0, 0, RGB_OLED_XMAX, RGB_OLED_YMAX, color, color); +} + +//------------------------------------------------------------------------------------ void SSD1331::setScolling(ScollingDirection direction, uint8_t rowAddr, uint8_t rowNum, uint8_t timeInterval) { uint8_t scolling_horizontal = 0x0;