From bda8c738b10c136ad1557acc1a07174ceb3e4f73 Mon Sep 17 00:00:00 2001 From: inmarket Date: Sun, 8 Jul 2018 11:47:36 +1000 Subject: Added type gPowermode to replace V2.x powermode_t, and values gPowerXXX replace powerXXX --- src/gdisp/gdisp.c | 2 +- src/gdisp/gdisp.h | 39 ++++++++++++++++++++++----------------- src/gdisp/gdisp_driver.h | 2 +- src/gdisp/gdisp_pixmap.c | 2 +- 4 files changed, 25 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/gdisp/gdisp.c b/src/gdisp/gdisp.c index 5b58bb90..f3bac3bd 100644 --- a/src/gdisp/gdisp.c +++ b/src/gdisp/gdisp.c @@ -711,7 +711,7 @@ unsigned gdispGetDisplayCount(void) { gCoord gdispGGetWidth(GDisplay *g) { return g->g.Width; } gCoord gdispGGetHeight(GDisplay *g) { return g->g.Height; } -powermode_t gdispGGetPowerMode(GDisplay *g) { return g->g.Powermode; } +gPowermode gdispGGetPowerMode(GDisplay *g) { return g->g.Powermode; } orientation_t gdispGGetOrientation(GDisplay *g) { return g->g.Orientation; } uint8_t gdispGGetBacklight(GDisplay *g) { return g->g.Backlight; } uint8_t gdispGGetContrast(GDisplay *g) { return g->g.Contrast; } diff --git a/src/gdisp/gdisp.h b/src/gdisp/gdisp.h index a808c7df..4fe0d823 100644 --- a/src/gdisp/gdisp.h +++ b/src/gdisp/gdisp.h @@ -108,15 +108,15 @@ typedef enum orientation { } orientation_t; /** - * @enum powermode + * @enum gPowermode * @brief Type for the available power modes for the screen. */ -typedef enum powermode { - powerOff, /**< Turn the display off. */ - powerSleep, /**< Put the display into sleep mode. */ - powerDeepSleep, /**< Put the display into deep-sleep mode. */ - powerOn /**< Turn the display on. */ -} powermode_t; +typedef enum gPowermode { + gPowerOff, /**< Turn the display off. */ + gPowerSleep, /**< Put the display into sleep mode. */ + gPowerDeepSleep, /**< Put the display into deep-sleep mode. */ + gPowerOn /**< Turn the display on. */ +} gPowermode; /* * Our black box display structure. @@ -139,7 +139,7 @@ extern GDisplay *GDISP; * @details Unsupported control codes are ignored. * @note The value parameter should always be typecast to (void *). * @note There are some predefined and some specific to the low level driver. - * @note GDISP_CONTROL_POWER - Takes a gdisp_powermode_t + * @note GDISP_CONTROL_POWER - Takes a gPowermode * GDISP_CONTROL_ORIENTATION - Takes a gdisp_orientation_t * GDISP_CONTROL_BACKLIGHT - Takes an int from 0 to 100. For a driver * that only supports off/on anything other @@ -322,7 +322,7 @@ gCoord gdispGGetHeight(GDisplay *g); * * @api */ -powermode_t gdispGGetPowerMode(GDisplay *g); +gPowermode gdispGGetPowerMode(GDisplay *g); #define gdispGetPowerMode() gdispGGetPowerMode(GDISP) /** @@ -740,7 +740,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor */ void gdispGDrawThickArc(GDisplay *g, gCoord xc, gCoord yc, gCoord startradius, gCoord endradius, gCoord startangle, gCoord endangle, gColor color); #define gdispDrawThickArc(x,y,rs,re,s,e,c) gdispGDrawThickArc(GDISP,x,y,rs,re,s,e,c) - + /** * @brief Draw a filled arc. * @pre GDISP_NEED_ARC must be GFXON in your gfxconf.h @@ -1102,7 +1102,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor * @api */ const char *gdispGetFontName(font_t font); - + /** * @brief Add a font permanently to the font list. * @returns gTrue on success. Reasons it may fail: out of memory, if it is already on the list, it is not a font loaded in RAM. @@ -1167,8 +1167,8 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor * * @api */ -#define gdispGSetPowerMode(g, powerMode) gdispGControl((g), GDISP_CONTROL_POWER, (void *)(unsigned)(powerMode)) -#define gdispSetPowerMode(powerMode) gdispGControl(GDISP, GDISP_CONTROL_POWER, (void *)(unsigned)(powerMode)) +#define gdispGSetPowerMode(g, powerMode) gdispGControl((g), GDISP_CONTROL_POWER, (void *)(gPowermode)(powerMode)) +#define gdispSetPowerMode(powerMode) gdispGControl(GDISP, GDISP_CONTROL_POWER, (void *)(gPowermode)(powerMode)) /** * @brief Set the display orientation. @@ -1230,10 +1230,15 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor /* V2 compatibility */ #if GFX_COMPAT_V2 - typedef gColor color_t; - typedef gPixel pixel_t; - typedef gCoord coord_t; - typedef gPoint point, point_t; + typedef gPowermode powermode_t; + #define gPowerOff powerOff + #define gPowerDeepSleep powerDeepSleep + #define gPowerSleep powerSleep + #define gPowerOn powerOn + typedef gColor color_t; + typedef gPixel pixel_t; + typedef gCoord coord_t; + typedef gPoint point, point_t; #endif #endif /* GFX_USE_GDISP */ diff --git a/src/gdisp/gdisp_driver.h b/src/gdisp/gdisp_driver.h index 11af847d..8b5bc7b9 100644 --- a/src/gdisp/gdisp_driver.h +++ b/src/gdisp/gdisp_driver.h @@ -321,7 +321,7 @@ struct GDisplay { gCoord Width; gCoord Height; orientation_t Orientation; - powermode_t Powermode; + gPowermode Powermode; uint8_t Backlight; uint8_t Contrast; } g; diff --git a/src/gdisp/gdisp_pixmap.c b/src/gdisp/gdisp_pixmap.c index 8fbccad4..e65e6e71 100644 --- a/src/gdisp/gdisp_pixmap.c +++ b/src/gdisp/gdisp_pixmap.c @@ -123,7 +123,7 @@ LLDSPEC gBool gdisp_lld_init(GDisplay *g) { g->g.Backlight = 100; g->g.Contrast = 50; g->g.Orientation = GDISP_ROTATE_0; - g->g.Powermode = powerOn; + g->g.Powermode = gPowerOn; g->board = 0; return gTrue; -- cgit v1.2.3