summaryrefslogtreecommitdiff
path: root/drivers/oled/oled_driver.h
diff options
context:
space:
mode:
authorRichard <rich@brickbots.com>2020-08-24 07:40:45 -0700
committerDrashna Jael're <drashna@live.com>2020-09-30 03:40:41 -0700
commita9087f8a17ddb4e0d06f940e9598852e8033328d (patch)
tree2a76b87f9bb66700f98ab854439a11d8519ea8e9 /drivers/oled/oled_driver.h
parentf454a7be21bd501d7ee90bc0aa7c42bdc549ccd3 (diff)
Add a method to read the OLED display buffer from user space (#8777)
* Adding extern and declaration * Change to mediated buffer read * Adding raw byte read * Restore write raw... D'Oh * Working struct return * Pack that struct * Remove conditional packing and add example to docs * Cleanup tab/spaces * Update docs/feature_oled_driver.md Prettify formatting * Update drivers/oled/oled_driver.h Prettify formatting
Diffstat (limited to 'drivers/oled/oled_driver.h')
-rw-r--r--drivers/oled/oled_driver.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/oled/oled_driver.h b/drivers/oled/oled_driver.h
index 4e69f8845c..a03a3c9cff 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);