Backlight fix
This commit is contained in:
parent
81f6af7e45
commit
a95c4933c4
3 changed files with 5 additions and 24 deletions
|
@ -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:
|
||||
|
|
|
@ -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))
|
||||
|
|
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
|
||||
|
||||
/**
|
||||
* @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 */
|
||||
|
|
Loading…
Add table
Reference in a new issue