Adds raw write functions to the OLED driver (#7237)
* Added oled_write_raw and oled_write_raw_P functions to the OLED driver * Added oled_write_raw method calls to feature_oled_driver.mdmaster
parent
732d1dd4f6
commit
be6562a223
|
@ -229,6 +229,12 @@ void oled_write_P(const char *data, bool invert);
|
||||||
// Remapped to call 'void oled_write_ln(const char *data, bool invert);' on ARM
|
// Remapped to call 'void oled_write_ln(const char *data, bool invert);' on ARM
|
||||||
void oled_write_ln_P(const char *data, bool invert);
|
void oled_write_ln_P(const char *data, bool invert);
|
||||||
|
|
||||||
|
// Writes a string to the buffer at current cursor position
|
||||||
|
void oled_write_raw(const char *data, uint16_t size);
|
||||||
|
|
||||||
|
// 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
|
// Can be used to manually turn on the screen if it is off
|
||||||
// Returns true if the screen was on or turns on
|
// Returns true if the screen was on or turns on
|
||||||
bool oled_on(void);
|
bool oled_on(void);
|
||||||
|
|
|
@ -431,6 +431,15 @@ void oled_write_ln(const char *data, bool invert) {
|
||||||
oled_advance_page(true);
|
oled_advance_page(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void oled_write_raw(const char *data, uint16_t size) {
|
||||||
|
if (size > OLED_MATRIX_SIZE) size = OLED_MATRIX_SIZE;
|
||||||
|
for (uint16_t i = 0; i < size; i++) {
|
||||||
|
if (oled_buffer[i] == data[i]) continue;
|
||||||
|
oled_buffer[i] = data[i];
|
||||||
|
oled_dirty |= (1 << (i / OLED_BLOCK_SIZE));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(__AVR__)
|
#if defined(__AVR__)
|
||||||
void oled_write_P(const char *data, bool invert) {
|
void oled_write_P(const char *data, bool invert) {
|
||||||
uint8_t c = pgm_read_byte(data);
|
uint8_t c = pgm_read_byte(data);
|
||||||
|
@ -444,6 +453,16 @@ void oled_write_ln_P(const char *data, bool invert) {
|
||||||
oled_write_P(data, invert);
|
oled_write_P(data, invert);
|
||||||
oled_advance_page(true);
|
oled_advance_page(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void oled_write_raw_P(const char *data, uint16_t size) {
|
||||||
|
if (size > OLED_MATRIX_SIZE) size = OLED_MATRIX_SIZE;
|
||||||
|
for (uint16_t i = 0; i < size; i++) {
|
||||||
|
uint8_t c = pgm_read_byte(++data);
|
||||||
|
if (oled_buffer[i] == c) continue;
|
||||||
|
oled_buffer[i] = c;
|
||||||
|
oled_dirty |= (1 << (i / OLED_BLOCK_SIZE));
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif // defined(__AVR__)
|
#endif // defined(__AVR__)
|
||||||
|
|
||||||
bool oled_on(void) {
|
bool oled_on(void) {
|
||||||
|
@ -566,4 +585,4 @@ void oled_task(void) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
__attribute__((weak)) void oled_task_user(void) {}
|
__attribute__((weak)) void oled_task_user(void) {}
|
|
@ -200,6 +200,8 @@ void oled_write(const char *data, bool invert);
|
||||||
// Advances the cursor to the next page, wiring ' ' to the remainder of the current page
|
// Advances the cursor to the next page, wiring ' ' to the remainder of the current page
|
||||||
void oled_write_ln(const char *data, bool invert);
|
void oled_write_ln(const char *data, bool invert);
|
||||||
|
|
||||||
|
void oled_write_raw(const char *data, uint16_t size);
|
||||||
|
|
||||||
#if defined(__AVR__)
|
#if defined(__AVR__)
|
||||||
// Writes a PROGMEM string to the buffer at current cursor position
|
// Writes a PROGMEM string to the buffer at current cursor position
|
||||||
// Advances the cursor while writing, inverts the pixels if true
|
// Advances the cursor while writing, inverts the pixels if true
|
||||||
|
@ -211,6 +213,8 @@ void oled_write_P(const char *data, bool invert);
|
||||||
// Advances the cursor to the next page, wiring ' ' to the remainder of the current page
|
// 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
|
// Remapped to call 'void oled_write_ln(const char *data, bool invert);' on ARM
|
||||||
void oled_write_ln_P(const char *data, bool invert);
|
void oled_write_ln_P(const char *data, bool invert);
|
||||||
|
|
||||||
|
void oled_write_raw_P(const char *data, uint16_t size);
|
||||||
#else
|
#else
|
||||||
// Writes a string to the buffer at current cursor position
|
// Writes a string to the buffer at current cursor position
|
||||||
// Advances the cursor while writing, inverts the pixels if true
|
// Advances the cursor while writing, inverts the pixels if true
|
||||||
|
@ -254,4 +258,4 @@ bool oled_scroll_off(void);
|
||||||
uint8_t oled_max_chars(void);
|
uint8_t oled_max_chars(void);
|
||||||
|
|
||||||
// Returns the maximum number of lines that will fit on the oled
|
// Returns the maximum number of lines that will fit on the oled
|
||||||
uint8_t oled_max_lines(void);
|
uint8_t oled_max_lines(void);
|
Loading…
Reference in New Issue