summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan <fauxpark@gmail.com>2021-06-17 17:14:23 +1000
committerGitHub <noreply@github.com>2021-06-17 17:14:23 +1000
commit2f08a343948c6db3c67505f8fca5fdbfed41831b (patch)
tree5d62c1a5229107ce9a20a230375f508905564629
parenta9c6adb083556ae485dbf1e9f86ad615e32a8b7a (diff)
OLED driver tweaks (#13215)
-rw-r--r--docs/feature_oled_driver.md30
-rw-r--r--drivers/oled/oled_driver.c4
-rw-r--r--drivers/oled/oled_driver.h12
3 files changed, 22 insertions, 24 deletions
diff --git a/docs/feature_oled_driver.md b/docs/feature_oled_driver.md
index d2dc6103a6..f3b659b1bc 100644
--- a/docs/feature_oled_driver.md
+++ b/docs/feature_oled_driver.md
@@ -263,22 +263,11 @@ void oled_write(const char *data, bool invert);
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
-// Useful for moving the screen in preparation for new drawing
+// Useful for moving the screen in preparation for new drawing
// oled_scroll_left or oled_scroll_right should be preferred for all cases of moving a static
// image such as a logo or to avoid burn-in as it's much, much less cpu intensive
void oled_pan(bool left);
-// Writes a PROGMEM string to the buffer at current cursor position
-// Advances the cursor while writing, inverts the pixels if true
-// Remapped to call 'void oled_write(const char *data, bool invert);' on ARM
-void oled_write_P(const char *data, bool invert);
-
-// Writes a PROGMEM string to the buffer at current cursor position
-// Advances the cursor while writing, inverts the pixels if true
-// Advances the cursor to the next page, wiring ' ' to the remainder of the current page
-// Remapped to call 'void oled_write_ln(const char *data, bool invert);' on ARM
-void oled_write_ln_P(const char *data, bool invert);
-
// 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);
@@ -289,13 +278,24 @@ void oled_write_raw(const char *data, uint16_t size);
// Writes a single byte into the buffer at the specified index
void oled_write_raw_byte(const char data, uint16_t index);
-// Writes a PROGMEM string to the buffer at current cursor position
-void oled_write_raw_P(const char *data, uint16_t size);
-
// Sets a specific pixel on or off
// Coordinates start at top-left and go right and down for positive x and y
void oled_write_pixel(uint8_t x, uint8_t y, bool on);
+// Writes a PROGMEM string to the buffer at current cursor position
+// Advances the cursor while writing, inverts the pixels if true
+// Remapped to call 'void oled_write(const char *data, bool invert);' on ARM
+void oled_write_P(const char *data, bool invert);
+
+// Writes a PROGMEM string to the buffer at current cursor position
+// Advances the cursor while writing, inverts the pixels if true
+// Advances the cursor to the next page, wiring ' ' to the remainder of the current page
+// Remapped to call 'void oled_write_ln(const char *data, bool invert);' on ARM
+void oled_write_ln_P(const char *data, bool invert);
+
+// Writes a PROGMEM string to the buffer at current cursor position
+void oled_write_raw_P(const char *data, uint16_t size);
+
// Can be used to manually turn on the screen if it is off
// Returns true if the screen was on or turns on
bool oled_on(void);
diff --git a/drivers/oled/oled_driver.c b/drivers/oled/oled_driver.c
index 53bdc196dc..8e5ed5f070 100644
--- a/drivers/oled/oled_driver.c
+++ b/drivers/oled/oled_driver.c
@@ -115,7 +115,7 @@ bool oled_initialized = false;
bool oled_active = false;
bool oled_scrolling = false;
uint8_t oled_brightness = OLED_BRIGHTNESS;
-uint8_t oled_rotation = 0;
+oled_rotation_t oled_rotation = 0;
uint8_t oled_rotation_width = 0;
uint8_t oled_scroll_speed = 0; // this holds the speed after being remapped to ssd1306 internal values
uint8_t oled_scroll_start = 0;
@@ -158,7 +158,7 @@ static void InvertCharacter(uint8_t *cursor) {
}
}
-bool oled_init(uint8_t rotation) {
+bool oled_init(oled_rotation_t rotation) {
#if defined(USE_I2C) && defined(SPLIT_KEYBOARD)
if (!is_keyboard_master()) {
return true;
diff --git a/drivers/oled/oled_driver.h b/drivers/oled/oled_driver.h
index cbf5380ee0..a6b85f37e6 100644
--- a/drivers/oled/oled_driver.h
+++ b/drivers/oled/oled_driver.h
@@ -226,13 +226,17 @@ void oled_write(const char *data, bool invert);
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
+// Useful for moving the screen in preparation for new drawing
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);
+// Writes a string to the buffer at current cursor position
void oled_write_raw(const char *data, uint16_t size);
+
+// Writes a single byte into the buffer at the specified index
void oled_write_raw_byte(const char data, uint16_t index);
// Sets a specific pixel on or off
@@ -251,17 +255,11 @@ void oled_write_P(const char *data, bool invert);
// Remapped to call 'void oled_write_ln(const char *data, bool invert);' on ARM
void oled_write_ln_P(const char *data, bool invert);
+// Writes a PROGMEM string to the buffer at current cursor position
void oled_write_raw_P(const char *data, uint16_t size);
#else
-// Writes a string to the buffer at current cursor position
-// Advances the cursor while writing, inverts the pixels if true
# define oled_write_P(data, invert) oled_write(data, invert)
-
-// Writes a string to the buffer at current cursor position
-// Advances the cursor while writing, inverts the pixels if true
-// Advances the cursor to the next page, wiring ' ' to the remainder of the current page
# define oled_write_ln_P(data, invert) oled_write(data, invert)
-
# define oled_write_raw_P(data, size) oled_write_raw(data, size)
#endif // defined(__AVR__)