summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorXScorpion2 <rcalt2vt@gmail.com>2019-07-27 15:17:18 -0500
committerFlorian Didron <fdidron@users.noreply.github.com>2019-08-13 10:44:55 +0900
commit986a0f068f675e4e481ccaf06c0a515bcdfd1146 (patch)
treec96608a43decd337c454aafc9a5816576b568906 /drivers
parent2823be1b2fb05c860e119ee12dc0222b0fa14cf5 (diff)
(OLED) Added support for CR (#6399)
Currently OLED Dirver only supports LF (\n) character in a string to clear out the rest of the current line and advance to the next line for writing. This PR adds support for CR (\r) character as well to advance to the next line, however not clear out the rest of the current line. This is extremely useful when you want to display a multi-line logo using a single array without wiping out exiting lines and flagging the OLED as dirty unnecessarily.
Diffstat (limited to 'drivers')
-rw-r--r--drivers/oled/oled_driver.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/oled/oled_driver.c b/drivers/oled/oled_driver.c
index ce4ab80a66..2d049963e6 100644
--- a/drivers/oled/oled_driver.c
+++ b/drivers/oled/oled_driver.c
@@ -321,7 +321,7 @@ void oled_render(void) {
// Send render data chunk after rotating
if (I2C_WRITE_REG(I2C_DATA, &temp_buffer[0], OLED_BLOCK_SIZE) != I2C_STATUS_SUCCESS) {
- print("oled_render data failed\n");
+ print("oled_render90 data failed\n");
return;
}
}
@@ -393,6 +393,11 @@ void oled_write_char(const char data, bool invert) {
return;
}
+ if (data == '\r') {
+ oled_advance_page(false);
+ return;
+ }
+
// copy the current render buffer to check for dirty after
static uint8_t oled_temp_buffer[OLED_FONT_WIDTH];
memcpy(&oled_temp_buffer, oled_cursor, OLED_FONT_WIDTH);