From 731054a1312561bbdefe7bd5a7b425ab00a7949a Mon Sep 17 00:00:00 2001 From: Silvano Seva Date: Wed, 17 Jan 2024 00:13:19 +0100 Subject: [PATCH] Dropped display_renderingInProgress() function from display API Removed display_renderingInProgress() function from display interface as it has never been used so far. --- openrtx/include/core/graphics.h | 8 -------- openrtx/include/interfaces/display.h | 7 ------- openrtx/src/core/graphics.c | 18 ++++-------------- platform/drivers/display/HX8353_MD3x.cpp | 10 ---------- platform/drivers/display/SH1106_ttwrplus.c | 8 -------- platform/drivers/display/SH110x_Mod17.c | 5 ----- platform/drivers/display/SSD1306_Mod17.c | 5 ----- platform/drivers/display/ST7567_MD9600.c | 5 ----- platform/drivers/display/UC1701_GDx.c | 5 ----- platform/drivers/display/display_libSDL.c | 5 ----- platform/drivers/stubs/display_stub.c | 5 ----- 11 files changed, 4 insertions(+), 77 deletions(-) diff --git a/openrtx/include/core/graphics.h b/openrtx/include/core/graphics.h index 13ea2940..6f10ec88 100644 --- a/openrtx/include/core/graphics.h +++ b/openrtx/include/core/graphics.h @@ -134,14 +134,6 @@ void gfx_renderRows(uint8_t startRow, uint8_t endRow); */ void gfx_render(); -/** - * This function calls the correspondent method of the low level interface display.h - * Check if framebuffer is being copied to the screen or not, in which case it - * can be modified without problems. - * @return false if rendering is not in progress. - */ -bool gfx_renderingInProgress(); - /** * Clears a portion of the screen content * This results in a black screen on color displays diff --git a/openrtx/include/interfaces/display.h b/openrtx/include/interfaces/display.h index 2cb7d7ba..3ba5c460 100644 --- a/openrtx/include/interfaces/display.h +++ b/openrtx/include/interfaces/display.h @@ -94,13 +94,6 @@ void display_renderRows(uint8_t startRow, uint8_t endRow); */ void display_render(); -/** - * Check if framebuffer is being copied to the screen or not, in which case it - * can be modified without problems. - * @return false if rendering is not in progress. - */ -bool display_renderingInProgress(); - /** * Set display contrast. * NOTE: not all the display controllers support contrast control, thus on some diff --git a/openrtx/src/core/graphics.c b/openrtx/src/core/graphics.c index 1dad20df..b841901b 100644 --- a/openrtx/src/core/graphics.c +++ b/openrtx/src/core/graphics.c @@ -147,7 +147,7 @@ static bw_t _color2bw(color_t true_color) #error Please define a pixel format type into hwconfig.h or meson.build #endif -static bool initialized = 0; + static PIXEL_T *buf; static uint16_t fbSize; static char text[32]; @@ -156,7 +156,6 @@ void gfx_init() { display_init(); buf = (PIXEL_T *)(display_getFrameBuffer()); - initialized = 1; // Calculate framebuffer size #ifdef CONFIG_PIX_FMT_RGB565 @@ -174,7 +173,6 @@ void gfx_init() void gfx_terminate() { display_terminate(); - initialized = 0; } void gfx_renderRows(uint8_t startRow, uint8_t endRow) @@ -187,15 +185,11 @@ void gfx_render() display_render(); } -bool gfx_renderingInProgress() -{ - return display_renderingInProgress(); -} - void gfx_clearRows(uint8_t startRow, uint8_t endRow) { - if(!initialized) return; - if(endRow < startRow) return; + if(endRow < startRow) + return; + uint16_t start = startRow * CONFIG_SCREEN_WIDTH * sizeof(PIXEL_T); uint16_t height = endRow - startRow * CONFIG_SCREEN_WIDTH * sizeof(PIXEL_T); // Set the specified rows to 0x00 = make the screen black @@ -204,14 +198,12 @@ void gfx_clearRows(uint8_t startRow, uint8_t endRow) void gfx_clearScreen() { - if(!initialized) return; // Set the whole framebuffer to 0x00 = make the screen black memset(buf, 0x00, fbSize); } void gfx_fillScreen(color_t color) { - if(!initialized) return; for(int16_t y = 0; y < CONFIG_SCREEN_HEIGHT; y++) { for(int16_t x = 0; x < CONFIG_SCREEN_WIDTH; x++) @@ -259,7 +251,6 @@ inline void gfx_setPixel(point_t pos, color_t color) void gfx_drawLine(point_t start, point_t end, color_t color) { - if(!initialized) return; int16_t steep = abs(end.y - start.y) > abs(end.x - start.x); if (steep) @@ -319,7 +310,6 @@ void gfx_drawLine(point_t start, point_t end, color_t color) void gfx_drawRect(point_t start, uint16_t width, uint16_t height, color_t color, bool fill) { - if(!initialized) return; if(width == 0) return; if(height == 0) return; uint16_t x_max = start.x + width - 1; diff --git a/platform/drivers/display/HX8353_MD3x.cpp b/platform/drivers/display/HX8353_MD3x.cpp index 6203f0a9..fc609574 100644 --- a/platform/drivers/display/HX8353_MD3x.cpp +++ b/platform/drivers/display/HX8353_MD3x.cpp @@ -524,16 +524,6 @@ void display_render() display_renderRows(0, CONFIG_SCREEN_HEIGHT); } -bool display_renderingInProgress() -{ - /* - * Rendering is in progress if display's chip select is low or a DMA - * transfer is in progress. - */ - bool dmaBusy = (DMA2_Stream7->CR & DMA_SxCR_EN) ? true : false; - return (gpio_readPin(LCD_CS) == 0) || dmaBusy; -} - void *display_getFrameBuffer() { return (void *)(frameBuffer); diff --git a/platform/drivers/display/SH1106_ttwrplus.c b/platform/drivers/display/SH1106_ttwrplus.c index 05fd0098..3bde47f5 100644 --- a/platform/drivers/display/SH1106_ttwrplus.c +++ b/platform/drivers/display/SH1106_ttwrplus.c @@ -36,7 +36,6 @@ static const struct display_buffer_descriptor displayBufDesc = }; static uint8_t frameBuffer[FB_SIZE]; -static bool rendering = false; void display_init() { @@ -63,7 +62,6 @@ void display_render() static uint8_t shadowBuffer[FB_SIZE] = { 0 }; memset(shadowBuffer, 0x00, FB_SIZE); - rendering = true; for(uint8_t y = 0; y < CONFIG_SCREEN_HEIGHT; y++) { for(uint8_t x = 0; x < CONFIG_SCREEN_WIDTH; x++) @@ -76,12 +74,6 @@ void display_render() } display_write(displayDev, 0, 0, &displayBufDesc, shadowBuffer); - rendering = false; -} - -bool display_renderingInProgress() -{ - return rendering; } void *display_getFrameBuffer() diff --git a/platform/drivers/display/SH110x_Mod17.c b/platform/drivers/display/SH110x_Mod17.c index e2c24976..b88803f9 100644 --- a/platform/drivers/display/SH110x_Mod17.c +++ b/platform/drivers/display/SH110x_Mod17.c @@ -130,11 +130,6 @@ void display_render() display_renderRows(0, CONFIG_SCREEN_HEIGHT); } -bool display_renderingInProgress() -{ - return (gpio_readPin(LCD_CS) == 0); -} - void *display_getFrameBuffer() { return (void *)(frameBuffer); diff --git a/platform/drivers/display/SSD1306_Mod17.c b/platform/drivers/display/SSD1306_Mod17.c index daada726..9b1a485b 100644 --- a/platform/drivers/display/SSD1306_Mod17.c +++ b/platform/drivers/display/SSD1306_Mod17.c @@ -150,11 +150,6 @@ void display_render() display_renderRows(0, (CONFIG_SCREEN_WIDTH / 8) - 1); } -bool display_renderingInProgress() -{ - return (gpio_readPin(LCD_CS) == 0); -} - void *display_getFrameBuffer() { return (void *)(frameBuffer); diff --git a/platform/drivers/display/ST7567_MD9600.c b/platform/drivers/display/ST7567_MD9600.c index 1f63f58f..a9e2cf07 100644 --- a/platform/drivers/display/ST7567_MD9600.c +++ b/platform/drivers/display/ST7567_MD9600.c @@ -135,11 +135,6 @@ void display_render() display_renderRows(0, CONFIG_SCREEN_HEIGHT / 8); } -bool display_renderingInProgress() -{ - return (gpio_readPin(LCD_CS) == 0); -} - void *display_getFrameBuffer() { return (void *)(frameBuffer); diff --git a/platform/drivers/display/UC1701_GDx.c b/platform/drivers/display/UC1701_GDx.c index e73c4a58..4ed58f58 100644 --- a/platform/drivers/display/UC1701_GDx.c +++ b/platform/drivers/display/UC1701_GDx.c @@ -160,11 +160,6 @@ void display_render() display_renderRows(0, CONFIG_SCREEN_HEIGHT / 8); } -bool display_renderingInProgress() -{ - return (gpio_readPin(LCD_CS) == 0); -} - void *display_getFrameBuffer() { return (void *)(frameBuffer); diff --git a/platform/drivers/display/display_libSDL.c b/platform/drivers/display/display_libSDL.c index 4548467c..b660969b 100644 --- a/platform/drivers/display/display_libSDL.c +++ b/platform/drivers/display/display_libSDL.c @@ -165,11 +165,6 @@ void display_render() display_renderRows(0, CONFIG_SCREEN_HEIGHT); } -bool display_renderingInProgress() -{ - return inProgress; -} - void *display_getFrameBuffer() { return (void *) (frameBuffer); diff --git a/platform/drivers/stubs/display_stub.c b/platform/drivers/stubs/display_stub.c index e612b68e..8af19bdb 100644 --- a/platform/drivers/stubs/display_stub.c +++ b/platform/drivers/stubs/display_stub.c @@ -49,11 +49,6 @@ void display_render() } -bool display_renderingInProgress() -{ - return false; -} - void *display_getFrameBuffer() { return (void *) (frameBuffer);