kopia lustrzana https://github.com/devbis/st7789_mpy
Fix set_window() boundaries
rodzic
81132e0d1b
commit
73530516df
|
@ -92,10 +92,10 @@ STATIC void write_cmd(st7789_ST7789_obj_t *self, uint8_t cmd, const uint8_t *dat
|
||||||
}
|
}
|
||||||
|
|
||||||
STATIC void set_window(st7789_ST7789_obj_t *self, uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1) {
|
STATIC void set_window(st7789_ST7789_obj_t *self, uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1) {
|
||||||
if (x0 > x1 || x1 > self->width) {
|
if (x0 > x1 || x1 >= self->width) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (y0 > y1 || y1 > self->height) {
|
if (y0 > y1 || y1 >= self->height) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
uint8_t bufx[4] = {x0 >> 8, x0 & 0xFF, x1 >> 8, x1 & 0xFF};
|
uint8_t bufx[4] = {x0 >> 8, x0 & 0xFF, x1 >> 8, x1 & 0xFF};
|
||||||
|
@ -260,7 +260,7 @@ STATIC mp_obj_t st7789_ST7789_fill(mp_obj_t self_in, mp_obj_t _color) {
|
||||||
st7789_ST7789_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
st7789_ST7789_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||||
mp_int_t color = mp_obj_get_int(_color);
|
mp_int_t color = mp_obj_get_int(_color);
|
||||||
|
|
||||||
set_window(self, 0, 0, self->width, self->height);
|
set_window(self, 0, 0, self->width - 1, self->height - 1);
|
||||||
DC_HIGH();
|
DC_HIGH();
|
||||||
CS_LOW();
|
CS_LOW();
|
||||||
fill_color_buffer(self->spi_obj, color, self->width * self->height);
|
fill_color_buffer(self->spi_obj, color, self->width * self->height);
|
||||||
|
|
Ładowanie…
Reference in New Issue