diff options
Diffstat (limited to 'users/drashna/oled/sh110x.c')
-rw-r--r-- | users/drashna/oled/sh110x.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/users/drashna/oled/sh110x.c b/users/drashna/oled/sh110x.c index cfdae1db16..aa081ca732 100644 --- a/users/drashna/oled/sh110x.c +++ b/users/drashna/oled/sh110x.c @@ -521,6 +521,25 @@ void oled_pan(bool left) { oled_dirty = OLED_ALL_BLOCKS_MASK; } +void oled_pan_section(bool left, uint16_t y_start, uint16_t y_end, uint16_t x_start, uint16_t x_end) { + uint16_t i = 0; + for (uint16_t y = y_start; y < y_end; y++) { + if (left) { + for (uint16_t x = x_start; x < x_end - 1; x++) { + i = y * OLED_DISPLAY_WIDTH + x; + oled_buffer[i] = oled_buffer[i + 1]; + oled_dirty |= ((OLED_BLOCK_TYPE)1 << (i / OLED_BLOCK_SIZE)); + } + } else { + for (uint16_t x = x_end - 1; x > 0; x--) { + i = y * OLED_DISPLAY_WIDTH + x; + oled_buffer[i] = oled_buffer[i - 1]; + oled_dirty |= ((OLED_BLOCK_TYPE)1 << (i / OLED_BLOCK_SIZE)); + } + } + } +} + oled_buffer_reader_t oled_read_raw(uint16_t start_index) { if (start_index > OLED_MATRIX_SIZE) start_index = OLED_MATRIX_SIZE; oled_buffer_reader_t ret_reader; |