forked from mfulz_github/qmk_firmware
Combined the keypresses || keyreleases define checks into a single define so I stop forgetting it where necessary
This commit is contained in:
parent
161c4b21dc
commit
74b7c3a4fb
|
@ -274,7 +274,7 @@ bool process_record_quantum(keyrecord_t *record) {
|
||||||
#ifdef HAPTIC_ENABLE
|
#ifdef HAPTIC_ENABLE
|
||||||
process_haptic(keycode, record) &&
|
process_haptic(keycode, record) &&
|
||||||
#endif //HAPTIC_ENABLE
|
#endif //HAPTIC_ENABLE
|
||||||
#if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_KEYPRESSES)
|
#if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_KEYREACTIVE_ENABLED)
|
||||||
process_rgb_matrix(keycode, record) &&
|
process_rgb_matrix(keycode, record) &&
|
||||||
#endif
|
#endif
|
||||||
process_record_kb(keycode, record) &&
|
process_record_kb(keycode, record) &&
|
||||||
|
|
|
@ -85,10 +85,10 @@ rgb_config_t rgb_matrix_config;
|
||||||
rgb_counters_t g_rgb_counters;
|
rgb_counters_t g_rgb_counters;
|
||||||
static uint32_t rgb_counters_buffer;
|
static uint32_t rgb_counters_buffer;
|
||||||
|
|
||||||
#if defined(RGB_MATRIX_KEYPRESSES) || defined(RGB_MATRIX_KEYRELEASES)
|
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||||
last_hit_t g_last_hit_tracker;
|
last_hit_t g_last_hit_tracker;
|
||||||
static last_hit_t last_hit_buffer;
|
static last_hit_t last_hit_buffer;
|
||||||
#endif // defined(RGB_MATRIX_KEYPRESSES) || defined(RGB_MATRIX_KEYRELEASES)
|
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||||
|
|
||||||
uint32_t eeconfig_read_rgb_matrix(void) {
|
uint32_t eeconfig_read_rgb_matrix(void) {
|
||||||
return eeprom_read_dword(EECONFIG_RGB_MATRIX);
|
return eeprom_read_dword(EECONFIG_RGB_MATRIX);
|
||||||
|
@ -150,7 +150,7 @@ void rgb_matrix_set_color_all( uint8_t red, uint8_t green, uint8_t blue ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool process_rgb_matrix(uint16_t keycode, keyrecord_t *record) {
|
bool process_rgb_matrix(uint16_t keycode, keyrecord_t *record) {
|
||||||
#if defined(RGB_MATRIX_KEYPRESSES) || defined(RGB_MATRIX_KEYRELEASES)
|
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||||
uint8_t led[LED_HITS_TO_REMEMBER];
|
uint8_t led[LED_HITS_TO_REMEMBER];
|
||||||
uint8_t led_count = 0;
|
uint8_t led_count = 0;
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ bool process_rgb_matrix(uint16_t keycode, keyrecord_t *record) {
|
||||||
last_hit_buffer.tick[index] = 0;
|
last_hit_buffer.tick[index] = 0;
|
||||||
last_hit_buffer.count++;
|
last_hit_buffer.count++;
|
||||||
}
|
}
|
||||||
#endif // defined(RGB_MATRIX_KEYPRESSES) || defined(RGB_MATRIX_KEYRELEASES)
|
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,7 +241,7 @@ static void rgb_task_timers(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update double buffer last hit timers
|
// Update double buffer last hit timers
|
||||||
#if defined(RGB_MATRIX_KEYPRESSES) || defined(RGB_MATRIX_KEYRELEASES)
|
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||||
uint8_t count = last_hit_buffer.count;
|
uint8_t count = last_hit_buffer.count;
|
||||||
for (uint8_t i = 0; i < count; ++i) {
|
for (uint8_t i = 0; i < count; ++i) {
|
||||||
if (UINT16_MAX - deltaTime < last_hit_buffer.tick[i]) {
|
if (UINT16_MAX - deltaTime < last_hit_buffer.tick[i]) {
|
||||||
|
@ -250,7 +250,7 @@ static void rgb_task_timers(void) {
|
||||||
}
|
}
|
||||||
last_hit_buffer.tick[i] += deltaTime;
|
last_hit_buffer.tick[i] += deltaTime;
|
||||||
}
|
}
|
||||||
#endif // defined(RGB_MATRIX_KEYPRESSES) || defined(RGB_MATRIX_KEYRELEASES)
|
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rgb_task_sync(void) {
|
static void rgb_task_sync(void) {
|
||||||
|
@ -265,9 +265,9 @@ static void rgb_task_start(void) {
|
||||||
|
|
||||||
// update double buffers
|
// update double buffers
|
||||||
g_rgb_counters.tick = rgb_counters_buffer;
|
g_rgb_counters.tick = rgb_counters_buffer;
|
||||||
#if defined(RGB_MATRIX_KEYPRESSES) || defined(RGB_MATRIX_KEYRELEASES)
|
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||||
g_last_hit_tracker = last_hit_buffer;
|
g_last_hit_tracker = last_hit_buffer;
|
||||||
#endif // defined(RGB_MATRIX_KEYPRESSES) || defined(RGB_MATRIX_KEYRELEASES)
|
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||||
|
|
||||||
// next task
|
// next task
|
||||||
rgb_task_state = RENDERING;
|
rgb_task_state = RENDERING;
|
||||||
|
@ -352,7 +352,7 @@ static void rgb_task_render(uint8_t effect) {
|
||||||
rendering = rgb_matrix_digital_rain(&rgb_effect_params); // Max 9ms Avg 8ms | this is expensive, fix it
|
rendering = rgb_matrix_digital_rain(&rgb_effect_params); // Max 9ms Avg 8ms | this is expensive, fix it
|
||||||
break;
|
break;
|
||||||
#endif // DISABLE_RGB_MATRIX_DIGITAL_RAIN
|
#endif // DISABLE_RGB_MATRIX_DIGITAL_RAIN
|
||||||
#if defined(RGB_MATRIX_KEYPRESSES) || defined(RGB_MATRIX_KEYRELEASES)
|
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||||
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE
|
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE
|
||||||
case RGB_MATRIX_SOLID_REACTIVE_SIMPLE:
|
case RGB_MATRIX_SOLID_REACTIVE_SIMPLE:
|
||||||
rendering = rgb_matrix_solid_reactive_simple(&rgb_effect_params);// Max 4ms Avg 3ms
|
rendering = rgb_matrix_solid_reactive_simple(&rgb_effect_params);// Max 4ms Avg 3ms
|
||||||
|
@ -383,7 +383,7 @@ static void rgb_task_render(uint8_t effect) {
|
||||||
rendering = rgb_matrix_solid_multisplash(&rgb_effect_params); // Max 10ms Avg 5ms
|
rendering = rgb_matrix_solid_multisplash(&rgb_effect_params); // Max 10ms Avg 5ms
|
||||||
break;
|
break;
|
||||||
#endif // DISABLE_RGB_MATRIX_SOLID_MULTISPLASH
|
#endif // DISABLE_RGB_MATRIX_SOLID_MULTISPLASH
|
||||||
#endif // defined(RGB_MATRIX_KEYPRESSES) || defined(RGB_MATRIX_KEYRELEASES)
|
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||||
|
|
||||||
// Factory default magic value
|
// Factory default magic value
|
||||||
case UINT8_MAX: {
|
case UINT8_MAX: {
|
||||||
|
@ -461,7 +461,7 @@ void rgb_matrix_init(void) {
|
||||||
|
|
||||||
// TODO: put the 1 second startup delay here?
|
// TODO: put the 1 second startup delay here?
|
||||||
|
|
||||||
#if defined(RGB_MATRIX_KEYPRESSES) || defined(RGB_MATRIX_KEYRELEASES)
|
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||||
g_last_hit_tracker.count = 0;
|
g_last_hit_tracker.count = 0;
|
||||||
for (uint8_t i = 0; i < LED_HITS_TO_REMEMBER; ++i) {
|
for (uint8_t i = 0; i < LED_HITS_TO_REMEMBER; ++i) {
|
||||||
g_last_hit_tracker.tick[i] = UINT16_MAX;
|
g_last_hit_tracker.tick[i] = UINT16_MAX;
|
||||||
|
@ -471,7 +471,7 @@ void rgb_matrix_init(void) {
|
||||||
for (uint8_t i = 0; i < LED_HITS_TO_REMEMBER; ++i) {
|
for (uint8_t i = 0; i < LED_HITS_TO_REMEMBER; ++i) {
|
||||||
last_hit_buffer.tick[i] = UINT16_MAX;
|
last_hit_buffer.tick[i] = UINT16_MAX;
|
||||||
}
|
}
|
||||||
#endif
|
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||||
|
|
||||||
if (!eeconfig_is_enabled()) {
|
if (!eeconfig_is_enabled()) {
|
||||||
dprintf("rgb_matrix_init_drivers eeconfig is not enabled.\n");
|
dprintf("rgb_matrix_init_drivers eeconfig is not enabled.\n");
|
||||||
|
|
|
@ -39,6 +39,10 @@
|
||||||
#define RGB_MATRIX_LED_PROCESS_LIMIT (DRIVER_LED_TOTAL + 4) / 5
|
#define RGB_MATRIX_LED_PROCESS_LIMIT (DRIVER_LED_TOTAL + 4) / 5
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(RGB_MATRIX_KEYPRESSES) || defined(RGB_MATRIX_KEYRELEASES)
|
||||||
|
#define RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(RGB_MATRIX_LED_PROCESS_LIMIT) && RGB_MATRIX_LED_PROCESS_LIMIT > 0 && RGB_MATRIX_LED_PROCESS_LIMIT < DRIVER_LED_TOTAL
|
#if defined(RGB_MATRIX_LED_PROCESS_LIMIT) && RGB_MATRIX_LED_PROCESS_LIMIT > 0 && RGB_MATRIX_LED_PROCESS_LIMIT < DRIVER_LED_TOTAL
|
||||||
#define RGB_MATRIX_USE_LIMITS(min, max) uint8_t min = RGB_MATRIX_LED_PROCESS_LIMIT * params->iter; \
|
#define RGB_MATRIX_USE_LIMITS(min, max) uint8_t min = RGB_MATRIX_LED_PROCESS_LIMIT * params->iter; \
|
||||||
uint8_t max = min + RGB_MATRIX_LED_PROCESS_LIMIT; \
|
uint8_t max = min + RGB_MATRIX_LED_PROCESS_LIMIT; \
|
||||||
|
@ -99,7 +103,7 @@ enum rgb_matrix_effects {
|
||||||
#ifndef DISABLE_RGB_MATRIX_DIGITAL_RAIN
|
#ifndef DISABLE_RGB_MATRIX_DIGITAL_RAIN
|
||||||
RGB_MATRIX_DIGITAL_RAIN,
|
RGB_MATRIX_DIGITAL_RAIN,
|
||||||
#endif // DISABLE_RGB_MATRIX_DIGITAL_RAIN
|
#endif // DISABLE_RGB_MATRIX_DIGITAL_RAIN
|
||||||
#if defined(RGB_MATRIX_KEYPRESSES) || defined(RGB_MATRIX_KEYRELEASES)
|
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||||
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE
|
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE
|
||||||
RGB_MATRIX_SOLID_REACTIVE_SIMPLE,
|
RGB_MATRIX_SOLID_REACTIVE_SIMPLE,
|
||||||
#endif // DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE
|
#endif // DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE
|
||||||
|
@ -118,7 +122,7 @@ enum rgb_matrix_effects {
|
||||||
#ifndef DISABLE_RGB_MATRIX_SOLID_MULTISPLASH
|
#ifndef DISABLE_RGB_MATRIX_SOLID_MULTISPLASH
|
||||||
RGB_MATRIX_SOLID_MULTISPLASH,
|
RGB_MATRIX_SOLID_MULTISPLASH,
|
||||||
#endif // DISABLE_RGB_MATRIX_SOLID_MULTISPLASH
|
#endif // DISABLE_RGB_MATRIX_SOLID_MULTISPLASH
|
||||||
#endif // defined(RGB_MATRIX_KEYPRESSES) || defined(RGB_MATRIX_KEYRELEASES)
|
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||||
RGB_MATRIX_EFFECT_MAX
|
RGB_MATRIX_EFFECT_MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#ifdef RGB_MATRIX_KEYPRESSES
|
#if defined(RGB_MATRIX_KEYREACTIVE_ENABLED)
|
||||||
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE
|
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE
|
||||||
|
|
||||||
extern rgb_config_t rgb_matrix_config;
|
extern rgb_config_t rgb_matrix_config;
|
||||||
|
@ -30,4 +30,4 @@ bool rgb_matrix_solid_reactive(effect_params_t* params) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON
|
#endif // DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON
|
||||||
#endif // RGB_MATRIX_KEYPRESSES
|
#endif // defined(RGB_MATRIX_KEYREACTIVE_ENABLED)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#ifdef RGB_MATRIX_KEYPRESSES
|
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||||
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE
|
#ifndef DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE
|
||||||
|
|
||||||
extern rgb_config_t rgb_matrix_config;
|
extern rgb_config_t rgb_matrix_config;
|
||||||
|
@ -29,4 +29,4 @@ bool rgb_matrix_solid_reactive_simple(effect_params_t* params) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE
|
#endif // DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE
|
||||||
#endif // RGB_MATRIX_KEYPRESSES
|
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#ifdef RGB_MATRIX_KEYPRESSES
|
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||||
#if !defined(DISABLE_RGB_MATRIX_SOLID_SPLASH) || !defined(DISABLE_RGB_MATRIX_SOLID_MULTISPLASH)
|
#if !defined(DISABLE_RGB_MATRIX_SOLID_SPLASH) || !defined(DISABLE_RGB_MATRIX_SOLID_MULTISPLASH)
|
||||||
|
|
||||||
extern const rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
extern const rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
||||||
|
@ -39,4 +39,4 @@ bool rgb_matrix_solid_splash(effect_params_t* params) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // !defined(DISABLE_RGB_MATRIX_SPLASH) && !defined(DISABLE_RGB_MATRIX_MULTISPLASH)
|
#endif // !defined(DISABLE_RGB_MATRIX_SPLASH) && !defined(DISABLE_RGB_MATRIX_MULTISPLASH)
|
||||||
#endif // RGB_MATRIX_KEYPRESSES
|
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#ifdef RGB_MATRIX_KEYPRESSES
|
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||||
#if !defined(DISABLE_RGB_MATRIX_SPLASH) || !defined(DISABLE_RGB_MATRIX_MULTISPLASH)
|
#if !defined(DISABLE_RGB_MATRIX_SPLASH) || !defined(DISABLE_RGB_MATRIX_MULTISPLASH)
|
||||||
|
|
||||||
extern const rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
extern const rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
||||||
|
@ -41,4 +41,4 @@ bool rgb_matrix_splash(effect_params_t* params) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // !defined(DISABLE_RGB_MATRIX_SPLASH) || !defined(DISABLE_RGB_MATRIX_MULTISPLASH)
|
#endif // !defined(DISABLE_RGB_MATRIX_SPLASH) || !defined(DISABLE_RGB_MATRIX_MULTISPLASH)
|
||||||
#endif // RGB_MATRIX_KEYPRESSES
|
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#define LED_HITS_TO_REMEMBER 8
|
#define LED_HITS_TO_REMEMBER 8
|
||||||
#endif // LED_HITS_TO_REMEMBER
|
#endif // LED_HITS_TO_REMEMBER
|
||||||
|
|
||||||
#if defined(RGB_MATRIX_KEYPRESSES) || defined(RGB_MATRIX_KEYRELEASES)
|
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||||
typedef struct PACKED {
|
typedef struct PACKED {
|
||||||
uint8_t count;
|
uint8_t count;
|
||||||
uint8_t x[LED_HITS_TO_REMEMBER];
|
uint8_t x[LED_HITS_TO_REMEMBER];
|
||||||
|
@ -26,7 +26,7 @@ typedef struct PACKED {
|
||||||
uint8_t index[LED_HITS_TO_REMEMBER];
|
uint8_t index[LED_HITS_TO_REMEMBER];
|
||||||
uint16_t tick[LED_HITS_TO_REMEMBER];
|
uint16_t tick[LED_HITS_TO_REMEMBER];
|
||||||
} last_hit_t;
|
} last_hit_t;
|
||||||
#endif // defined(RGB_MATRIX_KEYPRESSES) || defined(RGB_MATRIX_KEYRELEASES)
|
#endif // RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||||
|
|
||||||
typedef enum rgb_task_states {
|
typedef enum rgb_task_states {
|
||||||
STARTING,
|
STARTING,
|
||||||
|
|
Loading…
Reference in New Issue