forked from mirrors/qmk_userspace
OLED driver function to set pixels (#9713)
* Add a function to set individual pixels * Add documentation for oled_write_pixel * use smaller data type for oled_write_pixel * Fix boundary check edge case * Update oled_write_pixel doc Co-authored-by: Ryan <fauxpark@gmail.com> Co-authored-by: Ryan <fauxpark@gmail.com>
This commit is contained in:
parent
08b405e1e9
commit
92d0a71af7
3 changed files with 21 additions and 0 deletions
|
@ -462,6 +462,19 @@ void oled_write_raw(const char *data, uint16_t size) {
|
|||
}
|
||||
}
|
||||
|
||||
void oled_write_pixel(uint8_t x, uint8_t y, bool on) {
|
||||
if (x >= OLED_DISPLAY_WIDTH || y >= OLED_DISPLAY_HEIGHT) {
|
||||
return;
|
||||
}
|
||||
uint16_t index = x + (y / 8) * OLED_DISPLAY_WIDTH;
|
||||
if (on) {
|
||||
oled_buffer[index] |= (1 << (y % 8));
|
||||
} else {
|
||||
oled_buffer[index] &= ~(1 << (y % 8));
|
||||
}
|
||||
oled_dirty |= (1 << (index / OLED_BLOCK_SIZE));
|
||||
}
|
||||
|
||||
#if defined(__AVR__)
|
||||
void oled_write_P(const char *data, bool invert) {
|
||||
uint8_t c = pgm_read_byte(data);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue