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 --- quantum/quantum.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'quantum/quantum.c') diff --git a/quantum/quantum.c b/quantum/quantum.c index cb4d5ee80..46d404029 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c @@ -47,6 +47,10 @@ extern backlight_config_t backlight_config; #include "process_midi.h" #endif +#ifdef VELOCIKEY_ENABLE +#include "velocikey.h" +#endif + #ifdef HAPTIC_ENABLE #include "haptic.h" #endif @@ -251,6 +255,10 @@ bool process_record_quantum(keyrecord_t *record) { // return false; // } + #ifdef VELOCIKEY_ENABLE + if (velocikey_enabled() && record->event.pressed) { velocikey_accelerate(); } + #endif + #ifdef TAP_DANCE_ENABLE preprocess_tap_dance(keycode, record); #endif @@ -568,7 +576,14 @@ bool process_record_quantum(keyrecord_t *record) { #endif return false; #endif // defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE) - #ifdef PROTOCOL_LUFA + #ifdef VELOCIKEY_ENABLE + case VLK_TOG: + if (record->event.pressed) { + velocikey_toggle(); + } + return false; + #endif + #ifdef PROTOCOL_LUFA case OUT_AUTO: if (record->event.pressed) { set_output(OUTPUT_AUTO); -- cgit v1.2.3-24-g4f1b