aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/feature_oled_driver.md9
-rw-r--r--drivers/oled/oled_driver.c25
-rw-r--r--drivers/oled/oled_driver.h4
3 files changed, 38 insertions, 0 deletions
diff --git a/docs/feature_oled_driver.md b/docs/feature_oled_driver.md
index ebabc314f..f4e5db0f4 100644
--- a/docs/feature_oled_driver.md
+++ b/docs/feature_oled_driver.md
@@ -221,6 +221,12 @@ void oled_write(const char *data, bool invert);
221// Advances the cursor to the next page, wiring ' ' to the remainder of the current page 221// Advances the cursor to the next page, wiring ' ' to the remainder of the current page
222void oled_write_ln(const char *data, bool invert); 222void oled_write_ln(const char *data, bool invert);
223 223
224// Pans the buffer to the right (or left by passing true) by moving contents of the buffer
225// Useful for moving the screen in preparation for new drawing
226// oled_scroll_left or oled_scroll_right should be preferred for all cases of moving a static
227// image such as a logo or to avoid burn-in as it's much, much less cpu intensive
228void oled_pan(bool left);
229
224// Writes a PROGMEM string to the buffer at current cursor position 230// Writes a PROGMEM string to the buffer at current cursor position
225// Advances the cursor while writing, inverts the pixels if true 231// Advances the cursor while writing, inverts the pixels if true
226// Remapped to call 'void oled_write(const char *data, bool invert);' on ARM 232// Remapped to call 'void oled_write(const char *data, bool invert);' on ARM
@@ -235,6 +241,9 @@ void oled_write_ln_P(const char *data, bool invert);
235// Writes a string to the buffer at current cursor position 241// Writes a string to the buffer at current cursor position
236void oled_write_raw(const char *data, uint16_t size); 242void oled_write_raw(const char *data, uint16_t size);
237 243
244// Writes a single byte into the buffer at the specified index
245void oled_write_raw_byte(const char data, uint16_t index);
246
238// Writes a PROGMEM string to the buffer at current cursor position 247// Writes a PROGMEM string to the buffer at current cursor position
239void oled_write_raw_P(const char *data, uint16_t size); 248void oled_write_raw_P(const char *data, uint16_t size);
240 249
diff --git a/drivers/oled/oled_driver.c b/drivers/oled/oled_driver.c
index d03b2de3a..e2cdc2fb7 100644
--- a/drivers/oled/oled_driver.c
+++ b/drivers/oled/oled_driver.c
@@ -428,6 +428,31 @@ void oled_write_ln(const char *data, bool invert) {
428 oled_advance_page(true); 428 oled_advance_page(true);
429} 429}
430 430
431void oled_pan(bool left) {
432 uint16_t i = 0;
433 for (uint16_t y = 0; y < OLED_DISPLAY_HEIGHT/8; y++) {
434 if(left) {
435 for (uint16_t x = 0; x < OLED_DISPLAY_WIDTH - 1; x++) {
436 i = y * OLED_DISPLAY_WIDTH + x;
437 oled_buffer[i] = oled_buffer[i+1];
438 }
439 } else {
440 for (uint16_t x = OLED_DISPLAY_WIDTH -1; x > 0; x--) {
441 i = y * OLED_DISPLAY_WIDTH + x;
442 oled_buffer[i] = oled_buffer[i-1];
443 }
444 }
445 }
446 oled_dirty = ~((OLED_BLOCK_TYPE)0);
447}
448
449void oled_write_raw_byte(const char data, uint16_t index) {
450 if (index > OLED_MATRIX_SIZE) index = OLED_MATRIX_SIZE;
451 if (oled_buffer[index] == data) return;
452 oled_buffer[index] = data;
453 oled_dirty |= (1 << (index / OLED_BLOCK_SIZE));
454}
455
431void oled_write_raw(const char *data, uint16_t size) { 456void oled_write_raw(const char *data, uint16_t size) {
432 if (size > OLED_MATRIX_SIZE) size = OLED_MATRIX_SIZE; 457 if (size > OLED_MATRIX_SIZE) size = OLED_MATRIX_SIZE;
433 for (uint16_t i = 0; i < size; i++) { 458 for (uint16_t i = 0; i < size; i++) {
diff --git a/drivers/oled/oled_driver.h b/drivers/oled/oled_driver.h
index e8a718857..6d1cee9b7 100644
--- a/drivers/oled/oled_driver.h
+++ b/drivers/oled/oled_driver.h
@@ -200,7 +200,11 @@ void oled_write(const char *data, bool invert);
200// Advances the cursor to the next page, wiring ' ' to the remainder of the current page 200// Advances the cursor to the next page, wiring ' ' to the remainder of the current page
201void oled_write_ln(const char *data, bool invert); 201void oled_write_ln(const char *data, bool invert);
202 202
203// Pans the buffer to the right (or left by passing true) by moving contents of the buffer
204void oled_pan(bool left);
205
203void oled_write_raw(const char *data, uint16_t size); 206void oled_write_raw(const char *data, uint16_t size);
207void oled_write_raw_byte(const char data, uint16_t index);
204 208
205#if defined(__AVR__) 209#if defined(__AVR__)
206// Writes a PROGMEM string to the buffer at current cursor position 210// Writes a PROGMEM string to the buffer at current cursor position