mirror of
https://github.com/qmk/qmk_firmware.git
synced 2025-04-08 06:45:41 +00:00
Merge branch 'features/oled_raw_api' of https://github.com/XScorpion2/qmk_firmware into kyria
This commit is contained in:
commit
5dfc517b88
@ -431,6 +431,18 @@ void oled_write_ln(const char *data, bool invert) {
|
||||
oled_advance_page(true);
|
||||
}
|
||||
|
||||
void oled_write_raw(const char *data, uint16_t size) {
|
||||
uint16_t remaining = OLED_MATRIX_SIZE - (oled_cursor - &oled_buffer[0]);
|
||||
size = size > remaining ? remaining : size;
|
||||
for (uint16_t i = 0; i < size; i++) {
|
||||
if (*oled_cursor == *data) continue;
|
||||
*oled_cursor = *data;
|
||||
oled_dirty |= (1 << ((oled_cursor - &oled_buffer[0]) / OLED_BLOCK_SIZE));
|
||||
oled_cursor++;
|
||||
data++;
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(__AVR__)
|
||||
void oled_write_P(const char *data, bool invert) {
|
||||
uint8_t c = pgm_read_byte(data);
|
||||
@ -444,6 +456,19 @@ void oled_write_ln_P(const char *data, bool invert) {
|
||||
oled_write_P(data, invert);
|
||||
oled_advance_page(true);
|
||||
}
|
||||
|
||||
void oled_write_raw_P(const char *data, uint16_t size) {
|
||||
uint16_t remaining = OLED_MATRIX_SIZE - (oled_cursor - &oled_buffer[0]);
|
||||
size = size > remaining ? remaining : size;
|
||||
for (uint16_t i = 0; i < size; i++) {
|
||||
uint8_t c = pgm_read_byte(data);
|
||||
if (*oled_cursor == c) continue;
|
||||
*oled_cursor = c;
|
||||
oled_dirty |= (1 << ((oled_cursor - &oled_buffer[0]) / OLED_BLOCK_SIZE));
|
||||
oled_cursor++;
|
||||
data++;
|
||||
}
|
||||
}
|
||||
#endif // defined(__AVR__)
|
||||
|
||||
bool oled_on(void) {
|
||||
|
@ -200,6 +200,8 @@ void oled_write(const char *data, bool invert);
|
||||
// Advances the cursor to the next page, wiring ' ' to the remainder of the current page
|
||||
void oled_write_ln(const char *data, bool invert);
|
||||
|
||||
void oled_write_raw(const char *data, uint16_t size);
|
||||
|
||||
#if defined(__AVR__)
|
||||
// Writes a PROGMEM string to the buffer at current cursor position
|
||||
// Advances the cursor while writing, inverts the pixels if true
|
||||
@ -211,6 +213,8 @@ void oled_write_P(const char *data, bool invert);
|
||||
// Advances the cursor to the next page, wiring ' ' to the remainder of the current page
|
||||
// Remapped to call 'void oled_write_ln(const char *data, bool invert);' on ARM
|
||||
void oled_write_ln_P(const char *data, bool invert);
|
||||
|
||||
void oled_write_raw_P(const char *data, uint16_t size);
|
||||
#else
|
||||
// Writes a string to the buffer at current cursor position
|
||||
// Advances the cursor while writing, inverts the pixels if true
|
||||
|
Loading…
Reference in New Issue
Block a user