Add method to draw a scrolling indicator
This commit is contained in:
@@ -99,6 +99,7 @@ public:
|
|||||||
static void drawFilledRect(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1,
|
static void drawFilledRect(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1,
|
||||||
bool clear);
|
bool clear);
|
||||||
static void drawHeatSymbol(uint8_t state);
|
static void drawHeatSymbol(uint8_t state);
|
||||||
|
static void drawScrollIndicator(uint8_t p, uint8_t h); // Draws a scrolling position indicator
|
||||||
private:
|
private:
|
||||||
static void drawChar(char c); // Draw a character to a specific location
|
static void drawChar(char c); // Draw a character to a specific location
|
||||||
static const uint8_t* currentFont;// Pointer to the current font used for rendering to the buffer
|
static const uint8_t* currentFont;// Pointer to the current font used for rendering to the buffer
|
||||||
|
|||||||
@@ -106,6 +106,25 @@ void OLED::drawChar(char c) {
|
|||||||
cursor_x += fontWidth;
|
cursor_x += fontWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Draws a one pixel wide scrolling indicator. y is the upper vertical position
|
||||||
|
* of the indicator in pixels (0..<16).
|
||||||
|
*/
|
||||||
|
void OLED::drawScrollIndicator(uint8_t y, uint8_t height) {
|
||||||
|
union u_type {
|
||||||
|
uint16_t whole;
|
||||||
|
uint8_t strips[2];
|
||||||
|
} column;
|
||||||
|
|
||||||
|
column.whole = (1 << height) - 1;
|
||||||
|
column.whole <<= y;
|
||||||
|
|
||||||
|
// Draw a one pixel wide bar to the left with a single pixel as
|
||||||
|
// the scroll indicator.
|
||||||
|
fillArea(OLED_WIDTH - 1, 0, 1, 8, column.strips[0]);
|
||||||
|
fillArea(OLED_WIDTH - 1, 8, 1, 8, column.strips[1]);
|
||||||
|
}
|
||||||
|
|
||||||
void OLED::setRotation(bool leftHanded) {
|
void OLED::setRotation(bool leftHanded) {
|
||||||
#ifdef MODEL_TS80
|
#ifdef MODEL_TS80
|
||||||
leftHanded = !leftHanded;
|
leftHanded = !leftHanded;
|
||||||
|
|||||||
Reference in New Issue
Block a user