diff --git a/quantum/quantum.c b/quantum/quantum.c index 2828a039660c..83e0fdfaac1f 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c @@ -190,14 +190,15 @@ static uint16_t scs_timer[2] = {0, 0}; */ static bool grave_esc_was_shifted = false; -uint8_t typing_speed = 0; bool process_record_quantum(keyrecord_t *record) { /* This gets the keycode from the key pressed */ keypos_t key = record->event.key; uint16_t keycode; - if (typing_speed < TYPING_SPEED_MAX_VALUE) typing_speed += 1; + #ifdef RGBLIGHT_ENABLE + if (typing_speed < TYPING_SPEED_MAX_VALUE) typing_speed += 1; + #endif #if !defined(NO_ACTION_LAYER) && defined(PREVENT_STUCK_MODIFIERS) /* TODO: Use store_or_get_action() or a similar function. */ diff --git a/quantum/quantum.h b/quantum/quantum.h index a57a0dc0a1bf..1db9846f0458 100644 --- a/quantum/quantum.h +++ b/quantum/quantum.h @@ -56,9 +56,6 @@ #include "suspend.h" extern uint32_t default_layer_state; -//Used in rgblight.c to match RGB animation to typing speed -extern uint8_t typing_speed; -#define TYPING_SPEED_MAX_VALUE 100 #ifndef NO_ACTION_LAYER extern uint32_t layer_state; diff --git a/quantum/rgblight.c b/quantum/rgblight.c index 9cbaf60851f0..302ca4c7c150 100644 --- a/quantum/rgblight.c +++ b/quantum/rgblight.c @@ -24,15 +24,13 @@ #include "rgblight.h" #include "debug.h" #include "led_tables.h" -#include "quantum.h" #ifndef RGBLIGHT_LIMIT_VAL #define RGBLIGHT_LIMIT_VAL 255 #endif -//These conflict with a chained include that comes from including quantum.h -// #define MIN(a,b) (((a)<(b))?(a):(b)) -// #define MAX(a,b) (((a)>(b))?(a):(b)) +#define MIN(a,b) (((a)<(b))?(a):(b)) +#define MAX(a,b) (((a)>(b))?(a):(b)) __attribute__ ((weak)) const uint8_t RGBLED_BREATHING_INTERVALS[] PROGMEM = {30, 20, 10, 5}; @@ -570,6 +568,7 @@ void rgblight_show_solid_color(uint8_t r, uint8_t g, uint8_t b) { rgblight_setrgb(r, g, b); } +uint8_t typing_speed = 0; void typing_speed_decay_task() { static uint16_t decay_timer = 0; diff --git a/quantum/rgblight.h b/quantum/rgblight.h index eccbbf26bb5c..1b8fc4ad455d 100644 --- a/quantum/rgblight.h +++ b/quantum/rgblight.h @@ -89,6 +89,10 @@ extern const uint8_t RGBLED_SNAKE_INTERVALS[3] PROGMEM; extern const uint8_t RGBLED_KNIGHT_INTERVALS[3] PROGMEM; extern const uint16_t RGBLED_RGBTEST_INTERVALS[1] PROGMEM; +//Used in rgblight.c and quantum.c to match RGB animation to typing speed +extern uint8_t typing_speed; +#define TYPING_SPEED_MAX_VALUE 100 + typedef union { uint32_t raw; struct {