From 4ffb258d71fe0720418fb350b6f3d5354240dddf Mon Sep 17 00:00:00 2001 From: Andrew Hannam Date: Thu, 9 Aug 2012 18:56:09 +1000 Subject: [PATCH] Removed GDISPDriver structure, add macros Removed the GDISPDriver strucutre definitions, and as a parameter to gdispInit. Added macros for common Control and Query routines eg. gdispGetWidth ... --- halext/include/gdisp.h | 17 +++++++++++++---- halext/include/gdisp_lld.h | 4 ---- halext/include/glcd.h | 3 --- halext/src/gdisp.c | 4 ++-- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/halext/include/gdisp.h b/halext/include/gdisp.h index 4963043b..b5a59cf9 100644 --- a/halext/include/gdisp.h +++ b/halext/include/gdisp.h @@ -155,7 +155,7 @@ extern "C" { #if GDISP_NEED_MULTITHREAD || GDISP_NEED_ASYNC /* Base Functions */ - bool_t gdispInit(GDISPDriver *gdisp); + bool_t gdispInit(void); bool_t gdispIsBusy(void); /* Drawing Functions */ @@ -243,9 +243,18 @@ void gdispDrawBox(coord_t x, coord_t y, coord_t cx, coord_t cy, color_t color); void gdispPackPixels(const pixel_t *buf, coord_t cx, coord_t x, coord_t y, color_t color); #endif -/* Deprecated Routines (already!) */ -#define gdispSetPowerMode(powerMode) gdispControl(GDISP_CONTROL_POWER, (void *)(powerMode)) -#define gdispSetOrientation(newOrientation) gdispControl(GDISP_CONTROL_ORITENTATION, (void *)(newOrientation)) +/* Macro definitions for common gets and sets */ +#define gdispSetPowerMode(powerMode) gdispControl(GDISP_CONTROL_POWER, (void *)(unsigned)(powerMode)) +#define gdispSetOrientation(newOrientation) gdispControl(GDISP_CONTROL_ORITENTATION, (void *)(unsigned)(newOrientation)) +#define gdispSetBacklight(percent) gdispControl(GDISP_CONTROL_BACKLIGHT, (void *)(unsigned)(percent)) +#define gdispSetContrast(percent) gdispControl(GDISP_CONTROL_CONTRAST, (void *)(unsigned)(percent)) + +#define gdispGetWidth() ((coord_t)(unsigned)gdispQuery(GDISP_QUERY_WIDTH)) +#define gdispGetHeight() ((coord_t)(unsigned)gdispQuery(GDISP_QUERY_HEIGHT)) +#define gdispGetPowerMode() ((gdisp_powermode_t)(unsigned)gdispQuery(GDISP_QUERY_POWER)) +#define gdispGetOrientation() ((gdisp_orientation_t)(unsigned)gdispQuery(GDISP_QUERY_ORIENTATION)) +#define gdispGetBacklight() ((coord_t)(unsigned)gdispQuery(GDISP_QUERY_BACKLIGHT)) +#define gdispGetContrast() ((coord_t)(unsigned)gdispQuery(GDISP_QUERY_CONTRAST)) #ifdef __cplusplus } diff --git a/halext/include/gdisp_lld.h b/halext/include/gdisp_lld.h index bf083a4f..99865a9f 100644 --- a/halext/include/gdisp_lld.h +++ b/halext/include/gdisp_lld.h @@ -510,10 +510,6 @@ typedef color_t pixel_t; * @brief The type of a font. */ typedef const struct font *font_t; -/** - * @brief Type of a structure representing a GDISP driver. - */ -typedef struct GDISPDriver GDISPDriver; /** * @brief Type for the screen orientation. */ diff --git a/halext/include/glcd.h b/halext/include/glcd.h index 670d160e..ab2f6be2 100644 --- a/halext/include/glcd.h +++ b/halext/include/glcd.h @@ -58,9 +58,6 @@ enum transparency {solid, transparent}; #define font_LargeNumbersDouble (&fontLargeNumbersDouble) #define font_LargeNumbersNarrow (&fontLargeNumbersNarrow) -#define GLCDDriver GDISPDriver -#define GLCDD GDISP - enum glcd_result { GLCD_DONE, GLCD_FAILED, GLCD_PROGRESS, diff --git a/halext/src/gdisp.c b/halext/src/gdisp.c index 90b4582d..ee2b98e4 100644 --- a/halext/src/gdisp.c +++ b/halext/src/gdisp.c @@ -154,7 +154,7 @@ * * @init */ - bool_t gdispInit(GDISPDriver * UNUSED(gdisp)) { + bool_t gdispInit(void) { bool_t res; /* Initialise Mutex */ @@ -168,7 +168,7 @@ return res; } #elif GDISP_NEED_ASYNC - bool_t gdispInit(GDISPDriver * UNUSED(gdisp)) { + bool_t gdispInit(void) { bool_t res; unsigned i;