aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorfauxpark <fauxpark@gmail.com>2021-06-17 17:22:01 +1000
committerfauxpark <fauxpark@gmail.com>2021-06-17 17:22:01 +1000
commitd04f7bc1608d3acbf1008ae5fd7bf51ddb860ba2 (patch)
tree2f80fbe3f516acdf50050579b87a23beb9091680 /drivers
parent9956ff4e031b33c5e1fe1ff6ee44885f1080d966 (diff)
parent2f08a343948c6db3c67505f8fca5fdbfed41831b (diff)
downloadqmk_firmware-d04f7bc1608d3acbf1008ae5fd7bf51ddb860ba2.tar.gz
qmk_firmware-d04f7bc1608d3acbf1008ae5fd7bf51ddb860ba2.zip
Merge remote-tracking branch 'upstream/master' into develop
Diffstat (limited to 'drivers')
-rw-r--r--drivers/oled/oled_driver.c9
-rw-r--r--drivers/oled/oled_driver.h12
2 files changed, 10 insertions, 11 deletions
diff --git a/drivers/oled/oled_driver.c b/drivers/oled/oled_driver.c
index 082115d53..8e5ed5f07 100644
--- a/drivers/oled/oled_driver.c
+++ b/drivers/oled/oled_driver.c
@@ -115,7 +115,7 @@ bool oled_initialized = false;
115bool oled_active = false; 115bool oled_active = false;
116bool oled_scrolling = false; 116bool oled_scrolling = false;
117uint8_t oled_brightness = OLED_BRIGHTNESS; 117uint8_t oled_brightness = OLED_BRIGHTNESS;
118uint8_t oled_rotation = 0; 118oled_rotation_t oled_rotation = 0;
119uint8_t oled_rotation_width = 0; 119uint8_t oled_rotation_width = 0;
120uint8_t oled_scroll_speed = 0; // this holds the speed after being remapped to ssd1306 internal values 120uint8_t oled_scroll_speed = 0; // this holds the speed after being remapped to ssd1306 internal values
121uint8_t oled_scroll_start = 0; 121uint8_t oled_scroll_start = 0;
@@ -158,7 +158,7 @@ static void InvertCharacter(uint8_t *cursor) {
158 } 158 }
159} 159}
160 160
161bool oled_init(uint8_t rotation) { 161bool oled_init(oled_rotation_t rotation) {
162#if defined(USE_I2C) && defined(SPLIT_KEYBOARD) 162#if defined(USE_I2C) && defined(SPLIT_KEYBOARD)
163 if (!is_keyboard_master()) { 163 if (!is_keyboard_master()) {
164 return true; 164 return true;
@@ -491,8 +491,9 @@ void oled_write_raw(const char *data, uint16_t size) {
491 uint16_t cursor_start_index = oled_cursor - &oled_buffer[0]; 491 uint16_t cursor_start_index = oled_cursor - &oled_buffer[0];
492 if ((size + cursor_start_index) > OLED_MATRIX_SIZE) size = OLED_MATRIX_SIZE - cursor_start_index; 492 if ((size + cursor_start_index) > OLED_MATRIX_SIZE) size = OLED_MATRIX_SIZE - cursor_start_index;
493 for (uint16_t i = cursor_start_index; i < cursor_start_index + size; i++) { 493 for (uint16_t i = cursor_start_index; i < cursor_start_index + size; i++) {
494 if (oled_buffer[i] == data[i]) continue; 494 uint8_t c = *data++;
495 oled_buffer[i] = data[i]; 495 if (oled_buffer[i] == c) continue;
496 oled_buffer[i] = c;
496 oled_dirty |= ((OLED_BLOCK_TYPE)1 << (i / OLED_BLOCK_SIZE)); 497 oled_dirty |= ((OLED_BLOCK_TYPE)1 << (i / OLED_BLOCK_SIZE));
497 } 498 }
498} 499}
diff --git a/drivers/oled/oled_driver.h b/drivers/oled/oled_driver.h
index cbf5380ee..a6b85f37e 100644
--- a/drivers/oled/oled_driver.h
+++ b/drivers/oled/oled_driver.h
@@ -226,13 +226,17 @@ void oled_write(const char *data, bool invert);
226void oled_write_ln(const char *data, bool invert); 226void oled_write_ln(const char *data, bool invert);
227 227
228// Pans the buffer to the right (or left by passing true) by moving contents of the buffer 228// Pans the buffer to the right (or left by passing true) by moving contents of the buffer
229// Useful for moving the screen in preparation for new drawing
229void oled_pan(bool left); 230void oled_pan(bool left);
230 231
231// Returns a pointer to the requested start index in the buffer plus remaining 232// Returns a pointer to the requested start index in the buffer plus remaining
232// buffer length as struct 233// buffer length as struct
233oled_buffer_reader_t oled_read_raw(uint16_t start_index); 234oled_buffer_reader_t oled_read_raw(uint16_t start_index);
234 235
236// Writes a string to the buffer at current cursor position
235void oled_write_raw(const char *data, uint16_t size); 237void oled_write_raw(const char *data, uint16_t size);
238
239// Writes a single byte into the buffer at the specified index
236void oled_write_raw_byte(const char data, uint16_t index); 240void oled_write_raw_byte(const char data, uint16_t index);
237 241
238// Sets a specific pixel on or off 242// Sets a specific pixel on or off
@@ -251,17 +255,11 @@ void oled_write_P(const char *data, bool invert);
251// Remapped to call 'void oled_write_ln(const char *data, bool invert);' on ARM 255// Remapped to call 'void oled_write_ln(const char *data, bool invert);' on ARM
252void oled_write_ln_P(const char *data, bool invert); 256void oled_write_ln_P(const char *data, bool invert);
253 257
258// Writes a PROGMEM string to the buffer at current cursor position
254void oled_write_raw_P(const char *data, uint16_t size); 259void oled_write_raw_P(const char *data, uint16_t size);
255#else 260#else
256// Writes a string to the buffer at current cursor position
257// Advances the cursor while writing, inverts the pixels if true
258# define oled_write_P(data, invert) oled_write(data, invert) 261# define oled_write_P(data, invert) oled_write(data, invert)
259
260// Writes a string to the buffer at current cursor position
261// Advances the cursor while writing, inverts the pixels if true
262// Advances the cursor to the next page, wiring ' ' to the remainder of the current page
263# define oled_write_ln_P(data, invert) oled_write(data, invert) 262# define oled_write_ln_P(data, invert) oled_write(data, invert)
264
265# define oled_write_raw_P(data, size) oled_write_raw(data, size) 263# define oled_write_raw_P(data, size) oled_write_raw(data, size)
266#endif // defined(__AVR__) 264#endif // defined(__AVR__)
267 265