aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorXScorpion2 <rcalt2vt@gmail.com>2019-07-27 15:17:18 -0500
committerDrashna Jaelre <drashna@live.com>2019-07-27 13:17:18 -0700
commitec3954577cb080b3ea44f912a91b3c6e90e00c23 (patch)
tree17e1b633d5ab9d63690f8356fe625e553bd07061 /drivers
parent48067c530ce21ef7ffa7a97e65cf3fdc45d946a6 (diff)
downloadqmk_firmware-ec3954577cb080b3ea44f912a91b3c6e90e00c23.tar.gz
qmk_firmware-ec3954577cb080b3ea44f912a91b3c6e90e00c23.zip
(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 a54f5fadc..2b3dd7ff2 100644
--- a/drivers/oled/oled_driver.c
+++ b/drivers/oled/oled_driver.c
@@ -321,7 +321,7 @@ void oled_render(void) {
321 321
322 // Send render data chunk after rotating 322 // Send render data chunk after rotating
323 if (I2C_WRITE_REG(I2C_DATA, &temp_buffer[0], OLED_BLOCK_SIZE) != I2C_STATUS_SUCCESS) { 323 if (I2C_WRITE_REG(I2C_DATA, &temp_buffer[0], OLED_BLOCK_SIZE) != I2C_STATUS_SUCCESS) {
324 print("oled_render data failed\n"); 324 print("oled_render90 data failed\n");
325 return; 325 return;
326 } 326 }
327 } 327 }
@@ -393,6 +393,11 @@ void oled_write_char(const char data, bool invert) {
393 return; 393 return;
394 } 394 }
395 395
396 if (data == '\r') {
397 oled_advance_page(false);
398 return;
399 }
400
396 // copy the current render buffer to check for dirty after 401 // copy the current render buffer to check for dirty after
397 static uint8_t oled_temp_buffer[OLED_FONT_WIDTH]; 402 static uint8_t oled_temp_buffer[OLED_FONT_WIDTH];
398 memcpy(&oled_temp_buffer, oled_cursor, OLED_FONT_WIDTH); 403 memcpy(&oled_temp_buffer, oled_cursor, OLED_FONT_WIDTH);