Skip to content

Commit

Permalink
(OLED) Added support for CR (qmk#6399)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
XScorpion2 authored and drashna committed Jul 27, 2019
1 parent 48067c5 commit ec39545
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drivers/oled/oled_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit ec39545

Please sign in to comment.