FIX screen corruption #213

This commit is contained in:
Joaquim
2021-03-18 19:38:19 +00:00
parent ada9425357
commit dba7e47ac0
4 changed files with 40 additions and 80 deletions

View File

@@ -153,16 +153,9 @@ void St7789::DrawPixel(uint16_t x, uint16_t y, uint32_t color) {
WriteSpi(reinterpret_cast<const uint8_t *>(&color), 2);
}
void St7789::BeginDrawBuffer(uint16_t x, uint16_t y, uint16_t width, uint16_t height) {
if((x >= Width) || (y >= Height)) return;
if((x + width - 1) >= Width) width = Width - x;
if((y + height - 1) >= Height) height = Height - y;
SetAddrWindow(0+x, ST7789_ROW_OFFSET+y, x+width-1, y+height-1);
void St7789::DrawBuffer(uint16_t x, uint16_t y, uint16_t width, uint16_t height, const uint8_t *data, size_t size) {
SetAddrWindow(x, y, x + width - 1, y + height - 1);
nrf_gpio_pin_set(pinDataCommand);
}
void St7789::NextDrawBuffer(const uint8_t *data, size_t size) {
WriteSpi(data, size);
}