diff options
author | Joel Bodenmann <joel@unormal.org> | 2012-11-13 23:54:50 +0100 |
---|---|---|
committer | Joel Bodenmann <joel@unormal.org> | 2012-11-13 23:54:50 +0100 |
commit | a95c4933c4ef7631c077fc040076e71c8d46209a (patch) | |
tree | f54f775f2795e783d3190de8b1c16066d64e1fab | |
parent | 81f6af7e453b4ac86264dd5197e185d0d4ed0d22 (diff) | |
download | uGFX-a95c4933c4ef7631c077fc040076e71c8d46209a.tar.gz uGFX-a95c4933c4ef7631c077fc040076e71c8d46209a.tar.bz2 uGFX-a95c4933c4ef7631c077fc040076e71c8d46209a.zip |
Backlight fix
-rw-r--r-- | drivers/gdisp/ILI9320/gdisp_lld.c | 7 | ||||
-rw-r--r-- | include/gdisp.h | 4 | ||||
-rw-r--r-- | src/gdisp.c | 18 |
3 files changed, 5 insertions, 24 deletions
diff --git a/drivers/gdisp/ILI9320/gdisp_lld.c b/drivers/gdisp/ILI9320/gdisp_lld.c index 4b485d79..7b9eda27 100644 --- a/drivers/gdisp/ILI9320/gdisp_lld.c +++ b/drivers/gdisp/ILI9320/gdisp_lld.c @@ -508,10 +508,9 @@ void GDISP_LLD(drawpixel)(coord_t x, coord_t y, color_t color) { return;
case GDISP_CONTROL_BACKLIGHT:
- if(GDISP.Backlight == (*(uint8_t*)value))
- return;
- GDISP_LLD(set_backlight)(*(uint8_t*)value);
- GDISP.Backlight = (*(uint8_t*)value);
+ if((unsigned)value > 100) value = (void *)100;
+ GDISP_LLD(set_backlight)((unsigned)value);
+ GDISP.Backlight = (unsigned)value;
break;
default:
diff --git a/include/gdisp.h b/include/gdisp.h index f92ac8ac..760f14f6 100644 --- a/include/gdisp.h +++ b/include/gdisp.h @@ -287,8 +287,6 @@ 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
-void gdispSetBacklight(uint8_t percentage);
-void gdispSetContrast(uint8_t percentage);
/*
* Macro definitions
*/
@@ -298,6 +296,8 @@ void gdispSetContrast(uint8_t percentage); /* Macro definitions for common gets and sets */
#define gdispSetPowerMode(powerMode) gdispControl(GDISP_CONTROL_POWER, (void *)(unsigned)(powerMode))
#define gdispSetOrientation(newOrientation) gdispControl(GDISP_CONTROL_ORIENTATION, (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))
diff --git a/src/gdisp.c b/src/gdisp.c index ddcf8546..81c06599 100644 --- a/src/gdisp.c +++ b/src/gdisp.c @@ -1267,24 +1267,6 @@ void gdispDrawBox(coord_t x, coord_t y, coord_t cx, coord_t cy, color_t color) { }
#endif
-/**
- * @brief Control backlight brightness
- *
- * @param[in] percentage The percentage of the brightness (0 to 100)
- */
-void gdispSetBacklight(uint8_t percentage) {
- gdispControl(GDISP_CONTROL_BACKLIGHT, (void*)&percentage);
-}
-
-/**
- * @brief Control display contrast
- *
- * @param[in] percentage The percentage of the contrast
- */
-void gdispSetPercentage(uint8_t percentage){
- gdispControl(GDISP_CONTROL_CONTRAST, (void*)&percentage);
-}
-
#endif /* GFX_USE_GDISP */
#endif /* _GDISP_C */
|