pax curve plotter
This commit is contained in:
parent
66af2b8c54
commit
be01760c32
@ -397,18 +397,15 @@ void oledfillRect(uint16_t x, uint16_t y, uint16_t width, uint16_t height,
|
|||||||
int oledDrawPixel(uint8_t *buf, const uint16_t x, const uint16_t y,
|
int oledDrawPixel(uint8_t *buf, const uint16_t x, const uint16_t y,
|
||||||
const uint8_t dot) {
|
const uint8_t dot) {
|
||||||
|
|
||||||
uint8_t page, bit;
|
|
||||||
|
|
||||||
if (x > DISPLAY_WIDTH || y > DISPLAY_HEIGHT)
|
if (x > DISPLAY_WIDTH || y > DISPLAY_HEIGHT)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
page = y / 8;
|
uint8_t bit = y & 7;
|
||||||
bit = y % 8;
|
uint16_t idx = y / 8 * DISPLAY_WIDTH + x;
|
||||||
|
|
||||||
|
buf[idx] &= ~(1 << bit); // clear pixel
|
||||||
if (dot)
|
if (dot)
|
||||||
buf[page * DISPLAY_WIDTH + x] |= (1 << bit); // mark
|
buf[idx] |= (1 << bit); // set pixel
|
||||||
else
|
|
||||||
buf[page * DISPLAY_WIDTH + x] &= ~(0 << bit); // clear
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user