diff --git a/README.md b/README.md index 120a8e2..ddd77c8 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,9 @@ const gfx_canvas_t canvas = { .ctx = &dev, .draw_pixel_callback = st7567_draw_pixel, .clear_pixel_callback = st7567_clear_pixel, + .clear_disp_callback = st7567_clear, + .clear_fb_callback = st7567_clear_buffer, + .flush_callback = st7567_update_screen }; const GFXfont *font = &NokiaBig; diff --git a/esp-gfx/gfx.c b/esp-gfx/gfx.c index 56bc23d..92b5559 100644 --- a/esp-gfx/gfx.c +++ b/esp-gfx/gfx.c @@ -113,4 +113,16 @@ void gfx_draw_bitmap(const gfx_canvas_t *canvas, const uint8_t pos_x, const uint } } } +} + +void gfx_flush(const gfx_canvas_t *canvas) { + canvas->flush_callback(canvas->ctx); +} + +void gfx_clear_disp(const gfx_canvas_t *canvas) { + canvas->clear_disp_callback(canvas->ctx); +} + +void gfx_clear_fb(const gfx_canvas_t *canvas) { + canvas->clear_fb_callback(canvas->ctx); } \ No newline at end of file diff --git a/esp-gfx/gfx.h b/esp-gfx/gfx.h index f063c03..09b022c 100644 --- a/esp-gfx/gfx.h +++ b/esp-gfx/gfx.h @@ -34,10 +34,16 @@ typedef struct { * @param ctx any context that the draw/clear functions might need, ie display device * @param draw_pixel_callback function that gets called to draw a pixel * @param clear_pixel_callback function that gets called to clear a pixel + * @param flush_callback function that gets called to flush the buffer to the display, optional + * @param clear_disp_callback function to send the clear command to the display, optional + * @param clear_fb_callback function that wipes the framebuffer memory of the display, optional */ typedef struct { void (*draw_pixel_callback)(void *ctx, uint8_t x, uint8_t y); void (*clear_pixel_callback)(void *ctx, uint8_t x, uint8_t y); + void (*flush_callback)(void *ctx); + void (*clear_disp_callback)(void *ctx); + void (*clear_fb_callback)(void *ctx); void *ctx; } gfx_canvas_t; @@ -49,3 +55,6 @@ void gfx_draw_line(const gfx_canvas_t *canvas, uint8_t start_x, uint8_t start_y, void gfx_draw_box(const gfx_canvas_t *canvas, uint8_t pos_x, uint8_t pos_y, uint8_t size_x, uint8_t size_y, bool inverted); void gfx_fill_box(const gfx_canvas_t *canvas, uint8_t pos_x, uint8_t pos_y, uint8_t size_x, uint8_t size_y, bool inverted); void gfx_draw_bitmap(const gfx_canvas_t *canvas, uint8_t pos_x, uint8_t pos_y, gfx_bitmap_t bmp, bool inverted); +void gfx_flush(const gfx_canvas_t *canvas); +void gfx_clear_disp(const gfx_canvas_t *canvas); +void gfx_clear_fb(const gfx_canvas_t *canvas); \ No newline at end of file diff --git a/idf_component.yml b/idf_component.yml index 00a31a7..3b1c4ab 100644 --- a/idf_component.yml +++ b/idf_component.yml @@ -2,4 +2,4 @@ dependencies: idf: '>=5.2' description: Simple gfx library for ESP-IDF url: https://git.drath.cc/drath/esp-gfx.git -version: "1.1.2" +version: "1.2.0"