Makefile fixes and update of Visualizer

This commit is contained in:
Fred Sundvik 2016-07-07 12:46:10 +03:00
parent 9772e697a0
commit 07d0d5cbe4
5 changed files with 29 additions and 7 deletions

View file

@ -69,8 +69,17 @@ CUSTOM_MATRIX ?= yes # Custom matrix file
SERIAL_LINK_ENABLE = yes SERIAL_LINK_ENABLE = yes
VISUALIZER_ENABLE ?= yes VISUALIZER_ENABLE ?= yes
LCD_ENABLE ?= yes LCD_ENABLE ?= yes
LED_ENABLE ?= yes
LCD_BACKLIGHT_ENABLE ?= yes LCD_BACKLIGHT_ENABLE ?= yes
ifdef LCD_ENABLE
include drivers/gdisp/st7565ergodox/driver.mk
endif
ifdef LED_ENABLE
include drivers/gdisp/IS31FL3731C/driver.mk
endif
ifndef QUANTUM_DIR ifndef QUANTUM_DIR
include ../../Makefile include ../../Makefile
endif endif

View file

@ -89,8 +89,8 @@ static uint8_t crossfade_start_frame[NUM_ROWS][NUM_COLS];
static uint8_t crossfade_end_frame[NUM_ROWS][NUM_COLS]; static uint8_t crossfade_end_frame[NUM_ROWS][NUM_COLS];
static uint8_t compute_gradient_color(float t, float index, float num) { static uint8_t compute_gradient_color(float t, float index, float num) {
const float two_pi = 2.0f * PI; const float two_pi = M_2_PI;
float normalized_index = (1.0f - index / (num - 1)) * two_pi; float normalized_index = (1.0f - index / (num - 1.0f)) * two_pi;
float x = t * two_pi + normalized_index; float x = t * two_pi + normalized_index;
float v = 0.5 * (cosf(x) + 1.0f); float v = 0.5 * (cosf(x) + 1.0f);
return (uint8_t)(255.0f * v); return (uint8_t)(255.0f * v);

View file

@ -25,6 +25,8 @@ EXTRAINCDIRS += $(GFXINC) $(VISUALIZER_DIR)
GFXLIB = $(LIB_PATH)/ugfx GFXLIB = $(LIB_PATH)/ugfx
VPATH += $(VISUALIZER_PATH) VPATH += $(VISUALIZER_PATH)
OPT_DEFS += -DVISUALIZER_ENABLE
ifdef LCD_ENABLE ifdef LCD_ENABLE
OPT_DEFS += -DLCD_ENABLE OPT_DEFS += -DLCD_ENABLE
ULIBS += -lm ULIBS += -lm
@ -44,12 +46,8 @@ UDEFS += -DLED_ENABLE
endif endif
include $(GFXLIB)/gfx.mk include $(GFXLIB)/gfx.mk
#SERIAL_SRC = $(wildcard $(SERIAL_PATH)/protocol/*.c) SRC += $(patsubst $(TOP_DIR)/%,%,$(GFXSRC))
#SERIAL_SRC += $(wildcard $(SERIAL_PATH)/system/*.c)
#SRC += $(patsubst $(QUANTUM_PATH)/%,%,$(SERIAL_SRC))
#SRC += $(GFXSRC)
OPT_DEFS += $(patsubst %,-D%,$(patsubst -D%,%,$(GFXDEFS))) OPT_DEFS += $(patsubst %,-D%,$(patsubst -D%,%,$(GFXDEFS)))
#ULIBS += $(patsubst %,-l%,$(patsubst -l%,%,$(GFXLIBS)))
ifndef VISUALIZER_USER ifndef VISUALIZER_USER
VISUALIZER_USER = visualizer_user.c VISUALIZER_USER = visualizer_user.c

View file

@ -29,6 +29,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "sendchar.h" #include "sendchar.h"
#include "eeconfig.h" #include "eeconfig.h"
#include "backlight.h" #include "backlight.h"
#include "action_layer.h"
#ifdef BOOTMAGIC_ENABLE #ifdef BOOTMAGIC_ENABLE
# include "bootmagic.h" # include "bootmagic.h"
#else #else
@ -52,6 +53,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifdef SERIAL_LINK_ENABLE #ifdef SERIAL_LINK_ENABLE
# include "serial_link/system/serial_link.h" # include "serial_link/system/serial_link.h"
#endif #endif
#ifdef VISUALIZER_ENABLE
# include "visualizer/visualizer.h"
#endif
#ifdef MATRIX_HAS_GHOST #ifdef MATRIX_HAS_GHOST
static bool has_ghost_in_row(uint8_t row) static bool has_ghost_in_row(uint8_t row)
@ -181,6 +185,10 @@ MATRIX_LOOP_END:
serial_link_update(); serial_link_update();
#endif #endif
#ifdef VISUALIZER_ENABLE
visualizer_update(default_layer_state, layer_state, host_keyboard_leds());
#endif
// update LED // update LED
if (led_status != host_keyboard_leds()) { if (led_status != host_keyboard_leds()) {
led_status = host_keyboard_leds(); led_status = host_keyboard_leds();

View file

@ -38,6 +38,9 @@
#ifdef SERIAL_LINK_ENABLE #ifdef SERIAL_LINK_ENABLE
#include "serial_link/system/serial_link.h" #include "serial_link/system/serial_link.h"
#endif #endif
#ifdef VISUALIZER_ENABLE
#include "visualizer/visualizer.h"
#endif
#include "suspend.h" #include "suspend.h"
@ -101,6 +104,10 @@ int main(void) {
/* init printf */ /* init printf */
init_printf(NULL,sendchar_pf); init_printf(NULL,sendchar_pf);
#ifdef VISUALIZER_ENABLE
visualizer_init();
#endif
#ifdef SERIAL_LINK_ENABLE #ifdef SERIAL_LINK_ENABLE
init_serial_link(); init_serial_link();
#endif #endif