Re-arrange typing_speed definitions (Fixes #5) (#6)

* Re-arrange variable definitions to avoid including quantum.h from rgblight.c

* Fix a compilation error when trying to run make test:all
pull/3754/head
Chris Lewis 6 years ago committed by Chris Lewis
parent b266a92cca
commit e7fd2bc991

@ -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. */

@ -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;

@ -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;

@ -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 {

Loading…
Cancel
Save