From 94bece00c06ff89a15b97492bf6c8640a3f75c7a Mon Sep 17 00:00:00 2001 From: Federico Amedeo Izzo Date: Fri, 9 Oct 2020 09:51:29 +0200 Subject: [PATCH] add graphics_rgb565.c to linux target, fixed compilation errors --- meson.build | 3 ++- openrtx/include/interfaces/graphics.h | 2 +- openrtx/src/graphics/graphics_rgb565.c | 10 +++++----- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/meson.build b/meson.build index 2251174a..0f2da238 100644 --- a/meson.build +++ b/meson.build @@ -60,7 +60,8 @@ dep = [sdl_dep, threads_dep] ## Platform specialization ## linux_src = src + ['tests/platform/x64_uC.c', - 'platform/drivers/display/display_libSDL.c'] + 'platform/drivers/display/display_libSDL.c', + 'openrtx/src/graphics/graphics_rgb565.c'] linux_def = def + {'SCREEN_WIDTH': 160, 'SCREEN_HEIGHT': 128} ## diff --git a/openrtx/include/interfaces/graphics.h b/openrtx/include/interfaces/graphics.h index 25013b85..e8532432 100644 --- a/openrtx/include/interfaces/graphics.h +++ b/openrtx/include/interfaces/graphics.h @@ -149,6 +149,6 @@ void graphics_drawLine(point_t start, point_t end, color_t color); * @param color: border and fill color, in color_t format. * @param fill: if true the rectangle will be solid, otherwise it will have a 1-pixel border */ -void graphics_drawRect(uint16_t width, uint16_t height, color_t color, bool fill); +void graphics_drawRect(point_t start, uint16_t width, uint16_t height, color_t color, bool fill); #endif /* GRAPHICS_H */ diff --git a/openrtx/src/graphics/graphics_rgb565.c b/openrtx/src/graphics/graphics_rgb565.c index 8e190bed..8358b9e2 100644 --- a/openrtx/src/graphics/graphics_rgb565.c +++ b/openrtx/src/graphics/graphics_rgb565.c @@ -26,10 +26,10 @@ typedef struct rgb565_t { - uint16_t r : 5 - uint16_t g : 6 - uint16_t b : 5 -} rgb565_t + uint16_t r : 5; + uint16_t g : 6; + uint16_t b : 5; +} rgb565_t; bool initialized = 0; uint16_t screen_width = 0; @@ -129,7 +129,7 @@ void graphics_drawRect(point_t start, uint16_t width, uint16_t height, color_t c x_max = screen_width - 1; uint16_t y_max = start.y + height; if(y_max > (screen_heigth - 1)) - y_max = screen_height - 1; + y_max = screen_heigth - 1; for(int y=start.y; y < y_max; y++) { for(int x=start.x; x < x_max; x++)