Expand drawChar for larger offset
This commit is contained in:
@@ -117,15 +117,16 @@ void OLED::setFramebuffer(uint8_t *buffer) {
|
|||||||
* UTF font handling is done using the two input chars.
|
* UTF font handling is done using the two input chars.
|
||||||
* Precursor is the command char that is used to select the table.
|
* Precursor is the command char that is used to select the table.
|
||||||
*/
|
*/
|
||||||
void OLED::drawChar(char c) {
|
void OLED::drawChar(const uint16_t charCode) {
|
||||||
if (c == '\x01' && cursor_y == 0) { // 0x01 is used as new line char
|
if (charCode == '\x01' && cursor_y == 0) { // 0x01 is used as new line char
|
||||||
cursor_x = 0;
|
cursor_x = 0;
|
||||||
cursor_y = 8;
|
cursor_y = 8;
|
||||||
return;
|
return;
|
||||||
} else if (c == 0) {
|
} else if (charCode <=0x01) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
uint16_t index = static_cast<unsigned char>(c) - 2; // First index is \x02
|
// First index is \x02
|
||||||
|
uint16_t index = charCode-2;
|
||||||
uint8_t *charPointer;
|
uint8_t *charPointer;
|
||||||
charPointer = ((uint8_t *)currentFont) + ((fontWidth * (fontHeight / 8)) * index);
|
charPointer = ((uint8_t *)currentFont) + ((fontWidth * (fontHeight / 8)) * index);
|
||||||
drawArea(cursor_x, cursor_y, fontWidth, fontHeight, charPointer);
|
drawArea(cursor_x, cursor_y, fontWidth, fontHeight, charPointer);
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ public:
|
|||||||
static void useSecondaryFramebuffer(bool useSecondary);
|
static void useSecondaryFramebuffer(bool useSecondary);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void drawChar(char c); // Draw a character to a specific location
|
static void drawChar(const uint16_t charCode); // Draw a character to the current cursor location
|
||||||
static void setFramebuffer(uint8_t *buffer);
|
static void setFramebuffer(uint8_t *buffer);
|
||||||
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
|
||||||
static uint8_t * firstStripPtr; // Pointers to the strips to allow for buffer having extra content
|
static uint8_t * firstStripPtr; // Pointers to the strips to allow for buffer having extra content
|
||||||
|
|||||||
Reference in New Issue
Block a user