update for new gfx lib
This commit is contained in:
14
st7920.c
14
st7920.c
@@ -104,7 +104,10 @@ esp_err_t st7920_init(const st7920_config_t *config, st7920_device_t *device) {
|
|||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_err_t st7920_clear(st7920_device_t *dev) {
|
|
||||||
|
|
||||||
|
esp_err_t st7920_clear(void *p) {
|
||||||
|
st7920_device_t* dev = (st7920_device_t*)p;
|
||||||
memset(dev->framebuffer, 0, sizeof(dev->framebuffer));
|
memset(dev->framebuffer, 0, sizeof(dev->framebuffer));
|
||||||
|
|
||||||
// Clear display RAM
|
// Clear display RAM
|
||||||
@@ -120,7 +123,8 @@ esp_err_t st7920_set_backlight(const st7920_device_t *dev, const bool backlight)
|
|||||||
return gpio_set_level(dev->pin_bl, backlight);
|
return gpio_set_level(dev->pin_bl, backlight);
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_err_t st7920_update_screen(const st7920_device_t *dev) {
|
esp_err_t st7920_update_screen(const void *p) {
|
||||||
|
const st7920_device_t* dev = (st7920_device_t*)p;
|
||||||
// ST7920 is actually two 128x32 disps, we send row by row to each of them
|
// ST7920 is actually two 128x32 disps, we send row by row to each of them
|
||||||
for (uint8_t y = 0; y < 64; y++) {
|
for (uint8_t y = 0; y < 64; y++) {
|
||||||
const bool upper_half = y < 32;
|
const bool upper_half = y < 32;
|
||||||
@@ -147,10 +151,12 @@ static void st7920_set_pixel_color(st7920_device_t *dev, const uint8_t x, const
|
|||||||
dev->framebuffer[byte_index] &= ~(1 << bit_index);
|
dev->framebuffer[byte_index] &= ~(1 << bit_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void st7920_draw_pixel(void *dev, const uint8_t x, const uint8_t y) {
|
esp_err_t st7920_draw_pixel(void *dev, const uint8_t x, const uint8_t y) {
|
||||||
st7920_set_pixel_color(dev, x, y, 1);
|
st7920_set_pixel_color(dev, x, y, 1);
|
||||||
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void st7920_clear_pixel(void *dev, const uint8_t x, const uint8_t y) {
|
esp_err_t st7920_clear_pixel(void *dev, const uint8_t x, const uint8_t y) {
|
||||||
st7920_set_pixel_color(dev, x, y, 0);
|
st7920_set_pixel_color(dev, x, y, 0);
|
||||||
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user