summaryrefslogtreecommitdiffstats
path: root/drivers/oled
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/oled')
-rw-r--r--drivers/oled/oled_driver.c8
-rw-r--r--drivers/oled/oled_driver.h9
2 files changed, 17 insertions, 0 deletions
diff --git a/drivers/oled/oled_driver.c b/drivers/oled/oled_driver.c
index f1990567f7..bbf010a090 100644
--- a/drivers/oled/oled_driver.c
+++ b/drivers/oled/oled_driver.c
@@ -444,6 +444,14 @@ void oled_pan(bool left) {
oled_dirty = ~((OLED_BLOCK_TYPE)0);
}
+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;
+ ret_reader.current_element = &oled_buffer[start_index];
+ ret_reader.remaining_element_count = OLED_MATRIX_SIZE - start_index;
+ return ret_reader;
+}
+
void oled_write_raw_byte(const char data, uint16_t index) {
if (index > OLED_MATRIX_SIZE) index = OLED_MATRIX_SIZE;
if (oled_buffer[index] == data) return;
diff --git a/drivers/oled/oled_driver.h b/drivers/oled/oled_driver.h
index 5c21c0cc8e..7ec00d66a3 100644
--- a/drivers/oled/oled_driver.h
+++ b/drivers/oled/oled_driver.h
@@ -154,6 +154,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
# define OLED_I2C_TIMEOUT 100
#endif
+typedef struct __attribute__((__packed__)) {
+ uint8_t *current_element;
+ uint16_t remaining_element_count;
+} oled_buffer_reader_t;
+
// OLED Rotation enum values are flags
typedef enum {
OLED_ROTATION_0 = 0,
@@ -207,6 +212,10 @@ void oled_write_ln(const char *data, bool invert);
// Pans the buffer to the right (or left by passing true) by moving contents of the buffer
void oled_pan(bool left);
+// Returns a pointer to the requested start index in the buffer plus remaining
+// buffer length as struct
+oled_buffer_reader_t oled_read_raw(uint16_t start_index);
+
void oled_write_raw(const char *data, uint16_t size);
void oled_write_raw_byte(const char data, uint16_t index);