From c1c5922aae7b60b7c7d13d3769350eed9dda17ab Mon Sep 17 00:00:00 2001 From: Chris Lewis Date: Fri, 22 Feb 2019 02:22:46 +1100 Subject: Velocikey: Match RGB animation speed to typing speed (#3754) * Draft commit of typing speed RGB control * More information in the readme * Support all RGB animation modes (Fixes #1) * Added support for all RGB light modes to use typing speed Except christmas lights because that is seizure-inducing at high speeds! * Introduced a value range specific to each RGB mode Because some modes are a little too much when running at full speed! * Update readme.md * Update readme.md * 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 * Tweaks to the typing speed decay rate * Renamed to momentum; moved implementation into dedicated files * Groundwork for toggling momentum on/off (currently always on) * Add EEPROM toggle for momentum-matching * Moved momentum out of RGBLIGHT_ENABLE toggles so it's more generic * Move momentum decay task out of rgblight_task() * Fix missing momentum.h in lufa.c * Experimental LED support (untested) * Draft commit of typing speed RGB control * More information in the readme * Support all RGB animation modes (Fixes #1) * Added support for all RGB light modes to use typing speed Except christmas lights because that is seizure-inducing at high speeds! * Introduced a value range specific to each RGB mode Because some modes are a little too much when running at full speed! * Update readme.md * Update readme.md * 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 * Tweaks to the typing speed decay rate * Renamed to momentum; moved implementation into dedicated files * Groundwork for toggling momentum on/off (currently always on) * Add EEPROM toggle for momentum-matching * Moved momentum out of RGBLIGHT_ENABLE toggles so it's more generic * Move momentum decay task out of rgblight_task() * Fix missing momentum.h in lufa.c * Added documentation * Renamed feature to velocikey * Reverted readme to original state * Correct the readme title * Updated feature name in the docs * Update EECONFIG name * Add compile-time toggles for velocikey * Update feature documentation * Revert "Merge branch 'led-support' into master" This reverts commit e123ff5febf61639b9a9020748e1c2e2313460ff, reversing changes made to df111a55b9d4929182e16108b1c0ead15b16df97. * Move velocikey EECONFIG definition to depend on VELOCIKEY_ENABLE * Rename decay_task function to decelerate * Apply suggestions from code review Co-Authored-By: chrislewisdev * Re-order eeconfig definitions * Apply coding conventions * Apply #ifdef check in lufa.c * Refactored interval time checks into one functionc * Small rename * Fix unused function error for layouts not using all rgb effects * Only update EEPROM if Velocikey is enabled * Incorporate code review feedback * Small adjustment to top-end decay rate * Add Velocikey documentation to table of contents * Bring tetris:default keymap size down by disabling audio --- tmk_core/common/eeconfig.c | 1 + tmk_core/common/eeconfig.h | 1 + tmk_core/common/keyboard.c | 7 +++++++ 3 files changed, 9 insertions(+) (limited to 'tmk_core') diff --git a/tmk_core/common/eeconfig.c b/tmk_core/common/eeconfig.c index ded27e599..9c1e3520e 100644 --- a/tmk_core/common/eeconfig.c +++ b/tmk_core/common/eeconfig.c @@ -46,6 +46,7 @@ void eeconfig_init_quantum(void) { eeprom_update_dword(EECONFIG_RGBLIGHT, 0); eeprom_update_byte(EECONFIG_STENOMODE, 0); eeprom_update_dword(EECONFIG_HAPTIC, 0); + eeprom_update_byte(EECONFIG_VELOCIKEY, 0); eeconfig_init_kb(); } diff --git a/tmk_core/common/eeconfig.h b/tmk_core/common/eeconfig.h index d576634f5..0ac3dff07 100644 --- a/tmk_core/common/eeconfig.h +++ b/tmk_core/common/eeconfig.h @@ -40,6 +40,7 @@ along with this program. If not, see . #define EECONFIG_HANDEDNESS (uint8_t *)14 #define EECONFIG_KEYBOARD (uint32_t *)15 #define EECONFIG_USER (uint32_t *)19 +#define EECONFIG_VELOCIKEY (uint8_t *)23 #define EECONFIG_HAPTIC (uint32_t*)24 diff --git a/tmk_core/common/keyboard.c b/tmk_core/common/keyboard.c index 849d74aa1..52546866e 100644 --- a/tmk_core/common/keyboard.c +++ b/tmk_core/common/keyboard.c @@ -75,6 +75,9 @@ along with this program. If not, see . #ifdef QWIIC_ENABLE # include "qwiic.h" #endif +#ifdef VELOCIKEY_ENABLE + #include "velocikey.h" +#endif #ifdef MATRIX_HAS_GHOST extern const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS]; @@ -336,6 +339,10 @@ MATRIX_LOOP_END: midi_task(); #endif +#ifdef VELOCIKEY_ENABLE + if (velocikey_enabled()) { velocikey_decelerate(); } +#endif + // update LED if (led_status != host_keyboard_leds()) { led_status = host_keyboard_leds(); -- cgit v1.2.3-24-g4f1b