Merge pull request #1361 from fredizzimo/ergodox_infinity_backlight
Add Ergodox Infinity backlight support
This commit is contained in:
commit
51a86b85f3
11 changed files with 139 additions and 35 deletions
|
@ -25,43 +25,90 @@
|
|||
#include "lcd_backlight_keyframes.h"
|
||||
#endif
|
||||
|
||||
#ifdef LED_ENABLE
|
||||
#ifdef BACKLIGHT_ENABLE
|
||||
#include "led_keyframes.h"
|
||||
#endif
|
||||
|
||||
#include "visualizer_keyframes.h"
|
||||
|
||||
|
||||
#if defined(LCD_ENABLE) && defined(LCD_BACKLIGHT_ENABLE)
|
||||
#if defined(LCD_ENABLE) || defined(LCD_BACKLIGHT_ENABLE) || defined(BACKLIGHT_ENABLE)
|
||||
|
||||
static bool keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state) {
|
||||
#ifdef LCD_ENABLE
|
||||
lcd_keyframe_enable(animation, state);
|
||||
#endif
|
||||
#ifdef LCD_BACKLIGHT_ENABLE
|
||||
backlight_keyframe_enable(animation, state);
|
||||
#endif
|
||||
#ifdef BACKLIGHT_ENABLE
|
||||
led_keyframe_enable(animation, state);
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state) {
|
||||
#ifdef LCD_ENABLE
|
||||
lcd_keyframe_disable(animation, state);
|
||||
#endif
|
||||
#ifdef LCD_BACKLIGHT_ENABLE
|
||||
backlight_keyframe_disable(animation, state);
|
||||
#endif
|
||||
#ifdef BACKLIGHT_ENABLE
|
||||
led_keyframe_disable(animation, state);
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool keyframe_fade_in(keyframe_animation_t* animation, visualizer_state_t* state) {
|
||||
bool ret = false;
|
||||
#ifdef LCD_BACKLIGHT_ENABLE
|
||||
ret |= backlight_keyframe_animate_color(animation, state);
|
||||
#endif
|
||||
#ifdef BACKLIGHT_ENABLE
|
||||
ret |= led_keyframe_fade_in_all(animation, state);
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
static bool keyframe_fade_out(keyframe_animation_t* animation, visualizer_state_t* state) {
|
||||
bool ret = false;
|
||||
#ifdef LCD_BACKLIGHT_ENABLE
|
||||
ret |= backlight_keyframe_animate_color(animation, state);
|
||||
#endif
|
||||
#ifdef BACKLIGHT_ENABLE
|
||||
ret |= led_keyframe_fade_out_all(animation, state);
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
// Don't worry, if the startup animation is long, you can use the keyboard like normal
|
||||
// during that time
|
||||
keyframe_animation_t default_startup_animation = {
|
||||
.num_frames = 4,
|
||||
.num_frames = 3,
|
||||
.loop = false,
|
||||
.frame_lengths = {0, 0, 0, gfxMillisecondsToTicks(5000), 0},
|
||||
.frame_lengths = {0, 0, gfxMillisecondsToTicks(5000)},
|
||||
.frame_functions = {
|
||||
lcd_keyframe_enable,
|
||||
backlight_keyframe_enable,
|
||||
keyframe_enable,
|
||||
lcd_keyframe_draw_logo,
|
||||
backlight_keyframe_animate_color,
|
||||
keyframe_fade_in,
|
||||
},
|
||||
};
|
||||
|
||||
keyframe_animation_t default_suspend_animation = {
|
||||
.num_frames = 4,
|
||||
.num_frames = 3,
|
||||
.loop = false,
|
||||
.frame_lengths = {0, gfxMillisecondsToTicks(1000), 0, 0},
|
||||
.frame_lengths = {0, gfxMillisecondsToTicks(1000), 0},
|
||||
.frame_functions = {
|
||||
lcd_keyframe_display_layer_text,
|
||||
backlight_keyframe_animate_color,
|
||||
lcd_keyframe_disable,
|
||||
backlight_keyframe_disable,
|
||||
keyframe_fade_out,
|
||||
keyframe_disable,
|
||||
},
|
||||
};
|
||||
#endif
|
||||
|
||||
#if defined(LED_ENABLE)
|
||||
#if defined(BACKLIGHT_ENABLE)
|
||||
#define CROSSFADE_TIME 1000
|
||||
#define GRADIENT_TIME 3000
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
@ -173,7 +173,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
|
|||
}
|
||||
|
||||
// software shutdown disable (i.e. turn stuff on)
|
||||
write_register(g, IS31_FUNCTIONREG, IS31_REG_SHUTDOWN, IS31_REG_SHUTDOWN_ON);
|
||||
write_register(g, IS31_FUNCTIONREG, IS31_REG_SHUTDOWN, IS31_REG_SHUTDOWN_OFF);
|
||||
gfxSleepMilliseconds(10);
|
||||
|
||||
// Finish Init
|
||||
|
@ -183,7 +183,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
|
|||
g->g.Width = GDISP_SCREEN_WIDTH;
|
||||
g->g.Height = GDISP_SCREEN_HEIGHT;
|
||||
g->g.Orientation = GDISP_ROTATE_0;
|
||||
g->g.Powermode = powerOn;
|
||||
g->g.Powermode = powerOff;
|
||||
g->g.Backlight = GDISP_INITIAL_BACKLIGHT;
|
||||
g->g.Contrast = GDISP_INITIAL_CONTRAST;
|
||||
return TRUE;
|
||||
|
@ -204,7 +204,8 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
|
|||
uint8_t* src = PRIV(g)->frame_buffer;
|
||||
for (int y=0;y<GDISP_SCREEN_HEIGHT;y++) {
|
||||
for (int x=0;x<GDISP_SCREEN_WIDTH;x++) {
|
||||
PRIV(g)->write_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 > 100 ? 100 : val;
|
||||
g->flags |= GDISP_FLG_NEEDFLUSH;
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif // GDISP_NEED_CONTROL
|
||||
|
|
|
@ -62,15 +62,10 @@ CUSTOM_MATRIX ?= yes # Custom matrix file
|
|||
SERIAL_LINK_ENABLE = yes
|
||||
VISUALIZER_ENABLE ?= yes
|
||||
LCD_ENABLE ?= yes
|
||||
LED_ENABLE ?= no
|
||||
BACKLIGHT_ENABLE ?= yes
|
||||
LCD_BACKLIGHT_ENABLE ?= yes
|
||||
MIDI_ENABLE = no
|
||||
RGBLIGHT_ENABLE = no
|
||||
|
||||
ifdef LCD_ENABLE
|
||||
include $(SUBPROJECT_PATH)/drivers/gdisp/st7565ergodox/driver.mk
|
||||
endif
|
||||
|
||||
ifdef LED_ENABLE
|
||||
include $(SUBPROJECT_PATH)/drivers/gdisp/IS31FL3731C/driver.mk
|
||||
endif
|
||||
include $(SUBPROJECT_PATH)/drivers/gdisp/IS31FL3731C/driver.mk
|
|
@ -1,7 +1,7 @@
|
|||
SUBPROJECT_DEFAULT = infinity
|
||||
LCD_BACKLIGHT_ENABLE = yes
|
||||
LCD_ENABLE = yes
|
||||
LED_ENABLE = yes
|
||||
BACKLIGHT_ENABLE = yes
|
||||
BACKLIGHT_ENABLE = yes
|
||||
NKRO_ENABLE = yes
|
||||
TAP_DANCE_ENABLE = yes
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue