diff --git a/keyboards/ergodox/infinity/drivers/gdisp/IS31FL3731C/gdisp_IS31FL3731C.c b/keyboards/ergodox/infinity/drivers/gdisp/IS31FL3731C/gdisp_IS31FL3731C.c index 24726944..0b48783d 100644 --- a/keyboards/ergodox/infinity/drivers/gdisp/IS31FL3731C/gdisp_IS31FL3731C.c +++ b/keyboards/ergodox/infinity/drivers/gdisp/IS31FL3731C/gdisp_IS31FL3731C.c @@ -43,7 +43,7 @@ extern const uint8_t CIE1931_CURVE[]; #define GDISP_INITIAL_CONTRAST 0 #endif #ifndef GDISP_INITIAL_BACKLIGHT - #define GDISP_INITIAL_BACKLIGHT 100 + #define GDISP_INITIAL_BACKLIGHT 0 #endif #define GDISP_FLG_NEEDFLUSH (GDISP_FLG_DRIVER<<0) @@ -204,7 +204,8 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { uint8_t* src = PRIV(g)->frame_buffer; for (int y=0;ywrite_buffer[get_led_address(g, x, y)]=CIE1931_CURVE[*src]; + uint8_t val = (uint16_t)*src * g->g.Backlight / 100; + PRIV(g)->write_buffer[get_led_address(g, x, y)]=CIE1931_CURVE[val]; ++src; } } @@ -297,8 +298,13 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { g->g.Orientation = (orientation_t)g->p.ptr; return; - case GDISP_CONTROL_CONTRAST: - return; + case GDISP_CONTROL_BACKLIGHT: + if (g->g.Backlight == (unsigned)g->p.ptr) + return; + unsigned val = (unsigned)g->p.ptr; + g->g.Backlight = val > 255 ? 255 : val; + g->flags |= GDISP_FLG_NEEDFLUSH; + return; } } #endif // GDISP_NEED_CONTROL