Backlight fix
parent
81f6af7e45
commit
a95c4933c4
|
@ -508,10 +508,9 @@ void GDISP_LLD(drawpixel)(coord_t x, coord_t y, color_t color) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case GDISP_CONTROL_BACKLIGHT:
|
case GDISP_CONTROL_BACKLIGHT:
|
||||||
if(GDISP.Backlight == (*(uint8_t*)value))
|
if((unsigned)value > 100) value = (void *)100;
|
||||||
return;
|
GDISP_LLD(set_backlight)((unsigned)value);
|
||||||
GDISP_LLD(set_backlight)(*(uint8_t*)value);
|
GDISP.Backlight = (unsigned)value;
|
||||||
GDISP.Backlight = (*(uint8_t*)value);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -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);
|
void gdispPackPixels(const pixel_t *buf, coord_t cx, coord_t x, coord_t y, color_t color);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void gdispSetBacklight(uint8_t percentage);
|
|
||||||
void gdispSetContrast(uint8_t percentage);
|
|
||||||
/*
|
/*
|
||||||
* Macro definitions
|
* Macro definitions
|
||||||
*/
|
*/
|
||||||
|
@ -298,6 +296,8 @@ void gdispSetContrast(uint8_t percentage);
|
||||||
/* Macro definitions for common gets and sets */
|
/* Macro definitions for common gets and sets */
|
||||||
#define gdispSetPowerMode(powerMode) gdispControl(GDISP_CONTROL_POWER, (void *)(unsigned)(powerMode))
|
#define gdispSetPowerMode(powerMode) gdispControl(GDISP_CONTROL_POWER, (void *)(unsigned)(powerMode))
|
||||||
#define gdispSetOrientation(newOrientation) gdispControl(GDISP_CONTROL_ORIENTATION, (void *)(unsigned)(newOrientation))
|
#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 gdispGetWidth() ((coord_t)(unsigned)gdispQuery(GDISP_QUERY_WIDTH))
|
||||||
#define gdispGetHeight() ((coord_t)(unsigned)gdispQuery(GDISP_QUERY_HEIGHT))
|
#define gdispGetHeight() ((coord_t)(unsigned)gdispQuery(GDISP_QUERY_HEIGHT))
|
||||||
|
|
18
src/gdisp.c
18
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
|
#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 /* GFX_USE_GDISP */
|
||||||
|
|
||||||
#endif /* _GDISP_C */
|
#endif /* _GDISP_C */
|
||||||
|
|
Loading…
Reference in New Issue