diff options
| author | Richard <rich@brickbots.com> | 2020-08-24 07:40:45 -0700 |
|---|---|---|
| committer | James Young <18669334+noroadsleft@users.noreply.github.com> | 2020-08-29 14:30:02 -0700 |
| commit | fa6cf8572736f16d2fe076c21546d08f258e145f (patch) | |
| tree | 55809744c500176384f0550c9c2db629979a1d9f /drivers/oled/oled_driver.h | |
| parent | 92385b3fb617326b129609726020453c8949c7f8 (diff) | |
| download | qmk_firmware-fa6cf8572736f16d2fe076c21546d08f258e145f.tar.gz qmk_firmware-fa6cf8572736f16d2fe076c21546d08f258e145f.zip | |
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.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/oled/oled_driver.h b/drivers/oled/oled_driver.h index 5c21c0cc8..7ec00d66a 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/>. | |||
| 154 | # define OLED_I2C_TIMEOUT 100 | 154 | # define OLED_I2C_TIMEOUT 100 |
| 155 | #endif | 155 | #endif |
| 156 | 156 | ||
| 157 | typedef struct __attribute__((__packed__)) { | ||
| 158 | uint8_t *current_element; | ||
| 159 | uint16_t remaining_element_count; | ||
| 160 | } oled_buffer_reader_t; | ||
| 161 | |||
| 157 | // OLED Rotation enum values are flags | 162 | // OLED Rotation enum values are flags |
| 158 | typedef enum { | 163 | typedef enum { |
| 159 | OLED_ROTATION_0 = 0, | 164 | OLED_ROTATION_0 = 0, |
| @@ -207,6 +212,10 @@ void oled_write_ln(const char *data, bool invert); | |||
| 207 | // Pans the buffer to the right (or left by passing true) by moving contents of the buffer | 212 | // Pans the buffer to the right (or left by passing true) by moving contents of the buffer |
| 208 | void oled_pan(bool left); | 213 | void oled_pan(bool left); |
| 209 | 214 | ||
| 215 | // Returns a pointer to the requested start index in the buffer plus remaining | ||
| 216 | // buffer length as struct | ||
| 217 | oled_buffer_reader_t oled_read_raw(uint16_t start_index); | ||
| 218 | |||
| 210 | void oled_write_raw(const char *data, uint16_t size); | 219 | void oled_write_raw(const char *data, uint16_t size); |
| 211 | void oled_write_raw_byte(const char data, uint16_t index); | 220 | void oled_write_raw_byte(const char data, uint16_t index); |
| 212 | 221 | ||
