You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

553 lines
16 KiB

Change split_common to use RGBLIGHT_SPLIT (#5509) * add I2C_slave_buffer_t to quantum/split_common/transport.c Improvements to ease the maintenance of the I2C slave buffer layout. And this commit does not change the compilation results. * add temporary pdhelix(Patched Helix) code * temporary cherry-pick from #5020 add new version(#5020) quantum/rgblight.[ch], quantum/rgblight_modes.h * add post_config.h support to build_keyboard.mk * add quantum/rgblight_post_config.h, quantum/split_common/post_config.h Add quantum/rgblight_post_config.h and quantum/split_common/post_config.h using POST_CONFIG_H variable of build_keyboard.mk. quantum/rgblight_post_config.h additionally defines RGBLIGHT_SPLIT if RGBLED_SPIT is defined. quantum/split_common/post_config.h defines RGBLIGHT_SPLIT additionally when master-slave communication is I2C. * Change split_common's transport.c I2C to use the synchronization feature of rgblight.c * Change split_common's transport.c serial to use the synchronization feature of rgblight.c * test RGBLIGHT_SPLIT on keyboards/handwired/pdhelix * Test End Revert "test RGBLIGHT_SPLIT on keyboards/handwired/pdhelix" This reverts commit 80118a6bbd3d9fc4c7797fef0c34bc67aa73aa98. [x] make RGBLIGHT_TEST=1 handwired/pdhelix/i2c:default [x] make RGBLIGHT_TEST=2 handwired/pdhelix/i2c:default (same RGBLIGHT_TEST=3) [x] make RGBLIGHT_TEST=3 handwired/pdhelix/i2c:default [x] make RGBLIGHT_TEST=1 handwired/pdhelix/pd2:default [x] make RGBLIGHT_TEST=2 handwired/pdhelix/pd2:default [x] make RGBLIGHT_TEST=3 handwired/pdhelix/pd2:default [x] make RGBLIGHT_TEST=1 handwired/pdhelix/pd2_2oled:default [x] make RGBLIGHT_TEST=2 handwired/pdhelix/pd2_2oled:default [x] make RGBLIGHT_TEST=3 handwired/pdhelix/pd2_2oled:default * Test End, Revert "temporary cherry-pick from #5020" This reverts commit d35069f68bda0c50370442a5c7aae60c2f4ce5c0. * Test End, Revert "add temporary pdhelix(Patched Helix) code" This reverts commit aebddfc1a879796afae297ef0723a4fe73af3660. * temporarily cherry-pick from #5020 to see if it passes the travis-ci test. add new version(#5020) quantum/rgblight.[ch], quantum/rgblight_modes.h * Passed the travis-ci test. Revert "temporarily cherry-pick from #5020 to see if it passes the travis-ci test." This reverts commit 647c0a9755eb6a05f76d09b2d59bce67b85a841f. * update docs/config_options.md * update split_common/transport.c, improves maintainability of serial transaction IDs. No change in build result. * temporary cherry-pick from #5020 * fix build fail keebio/iris/rev3:default * fix build fail lets_split_eh/eh:default * Revert "temporary cherry-pick from #5020" This reverts commit be48ca1b4515366a097af8dd1cd7b28b7ee09947. * temporary cherry-pick from #5020 (0.6.336) * Revert "temporary cherry-pick from #5020 (0.6.336)" This reverts commit 978d26a8b3cf0acc485838a7d76d6128b77c630c. * temporary cherry-pick from #5020 (0.6.336)
5 years ago
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 <chris@chrislewisdev.com> * 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
5 years ago
Zeal60/Zeal65/M60-A implementation (#3879) * Initial version of zeal60 * WIP * Fixes issue #900 * Adding RGB underglow functionality. Fixed a compile-time conflict caused by enabling RGB underglow functionality. * Refactor RPC protocol * Fix last merge * README for RGB underglow updated. * Additional README changes. * Adding RGBW strip software-based current-limiting functionality. * RGBW current-limiting functionality should be handled by RGBSTRIP_MAX_CURRENT_PER_LIGHT instead. * Updated README to reflect implementation of built-in current limiting. * Keymap readability improvements. * Minor keymap improvements. * Fixed LED driver init sequence, formatting * Dimming implementation tested, working. * Stab LEDs synced with spacebar hits in effects. * RGB underglow tested and functional. Simplified README for RGB underglow. * Undid accidental file deletion from previous merge conflict. Safer values for RGB underglow. * Improved arrow key positions in keymap. * Added functionality to correct uneven RGB underglow. Refactored related code. * Reverted to safer values for underglow. * Changes for v0.3 * Custom LED brightness scaling will take place after current adjustment in order to avoid being overridden. * Create keymap.c Added split backspace and split shift to ISO layout * Create config.h Turned on LEDs for new layout * Fixed bug where left spacebar stabilizer LED (LC06) would adopt color of row above. * Added hhkb_wilba keymap * Update keymap.c * Update keymap.c * Update keymap.c * Added indicators, full param setting via host * Added "mousekey" layout * Added Zeal65 support, factory test mode * Keycode safe range changed, caused bugs * Bumped EEPROM version due to change in QMK keycodes * Disable HHKB "blocked" LEDs if KC_NO in keymap * Added "disable_hhkb_blocker_leds" * Required overridden function for keymaps in EEPROM * Added polar coordinate mapping, effect speed * Force Raw HID interface number to 1 always * Fixed last merge from master * Added effect speed to default keymaps * add BACKLIGHT_ prefix to vars * add BACKLIGHT_ prefix to vars * Keymap speed effect; keymap improvements/fixes Readme updated to match changes * Refactored to use common IS31FL3731/I2C drivers * Fixed make rules, backlight disabled feature * Make split rightshift default for Zeal65 * Added M60-A as a "version" of Zeal60. * Renamed IS31FL3731 driver functions * Fix suspend_wakeup_init_kb() being defined twice * First pass refactor dynamic keymaps * Updated to changed I2C and ISSI drivers * Refactor zeal_color.* usage to quantum/color.* * Updated Zeal65, fixed dynamic_keymap * Major refactoring of Zeal60 backlight and API * Lots of little cleanups * Added readme.md * Added readme.md * Added LAYOUT_60*() macros, refactored and cleaned up default keymaps * Fix compile error in suspend.c * Added Zeal65 LAYOUT macros, info.json * Added rama/m60_a, deleted zeal60/keymaps/m60_a * Fixed rama/m60_a/keymaps/proto * Fixed compilation error for suspend.c * Requested changes for PR * Fixed readme.md images * Another readme.md fix * Added drashna's requested changes
5 years ago
Simplify split_common Code significantly (#4772) * Eliminate separate slave loop Both master and slave run the standard keyboard_task main loop now. * Refactor i2c/serial specific code Simplify some of the preprocessor mess by using common function names. * Fix missing #endif * Move direct pin mapping support from miniaxe to split_common For boards with more pins than sense--sorry, switches. * Reordering and reformatting only * Don't run matrix_scan_quantum on slave side * Clean up the offset/slaveOffset calculations * Cut undebounced matrix size in half * Refactor debouncing * Minor fixups * Split split_common transport and debounce code into their own files Can now be replaced with custom versions per keyboard using CUSTOM_TRANSPORT = yes and CUSTOM_DEBOUNCE = yes * Refactor debounce for non-split keyboards too * Update handwired/xealous to build using new split_common * Fix debounce breaking basic test * Dodgy method to allow a split kb to only include one of i2c/serial SPLIT_TRANSPORT = serial or SPLIT_TRANSPORT = i2c will include only that driver code in the binary. SPLIT_TRANSPORT = custom (or anything else) will include neither, the keyboard must supply it's own code if SPLIT_TRANSPORT is not defined then the original behaviour (include both avr i2c and serial code) is maintained. This could be better but it would require explicitly updating all the existing split keyboards. * Enable LTO to get lets_split/sockets under the line * Add docs for SPLIT_TRANSPORT, CUSTOM_MATRIX, CUSTOM_DEBOUNCE * Remove avr-specific sei() from split matrix_setup Not needed now that slave doesn't have a separate main loop. Both sides (on avr) call sei() in lufa's main() after exiting keyboard_setup(). * Fix QUANTUM_LIB_SRC references and simplify SPLIT_TRANSPORT. * Add comments and fix formatting.
5 years ago
Simplify split_common Code significantly (#4772) * Eliminate separate slave loop Both master and slave run the standard keyboard_task main loop now. * Refactor i2c/serial specific code Simplify some of the preprocessor mess by using common function names. * Fix missing #endif * Move direct pin mapping support from miniaxe to split_common For boards with more pins than sense--sorry, switches. * Reordering and reformatting only * Don't run matrix_scan_quantum on slave side * Clean up the offset/slaveOffset calculations * Cut undebounced matrix size in half * Refactor debouncing * Minor fixups * Split split_common transport and debounce code into their own files Can now be replaced with custom versions per keyboard using CUSTOM_TRANSPORT = yes and CUSTOM_DEBOUNCE = yes * Refactor debounce for non-split keyboards too * Update handwired/xealous to build using new split_common * Fix debounce breaking basic test * Dodgy method to allow a split kb to only include one of i2c/serial SPLIT_TRANSPORT = serial or SPLIT_TRANSPORT = i2c will include only that driver code in the binary. SPLIT_TRANSPORT = custom (or anything else) will include neither, the keyboard must supply it's own code if SPLIT_TRANSPORT is not defined then the original behaviour (include both avr i2c and serial code) is maintained. This could be better but it would require explicitly updating all the existing split keyboards. * Enable LTO to get lets_split/sockets under the line * Add docs for SPLIT_TRANSPORT, CUSTOM_MATRIX, CUSTOM_DEBOUNCE * Remove avr-specific sei() from split matrix_setup Not needed now that slave doesn't have a separate main loop. Both sides (on avr) call sei() in lufa's main() after exiting keyboard_setup(). * Fix QUANTUM_LIB_SRC references and simplify SPLIT_TRANSPORT. * Add comments and fix formatting.
5 years ago
Simplify split_common Code significantly (#4772) * Eliminate separate slave loop Both master and slave run the standard keyboard_task main loop now. * Refactor i2c/serial specific code Simplify some of the preprocessor mess by using common function names. * Fix missing #endif * Move direct pin mapping support from miniaxe to split_common For boards with more pins than sense--sorry, switches. * Reordering and reformatting only * Don't run matrix_scan_quantum on slave side * Clean up the offset/slaveOffset calculations * Cut undebounced matrix size in half * Refactor debouncing * Minor fixups * Split split_common transport and debounce code into their own files Can now be replaced with custom versions per keyboard using CUSTOM_TRANSPORT = yes and CUSTOM_DEBOUNCE = yes * Refactor debounce for non-split keyboards too * Update handwired/xealous to build using new split_common * Fix debounce breaking basic test * Dodgy method to allow a split kb to only include one of i2c/serial SPLIT_TRANSPORT = serial or SPLIT_TRANSPORT = i2c will include only that driver code in the binary. SPLIT_TRANSPORT = custom (or anything else) will include neither, the keyboard must supply it's own code if SPLIT_TRANSPORT is not defined then the original behaviour (include both avr i2c and serial code) is maintained. This could be better but it would require explicitly updating all the existing split keyboards. * Enable LTO to get lets_split/sockets under the line * Add docs for SPLIT_TRANSPORT, CUSTOM_MATRIX, CUSTOM_DEBOUNCE * Remove avr-specific sei() from split matrix_setup Not needed now that slave doesn't have a separate main loop. Both sides (on avr) call sei() in lufa's main() after exiting keyboard_setup(). * Fix QUANTUM_LIB_SRC references and simplify SPLIT_TRANSPORT. * Add comments and fix formatting.
5 years ago
Change split_common to use RGBLIGHT_SPLIT (#5509) * add I2C_slave_buffer_t to quantum/split_common/transport.c Improvements to ease the maintenance of the I2C slave buffer layout. And this commit does not change the compilation results. * add temporary pdhelix(Patched Helix) code * temporary cherry-pick from #5020 add new version(#5020) quantum/rgblight.[ch], quantum/rgblight_modes.h * add post_config.h support to build_keyboard.mk * add quantum/rgblight_post_config.h, quantum/split_common/post_config.h Add quantum/rgblight_post_config.h and quantum/split_common/post_config.h using POST_CONFIG_H variable of build_keyboard.mk. quantum/rgblight_post_config.h additionally defines RGBLIGHT_SPLIT if RGBLED_SPIT is defined. quantum/split_common/post_config.h defines RGBLIGHT_SPLIT additionally when master-slave communication is I2C. * Change split_common's transport.c I2C to use the synchronization feature of rgblight.c * Change split_common's transport.c serial to use the synchronization feature of rgblight.c * test RGBLIGHT_SPLIT on keyboards/handwired/pdhelix * Test End Revert "test RGBLIGHT_SPLIT on keyboards/handwired/pdhelix" This reverts commit 80118a6bbd3d9fc4c7797fef0c34bc67aa73aa98. [x] make RGBLIGHT_TEST=1 handwired/pdhelix/i2c:default [x] make RGBLIGHT_TEST=2 handwired/pdhelix/i2c:default (same RGBLIGHT_TEST=3) [x] make RGBLIGHT_TEST=3 handwired/pdhelix/i2c:default [x] make RGBLIGHT_TEST=1 handwired/pdhelix/pd2:default [x] make RGBLIGHT_TEST=2 handwired/pdhelix/pd2:default [x] make RGBLIGHT_TEST=3 handwired/pdhelix/pd2:default [x] make RGBLIGHT_TEST=1 handwired/pdhelix/pd2_2oled:default [x] make RGBLIGHT_TEST=2 handwired/pdhelix/pd2_2oled:default [x] make RGBLIGHT_TEST=3 handwired/pdhelix/pd2_2oled:default * Test End, Revert "temporary cherry-pick from #5020" This reverts commit d35069f68bda0c50370442a5c7aae60c2f4ce5c0. * Test End, Revert "add temporary pdhelix(Patched Helix) code" This reverts commit aebddfc1a879796afae297ef0723a4fe73af3660. * temporarily cherry-pick from #5020 to see if it passes the travis-ci test. add new version(#5020) quantum/rgblight.[ch], quantum/rgblight_modes.h * Passed the travis-ci test. Revert "temporarily cherry-pick from #5020 to see if it passes the travis-ci test." This reverts commit 647c0a9755eb6a05f76d09b2d59bce67b85a841f. * update docs/config_options.md * update split_common/transport.c, improves maintainability of serial transaction IDs. No change in build result. * temporary cherry-pick from #5020 * fix build fail keebio/iris/rev3:default * fix build fail lets_split_eh/eh:default * Revert "temporary cherry-pick from #5020" This reverts commit be48ca1b4515366a097af8dd1cd7b28b7ee09947. * temporary cherry-pick from #5020 (0.6.336) * Revert "temporary cherry-pick from #5020 (0.6.336)" This reverts commit 978d26a8b3cf0acc485838a7d76d6128b77c630c. * temporary cherry-pick from #5020 (0.6.336)
5 years ago
Lets split eh (#3120) * Line ending stuff again * Added Let's Split Eh? Files and updated #USE_IC2 checks to also include th EH revision (can only be used in I2C) * Added personal keymap, updated some of the EH files * Created new keyboard file for testing "lets_split_eh" will merge into lets_split once fully functional * Added split code from lets_split, removed pro micro imports and LED code THIS IS WORKING CODE, WITHOUT RGB AND BACKLIGHT * Took back original Lets Slit files for the lets_split keyboard, working in the lets_split_eh folder for now * Updated eh.c * More rework of the I2C code, added global flags for split boards. * Introduced RGB over I2C, having weird edge case issues at the moment though * Fixed weird I2C edgecase with RGB, although still would like to track down route cause.. * Changed RGB keycodes (static ones) to activate on key-up instead of key-down to elimate weird ghosting issue over I2C * Lots of changes, mainly externalized the Split keyboard code and added logic for only including when needed. - Added makefile option "SPLIT_KEYBOARD" that when = yes will include the split keyboard files and custom matrix - Split keyboard files placed into quantum/split_common/ - Added define option for config files "SPLIT_HAND_PIN" FOr using high/low pin to determine handedness, low = right hand, high = left hand - Cleaned up split logic for RGB and Backlight so it is only exectuted / included when needed * Updated documentation for the new makefile options and #defines specific to split keyboards * Added a bit more info to docs, so people aren't confused * Modifed Let's Split to use externalized code, also added left and right hand eeprom files to the split_common folder * Removed some debugging from eh.c * Small changes to keyboard configs. Also added a default keymap (just a copy of my that_canadian keymap). * Added a README file to the Let's Split Eh? * Changed it so RGB static updates are done on key-up ONLY for split boards rather than all boards. Also fixed leftover un-used variable in rgblight.c * Updated default keymap and my keymap for Let's Split Eh? Updated the comments so it reflects RGB control, and removed audio functions. * Fixed lets_split_eh not having a default version * Removed "eh" references from lets_split folder for now * Took lets_split folder from master to fix travis build errors, weird my local was overriding. * Changed LAYOUT_ortho_4x12_kc -> LAYOUT_kc_ortho_4x12 to match bakingpy and others * Removed rules.mk from my lets_split keymap, not needed * Updated the config_options doc to better explain the usage of "#define SPLIT_HAND_PIN"
5 years ago
Simplify split_common Code significantly (#4772) * Eliminate separate slave loop Both master and slave run the standard keyboard_task main loop now. * Refactor i2c/serial specific code Simplify some of the preprocessor mess by using common function names. * Fix missing #endif * Move direct pin mapping support from miniaxe to split_common For boards with more pins than sense--sorry, switches. * Reordering and reformatting only * Don't run matrix_scan_quantum on slave side * Clean up the offset/slaveOffset calculations * Cut undebounced matrix size in half * Refactor debouncing * Minor fixups * Split split_common transport and debounce code into their own files Can now be replaced with custom versions per keyboard using CUSTOM_TRANSPORT = yes and CUSTOM_DEBOUNCE = yes * Refactor debounce for non-split keyboards too * Update handwired/xealous to build using new split_common * Fix debounce breaking basic test * Dodgy method to allow a split kb to only include one of i2c/serial SPLIT_TRANSPORT = serial or SPLIT_TRANSPORT = i2c will include only that driver code in the binary. SPLIT_TRANSPORT = custom (or anything else) will include neither, the keyboard must supply it's own code if SPLIT_TRANSPORT is not defined then the original behaviour (include both avr i2c and serial code) is maintained. This could be better but it would require explicitly updating all the existing split keyboards. * Enable LTO to get lets_split/sockets under the line * Add docs for SPLIT_TRANSPORT, CUSTOM_MATRIX, CUSTOM_DEBOUNCE * Remove avr-specific sei() from split matrix_setup Not needed now that slave doesn't have a separate main loop. Both sides (on avr) call sei() in lufa's main() after exiting keyboard_setup(). * Fix QUANTUM_LIB_SRC references and simplify SPLIT_TRANSPORT. * Add comments and fix formatting.
5 years ago
Simplify split_common Code significantly (#4772) * Eliminate separate slave loop Both master and slave run the standard keyboard_task main loop now. * Refactor i2c/serial specific code Simplify some of the preprocessor mess by using common function names. * Fix missing #endif * Move direct pin mapping support from miniaxe to split_common For boards with more pins than sense--sorry, switches. * Reordering and reformatting only * Don't run matrix_scan_quantum on slave side * Clean up the offset/slaveOffset calculations * Cut undebounced matrix size in half * Refactor debouncing * Minor fixups * Split split_common transport and debounce code into their own files Can now be replaced with custom versions per keyboard using CUSTOM_TRANSPORT = yes and CUSTOM_DEBOUNCE = yes * Refactor debounce for non-split keyboards too * Update handwired/xealous to build using new split_common * Fix debounce breaking basic test * Dodgy method to allow a split kb to only include one of i2c/serial SPLIT_TRANSPORT = serial or SPLIT_TRANSPORT = i2c will include only that driver code in the binary. SPLIT_TRANSPORT = custom (or anything else) will include neither, the keyboard must supply it's own code if SPLIT_TRANSPORT is not defined then the original behaviour (include both avr i2c and serial code) is maintained. This could be better but it would require explicitly updating all the existing split keyboards. * Enable LTO to get lets_split/sockets under the line * Add docs for SPLIT_TRANSPORT, CUSTOM_MATRIX, CUSTOM_DEBOUNCE * Remove avr-specific sei() from split matrix_setup Not needed now that slave doesn't have a separate main loop. Both sides (on avr) call sei() in lufa's main() after exiting keyboard_setup(). * Fix QUANTUM_LIB_SRC references and simplify SPLIT_TRANSPORT. * Add comments and fix formatting.
5 years ago
Simplify split_common Code significantly (#4772) * Eliminate separate slave loop Both master and slave run the standard keyboard_task main loop now. * Refactor i2c/serial specific code Simplify some of the preprocessor mess by using common function names. * Fix missing #endif * Move direct pin mapping support from miniaxe to split_common For boards with more pins than sense--sorry, switches. * Reordering and reformatting only * Don't run matrix_scan_quantum on slave side * Clean up the offset/slaveOffset calculations * Cut undebounced matrix size in half * Refactor debouncing * Minor fixups * Split split_common transport and debounce code into their own files Can now be replaced with custom versions per keyboard using CUSTOM_TRANSPORT = yes and CUSTOM_DEBOUNCE = yes * Refactor debounce for non-split keyboards too * Update handwired/xealous to build using new split_common * Fix debounce breaking basic test * Dodgy method to allow a split kb to only include one of i2c/serial SPLIT_TRANSPORT = serial or SPLIT_TRANSPORT = i2c will include only that driver code in the binary. SPLIT_TRANSPORT = custom (or anything else) will include neither, the keyboard must supply it's own code if SPLIT_TRANSPORT is not defined then the original behaviour (include both avr i2c and serial code) is maintained. This could be better but it would require explicitly updating all the existing split keyboards. * Enable LTO to get lets_split/sockets under the line * Add docs for SPLIT_TRANSPORT, CUSTOM_MATRIX, CUSTOM_DEBOUNCE * Remove avr-specific sei() from split matrix_setup Not needed now that slave doesn't have a separate main loop. Both sides (on avr) call sei() in lufa's main() after exiting keyboard_setup(). * Fix QUANTUM_LIB_SRC references and simplify SPLIT_TRANSPORT. * Add comments and fix formatting.
5 years ago
Hid joystick interface (#4226) * add support for hid gamepad interface add documentation for HID joystick Add joystick_task to read analog axes values even when no key is pressed or release. update doc Update docs/feature_joystick.md Manage pin setup and read to maintain matrix scan after analog read * Incorporates patches and changes to HID reporting There are some patches provided by @a-chol incorporated on this commit, and also some changes I made to the HID Report structure. The most interesting is the one dealing with number of buttons: Linux doesn't seem to care, but Windows requires the HID structure to be byte aligned (that's in the spec). So if one declares 8/16/32... buttons they should not have any issues, but this is what happens when you have 9 buttons: ``` bits |0|1|2|3|4|5|6|7| |*|*|*|*|*|*|*|*| axis 0 (report size 8) |*|*|*|*|*|*|*|*| ... |*|*|*|*|*|*|*|*| |*|*|*|*|*|*|*|*| |*|*|*|*|*|*|*|*| |*|*|*|*|*|*|*|*| |*|*|*|*|*|*|*|*| axis 6 |*|*|*|*|*|*|*|*| first 8 buttons (report size 1) |*| | | | | | | | last of 9 buttons, not aligned ``` So for that I added a conditonal that will add a number of reports with size 1 to make sure it aligns to the next multiple of 8. Those reports send dummy inputs that don't do anything aside from aligning the data. Tested on Linux, Windows 10 and Street Fighter (where the joystick is recognized as direct-input) * Add save and restore of each pin used in reading joystick (AVR). Allow output pin to be JS_VIRTUAL_AXIS if the axis is connected to Vcc instead of an output pin from the MCU. Fix joystick report id Fix broken v-usb hid joystick interface. Make it more resilient to unusual settings (none multiple of eight button count, 0 buttons or 0 axes) Correct adc reading for multiple axes. Piecewise range conversion for uncentered raw value range. Input, output and ground pin configuration per axis. Documentation fixes * Fix port addressing for joystick analog read * The other required set of changes As per the PR, the changes still holding it up. Add onekey for testing. Fix ARM builds. Fix device descriptor when either axes or buttons is zero. Add compile-time check for at least one axis or button. Move definition to try to fix conflict. PR review comments. qmk cformat * avoid float functions to compute range mapping for axis adc reading * Remove V-USB support for now. Updated docs accordingly. * Update tmk_core/protocol/lufa/lufa.c Co-Authored-By: Ryan <fauxpark@gmail.com> * Update tmk_core/protocol/usb_descriptor.c Co-Authored-By: Ryan <fauxpark@gmail.com> * Update tmk_core/protocol/usb_descriptor.c Co-Authored-By: Ryan <fauxpark@gmail.com> * Update tmk_core/protocol/usb_descriptor.c Co-Authored-By: Ryan <fauxpark@gmail.com> * Add support for joystick adc reading for stm32 MCUs. Fix joystick hid report sending for chibios * Fix HID joystick report sending for ChibiOS. Add one analog axis to the onekey:joystick keymap. Fix pin state save and restore during joystick analog read for STM32 MCUs. * Update tmk_core/protocol/chibios/usb_main.c Co-Authored-By: Ryan <fauxpark@gmail.com> * Update tmk_core/protocol/lufa/lufa.c Co-Authored-By: Ryan <fauxpark@gmail.com> * Add missing mcuconf.h and halconf.h to onekey:joystick keymap. Add suggested fixes from PR. * Switch saveState and restoreState signature to use pin_t type. onekey:joystick : add a second axis, virtual and programmatically animated. * Update docs/feature_joystick.md Co-Authored-By: Ryan <fauxpark@gmail.com> * Update docs/feature_joystick.md Co-Authored-By: Ryan <fauxpark@gmail.com> * Add PR corrections * Remove halconf.h and mcuconf.h from onekey keymaps * Change ADC_PIN to A0 Co-authored-by: achol <allecooll@hotmail.com> Co-authored-by: José Júnior <jose.junior@gmail.com> Co-authored-by: a-chol <achol@notamail.com> Co-authored-by: Nick Brassel <nick@tzarc.org> Co-authored-by: Ryan <fauxpark@gmail.com>
3 years ago
Hid joystick interface (#4226) * add support for hid gamepad interface add documentation for HID joystick Add joystick_task to read analog axes values even when no key is pressed or release. update doc Update docs/feature_joystick.md Manage pin setup and read to maintain matrix scan after analog read * Incorporates patches and changes to HID reporting There are some patches provided by @a-chol incorporated on this commit, and also some changes I made to the HID Report structure. The most interesting is the one dealing with number of buttons: Linux doesn't seem to care, but Windows requires the HID structure to be byte aligned (that's in the spec). So if one declares 8/16/32... buttons they should not have any issues, but this is what happens when you have 9 buttons: ``` bits |0|1|2|3|4|5|6|7| |*|*|*|*|*|*|*|*| axis 0 (report size 8) |*|*|*|*|*|*|*|*| ... |*|*|*|*|*|*|*|*| |*|*|*|*|*|*|*|*| |*|*|*|*|*|*|*|*| |*|*|*|*|*|*|*|*| |*|*|*|*|*|*|*|*| axis 6 |*|*|*|*|*|*|*|*| first 8 buttons (report size 1) |*| | | | | | | | last of 9 buttons, not aligned ``` So for that I added a conditonal that will add a number of reports with size 1 to make sure it aligns to the next multiple of 8. Those reports send dummy inputs that don't do anything aside from aligning the data. Tested on Linux, Windows 10 and Street Fighter (where the joystick is recognized as direct-input) * Add save and restore of each pin used in reading joystick (AVR). Allow output pin to be JS_VIRTUAL_AXIS if the axis is connected to Vcc instead of an output pin from the MCU. Fix joystick report id Fix broken v-usb hid joystick interface. Make it more resilient to unusual settings (none multiple of eight button count, 0 buttons or 0 axes) Correct adc reading for multiple axes. Piecewise range conversion for uncentered raw value range. Input, output and ground pin configuration per axis. Documentation fixes * Fix port addressing for joystick analog read * The other required set of changes As per the PR, the changes still holding it up. Add onekey for testing. Fix ARM builds. Fix device descriptor when either axes or buttons is zero. Add compile-time check for at least one axis or button. Move definition to try to fix conflict. PR review comments. qmk cformat * avoid float functions to compute range mapping for axis adc reading * Remove V-USB support for now. Updated docs accordingly. * Update tmk_core/protocol/lufa/lufa.c Co-Authored-By: Ryan <fauxpark@gmail.com> * Update tmk_core/protocol/usb_descriptor.c Co-Authored-By: Ryan <fauxpark@gmail.com> * Update tmk_core/protocol/usb_descriptor.c Co-Authored-By: Ryan <fauxpark@gmail.com> * Update tmk_core/protocol/usb_descriptor.c Co-Authored-By: Ryan <fauxpark@gmail.com> * Add support for joystick adc reading for stm32 MCUs. Fix joystick hid report sending for chibios * Fix HID joystick report sending for ChibiOS. Add one analog axis to the onekey:joystick keymap. Fix pin state save and restore during joystick analog read for STM32 MCUs. * Update tmk_core/protocol/chibios/usb_main.c Co-Authored-By: Ryan <fauxpark@gmail.com> * Update tmk_core/protocol/lufa/lufa.c Co-Authored-By: Ryan <fauxpark@gmail.com> * Add missing mcuconf.h and halconf.h to onekey:joystick keymap. Add suggested fixes from PR. * Switch saveState and restoreState signature to use pin_t type. onekey:joystick : add a second axis, virtual and programmatically animated. * Update docs/feature_joystick.md Co-Authored-By: Ryan <fauxpark@gmail.com> * Update docs/feature_joystick.md Co-Authored-By: Ryan <fauxpark@gmail.com> * Add PR corrections * Remove halconf.h and mcuconf.h from onekey keymaps * Change ADC_PIN to A0 Co-authored-by: achol <allecooll@hotmail.com> Co-authored-by: José Júnior <jose.junior@gmail.com> Co-authored-by: a-chol <achol@notamail.com> Co-authored-by: Nick Brassel <nick@tzarc.org> Co-authored-by: Ryan <fauxpark@gmail.com>
3 years ago
Hid joystick interface (#4226) * add support for hid gamepad interface add documentation for HID joystick Add joystick_task to read analog axes values even when no key is pressed or release. update doc Update docs/feature_joystick.md Manage pin setup and read to maintain matrix scan after analog read * Incorporates patches and changes to HID reporting There are some patches provided by @a-chol incorporated on this commit, and also some changes I made to the HID Report structure. The most interesting is the one dealing with number of buttons: Linux doesn't seem to care, but Windows requires the HID structure to be byte aligned (that's in the spec). So if one declares 8/16/32... buttons they should not have any issues, but this is what happens when you have 9 buttons: ``` bits |0|1|2|3|4|5|6|7| |*|*|*|*|*|*|*|*| axis 0 (report size 8) |*|*|*|*|*|*|*|*| ... |*|*|*|*|*|*|*|*| |*|*|*|*|*|*|*|*| |*|*|*|*|*|*|*|*| |*|*|*|*|*|*|*|*| |*|*|*|*|*|*|*|*| axis 6 |*|*|*|*|*|*|*|*| first 8 buttons (report size 1) |*| | | | | | | | last of 9 buttons, not aligned ``` So for that I added a conditonal that will add a number of reports with size 1 to make sure it aligns to the next multiple of 8. Those reports send dummy inputs that don't do anything aside from aligning the data. Tested on Linux, Windows 10 and Street Fighter (where the joystick is recognized as direct-input) * Add save and restore of each pin used in reading joystick (AVR). Allow output pin to be JS_VIRTUAL_AXIS if the axis is connected to Vcc instead of an output pin from the MCU. Fix joystick report id Fix broken v-usb hid joystick interface. Make it more resilient to unusual settings (none multiple of eight button count, 0 buttons or 0 axes) Correct adc reading for multiple axes. Piecewise range conversion for uncentered raw value range. Input, output and ground pin configuration per axis. Documentation fixes * Fix port addressing for joystick analog read * The other required set of changes As per the PR, the changes still holding it up. Add onekey for testing. Fix ARM builds. Fix device descriptor when either axes or buttons is zero. Add compile-time check for at least one axis or button. Move definition to try to fix conflict. PR review comments. qmk cformat * avoid float functions to compute range mapping for axis adc reading * Remove V-USB support for now. Updated docs accordingly. * Update tmk_core/protocol/lufa/lufa.c Co-Authored-By: Ryan <fauxpark@gmail.com> * Update tmk_core/protocol/usb_descriptor.c Co-Authored-By: Ryan <fauxpark@gmail.com> * Update tmk_core/protocol/usb_descriptor.c Co-Authored-By: Ryan <fauxpark@gmail.com> * Update tmk_core/protocol/usb_descriptor.c Co-Authored-By: Ryan <fauxpark@gmail.com> * Add support for joystick adc reading for stm32 MCUs. Fix joystick hid report sending for chibios * Fix HID joystick report sending for ChibiOS. Add one analog axis to the onekey:joystick keymap. Fix pin state save and restore during joystick analog read for STM32 MCUs. * Update tmk_core/protocol/chibios/usb_main.c Co-Authored-By: Ryan <fauxpark@gmail.com> * Update tmk_core/protocol/lufa/lufa.c Co-Authored-By: Ryan <fauxpark@gmail.com> * Add missing mcuconf.h and halconf.h to onekey:joystick keymap. Add suggested fixes from PR. * Switch saveState and restoreState signature to use pin_t type. onekey:joystick : add a second axis, virtual and programmatically animated. * Update docs/feature_joystick.md Co-Authored-By: Ryan <fauxpark@gmail.com> * Update docs/feature_joystick.md Co-Authored-By: Ryan <fauxpark@gmail.com> * Add PR corrections * Remove halconf.h and mcuconf.h from onekey keymaps * Change ADC_PIN to A0 Co-authored-by: achol <allecooll@hotmail.com> Co-authored-by: José Júnior <jose.junior@gmail.com> Co-authored-by: a-chol <achol@notamail.com> Co-authored-by: Nick Brassel <nick@tzarc.org> Co-authored-by: Ryan <fauxpark@gmail.com>
3 years ago
  1. # Copyright 2017 Fred Sundvik
  2. #
  3. # This program is free software: you can redistribute it and/or modify
  4. # it under the terms of the GNU General Public License as published by
  5. # the Free Software Foundation, either version 2 of the License, or
  6. # (at your option) any later version.
  7. #
  8. # This program is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. # GNU General Public License for more details.
  12. #
  13. # You should have received a copy of the GNU General Public License
  14. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. SERIAL_PATH := $(QUANTUM_PATH)/serial_link
  16. QUANTUM_SRC += \
  17. $(QUANTUM_DIR)/quantum.c \
  18. $(QUANTUM_DIR)/keymap_common.c \
  19. $(QUANTUM_DIR)/keycode_config.c
  20. ifeq ($(strip $(API_SYSEX_ENABLE)), yes)
  21. OPT_DEFS += -DAPI_SYSEX_ENABLE
  22. OPT_DEFS += -DAPI_ENABLE
  23. MIDI_ENABLE=yes
  24. SRC += $(QUANTUM_DIR)/api/api_sysex.c
  25. SRC += $(QUANTUM_DIR)/api.c
  26. endif
  27. ifeq ($(strip $(AUDIO_ENABLE)), yes)
  28. OPT_DEFS += -DAUDIO_ENABLE
  29. MUSIC_ENABLE = yes
  30. SRC += $(QUANTUM_DIR)/process_keycode/process_audio.c
  31. SRC += $(QUANTUM_DIR)/process_keycode/process_clicky.c
  32. SRC += $(QUANTUM_DIR)/audio/audio_$(PLATFORM_KEY).c
  33. SRC += $(QUANTUM_DIR)/audio/voices.c
  34. SRC += $(QUANTUM_DIR)/audio/luts.c
  35. endif
  36. ifeq ($(strip $(MIDI_ENABLE)), yes)
  37. OPT_DEFS += -DMIDI_ENABLE
  38. MUSIC_ENABLE = yes
  39. SRC += $(QUANTUM_DIR)/process_keycode/process_midi.c
  40. endif
  41. MUSIC_ENABLE ?= no
  42. ifeq ($(MUSIC_ENABLE), yes)
  43. SRC += $(QUANTUM_DIR)/process_keycode/process_music.c
  44. endif
  45. ifeq ($(strip $(STENO_ENABLE)), yes)
  46. OPT_DEFS += -DSTENO_ENABLE
  47. VIRTSER_ENABLE ?= yes
  48. SRC += $(QUANTUM_DIR)/process_keycode/process_steno.c
  49. endif
  50. ifeq ($(strip $(VIRTSER_ENABLE)), yes)
  51. OPT_DEFS += -DVIRTSER_ENABLE
  52. endif
  53. ifeq ($(strip $(FAUXCLICKY_ENABLE)), yes)
  54. OPT_DEFS += -DFAUXCLICKY_ENABLE
  55. SRC += $(QUANTUM_DIR)/fauxclicky.c
  56. endif
  57. ifeq ($(strip $(POINTING_DEVICE_ENABLE)), yes)
  58. OPT_DEFS += -DPOINTING_DEVICE_ENABLE
  59. OPT_DEFS += -DMOUSE_ENABLE
  60. SRC += $(QUANTUM_DIR)/pointing_device.c
  61. endif
  62. VALID_EEPROM_DRIVER_TYPES := vendor custom transient i2c spi
  63. EEPROM_DRIVER ?= vendor
  64. ifeq ($(filter $(EEPROM_DRIVER),$(VALID_EEPROM_DRIVER_TYPES)),)
  65. $(error EEPROM_DRIVER="$(EEPROM_DRIVER)" is not a valid EEPROM driver)
  66. else
  67. OPT_DEFS += -DEEPROM_ENABLE
  68. ifeq ($(strip $(EEPROM_DRIVER)), custom)
  69. OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_CUSTOM
  70. COMMON_VPATH += $(DRIVER_PATH)/eeprom
  71. SRC += eeprom_driver.c
  72. else ifeq ($(strip $(EEPROM_DRIVER)), i2c)
  73. OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_I2C
  74. COMMON_VPATH += $(DRIVER_PATH)/eeprom
  75. QUANTUM_LIB_SRC += i2c_master.c
  76. SRC += eeprom_driver.c eeprom_i2c.c
  77. else ifeq ($(strip $(EEPROM_DRIVER)), spi)
  78. OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_SPI
  79. COMMON_VPATH += $(DRIVER_PATH)/eeprom
  80. QUANTUM_LIB_SRC += spi_master.c
  81. SRC += eeprom_driver.c eeprom_spi.c
  82. else ifeq ($(strip $(EEPROM_DRIVER)), transient)
  83. OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_TRANSIENT
  84. COMMON_VPATH += $(DRIVER_PATH)/eeprom
  85. SRC += eeprom_driver.c eeprom_transient.c
  86. else ifeq ($(strip $(EEPROM_DRIVER)), vendor)
  87. OPT_DEFS += -DEEPROM_VENDOR
  88. ifeq ($(PLATFORM),AVR)
  89. # Automatically provided by avr-libc, nothing required
  90. else ifeq ($(PLATFORM),CHIBIOS)
  91. ifeq ($(MCU_SERIES), STM32F3xx)
  92. SRC += $(PLATFORM_COMMON_DIR)/eeprom_stm32.c
  93. SRC += $(PLATFORM_COMMON_DIR)/flash_stm32.c
  94. OPT_DEFS += -DEEPROM_EMU_STM32F303xC
  95. OPT_DEFS += -DSTM32_EEPROM_ENABLE
  96. else ifeq ($(MCU_SERIES), STM32F1xx)
  97. SRC += $(PLATFORM_COMMON_DIR)/eeprom_stm32.c
  98. SRC += $(PLATFORM_COMMON_DIR)/flash_stm32.c
  99. OPT_DEFS += -DEEPROM_EMU_STM32F103xB
  100. OPT_DEFS += -DSTM32_EEPROM_ENABLE
  101. else ifeq ($(MCU_SERIES)_$(MCU_LDSCRIPT), STM32F0xx_STM32F072xB)
  102. SRC += $(PLATFORM_COMMON_DIR)/eeprom_stm32.c
  103. SRC += $(PLATFORM_COMMON_DIR)/flash_stm32.c
  104. OPT_DEFS += -DEEPROM_EMU_STM32F072xB
  105. OPT_DEFS += -DSTM32_EEPROM_ENABLE
  106. else ifneq ($(filter $(MCU_SERIES),STM32L0xx STM32L1xx),)
  107. OPT_DEFS += -DEEPROM_DRIVER
  108. COMMON_VPATH += $(DRIVER_PATH)/eeprom
  109. SRC += eeprom_driver.c eeprom_stm32_L0_L1.c
  110. else
  111. # This will effectively work the same as "transient" if not supported by the chip
  112. SRC += $(PLATFORM_COMMON_DIR)/eeprom_teensy.c
  113. endif
  114. else ifeq ($(PLATFORM),ARM_ATSAM)
  115. SRC += $(PLATFORM_COMMON_DIR)/eeprom.c
  116. else ifeq ($(PLATFORM),TEST)
  117. SRC += $(PLATFORM_COMMON_DIR)/eeprom.c
  118. endif
  119. endif
  120. endif
  121. ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
  122. POST_CONFIG_H += $(QUANTUM_DIR)/rgblight_post_config.h
  123. OPT_DEFS += -DRGBLIGHT_ENABLE
  124. SRC += $(QUANTUM_DIR)/color.c
  125. SRC += $(QUANTUM_DIR)/rgblight.c
  126. CIE1931_CURVE := yes
  127. RGB_KEYCODES_ENABLE := yes
  128. ifeq ($(strip $(RGBLIGHT_CUSTOM_DRIVER)), yes)
  129. OPT_DEFS += -DRGBLIGHT_CUSTOM_DRIVER
  130. else
  131. WS2812_DRIVER_REQUIRED := yes
  132. endif
  133. endif
  134. VALID_MATRIX_TYPES := yes IS31FL3731 IS31FL3733 IS31FL3737 IS31FL3741 WS2812 custom
  135. LED_MATRIX_ENABLE ?= no
  136. ifneq ($(strip $(LED_MATRIX_ENABLE)), no)
  137. ifeq ($(filter $(LED_MATRIX_ENABLE),$(VALID_MATRIX_TYPES)),)
  138. $(error LED_MATRIX_ENABLE="$(LED_MATRIX_ENABLE)" is not a valid matrix type)
  139. else
  140. BACKLIGHT_ENABLE = yes
  141. BACKLIGHT_DRIVER = custom
  142. OPT_DEFS += -DLED_MATRIX_ENABLE
  143. SRC += $(QUANTUM_DIR)/led_matrix.c
  144. SRC += $(QUANTUM_DIR)/led_matrix_drivers.c
  145. endif
  146. endif
  147. ifeq ($(strip $(LED_MATRIX_ENABLE)), IS31FL3731)
  148. OPT_DEFS += -DIS31FL3731
  149. COMMON_VPATH += $(DRIVER_PATH)/issi
  150. SRC += is31fl3731-simple.c
  151. QUANTUM_LIB_SRC += i2c_master.c
  152. endif
  153. RGB_MATRIX_ENABLE ?= no
  154. ifneq ($(strip $(RGB_MATRIX_ENABLE)), no)
  155. ifeq ($(filter $(RGB_MATRIX_ENABLE),$(VALID_MATRIX_TYPES)),)
  156. $(error RGB_MATRIX_ENABLE="$(RGB_MATRIX_ENABLE)" is not a valid matrix type)
  157. endif
  158. OPT_DEFS += -DRGB_MATRIX_ENABLE
  159. SRC += $(QUANTUM_DIR)/color.c
  160. SRC += $(QUANTUM_DIR)/rgb_matrix.c
  161. SRC += $(QUANTUM_DIR)/rgb_matrix_drivers.c
  162. CIE1931_CURVE := yes
  163. RGB_KEYCODES_ENABLE := yes
  164. endif
  165. ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes)
  166. RGB_MATRIX_ENABLE := IS31FL3731
  167. endif
  168. ifeq ($(strip $(RGB_MATRIX_ENABLE)), IS31FL3731)
  169. OPT_DEFS += -DIS31FL3731 -DSTM32_I2C -DHAL_USE_I2C=TRUE
  170. COMMON_VPATH += $(DRIVER_PATH)/issi
  171. SRC += is31fl3731.c
  172. QUANTUM_LIB_SRC += i2c_master.c
  173. endif
  174. ifeq ($(strip $(RGB_MATRIX_ENABLE)), IS31FL3733)
  175. OPT_DEFS += -DIS31FL3733 -DSTM32_I2C -DHAL_USE_I2C=TRUE
  176. COMMON_VPATH += $(DRIVER_PATH)/issi
  177. SRC += is31fl3733.c
  178. QUANTUM_LIB_SRC += i2c_master.c
  179. endif
  180. ifeq ($(strip $(RGB_MATRIX_ENABLE)), IS31FL3737)
  181. OPT_DEFS += -DIS31FL3737 -DSTM32_I2C -DHAL_USE_I2C=TRUE
  182. COMMON_VPATH += $(DRIVER_PATH)/issi
  183. SRC += is31fl3737.c
  184. QUANTUM_LIB_SRC += i2c_master.c
  185. endif
  186. ifeq ($(strip $(RGB_MATRIX_ENABLE)), IS31FL3741)
  187. OPT_DEFS += -DIS31FL3741 -DSTM32_I2C -DHAL_USE_I2C=TRUE
  188. COMMON_VPATH += $(DRIVER_PATH)/issi
  189. SRC += is31fl3741.c
  190. QUANTUM_LIB_SRC += i2c_master.c
  191. endif
  192. ifeq ($(strip $(RGB_MATRIX_ENABLE)), WS2812)
  193. OPT_DEFS += -DWS2812
  194. WS2812_DRIVER_REQUIRED := yes
  195. endif
  196. ifeq ($(strip $(RGB_MATRIX_CUSTOM_KB)), yes)
  197. OPT_DEFS += -DRGB_MATRIX_CUSTOM_KB
  198. endif
  199. ifeq ($(strip $(RGB_MATRIX_CUSTOM_USER)), yes)
  200. OPT_DEFS += -DRGB_MATRIX_CUSTOM_USER
  201. endif
  202. ifeq ($(strip $(RGB_KEYCODES_ENABLE)), yes)
  203. SRC += $(QUANTUM_DIR)/process_keycode/process_rgb.c
  204. endif
  205. ifeq ($(strip $(PRINTING_ENABLE)), yes)
  206. OPT_DEFS += -DPRINTING_ENABLE
  207. SRC += $(QUANTUM_DIR)/process_keycode/process_printer.c
  208. SRC += $(TMK_DIR)/protocol/serial_uart.c
  209. endif
  210. ifeq ($(strip $(SERIAL_LINK_ENABLE)), yes)
  211. SERIAL_SRC := $(wildcard $(SERIAL_PATH)/protocol/*.c)
  212. SERIAL_SRC += $(wildcard $(SERIAL_PATH)/system/*.c)
  213. SERIAL_DEFS += -DSERIAL_LINK_ENABLE
  214. COMMON_VPATH += $(SERIAL_PATH)
  215. SRC += $(patsubst $(QUANTUM_PATH)/%,%,$(SERIAL_SRC))
  216. OPT_DEFS += $(SERIAL_DEFS)
  217. VAPTH += $(SERIAL_PATH)
  218. endif
  219. VARIABLE_TRACE ?= no
  220. ifneq ($(strip $(VARIABLE_TRACE)),no)
  221. SRC += $(QUANTUM_DIR)/variable_trace.c
  222. OPT_DEFS += -DNUM_TRACED_VARIABLES=$(strip $(VARIABLE_TRACE))
  223. ifneq ($(strip $(MAX_VARIABLE_TRACE_SIZE)),)
  224. OPT_DEFS += -DMAX_VARIABLE_TRACE_SIZE=$(strip $(MAX_VARIABLE_TRACE_SIZE))
  225. endif
  226. endif
  227. ifeq ($(strip $(LCD_ENABLE)), yes)
  228. CIE1931_CURVE := yes
  229. endif
  230. # backward compat
  231. ifeq ($(strip $(BACKLIGHT_CUSTOM_DRIVER)), yes)
  232. BACKLIGHT_DRIVER := custom
  233. endif
  234. VALID_BACKLIGHT_TYPES := pwm timer software custom
  235. BACKLIGHT_ENABLE ?= no
  236. BACKLIGHT_DRIVER ?= pwm
  237. ifeq ($(strip $(BACKLIGHT_ENABLE)), yes)
  238. ifeq ($(filter $(BACKLIGHT_DRIVER),$(VALID_BACKLIGHT_TYPES)),)
  239. $(error BACKLIGHT_DRIVER="$(BACKLIGHT_DRIVER)" is not a valid backlight type)
  240. endif
  241. COMMON_VPATH += $(QUANTUM_DIR)/backlight
  242. SRC += $(QUANTUM_DIR)/backlight/backlight.c
  243. SRC += $(QUANTUM_DIR)/process_keycode/process_backlight.c
  244. OPT_DEFS += -DBACKLIGHT_ENABLE
  245. ifeq ($(strip $(BACKLIGHT_DRIVER)), custom)
  246. OPT_DEFS += -DBACKLIGHT_CUSTOM_DRIVER
  247. else
  248. SRC += $(QUANTUM_DIR)/backlight/backlight_driver_common.c
  249. ifeq ($(strip $(BACKLIGHT_DRIVER)), pwm)
  250. SRC += $(QUANTUM_DIR)/backlight/backlight_$(PLATFORM_KEY).c
  251. else
  252. SRC += $(QUANTUM_DIR)/backlight/backlight_$(strip $(BACKLIGHT_DRIVER)).c
  253. endif
  254. endif
  255. endif
  256. VALID_WS2812_DRIVER_TYPES := bitbang pwm spi i2c
  257. WS2812_DRIVER ?= bitbang
  258. ifeq ($(strip $(WS2812_DRIVER_REQUIRED)), yes)
  259. ifeq ($(filter $(WS2812_DRIVER),$(VALID_WS2812_DRIVER_TYPES)),)
  260. $(error WS2812_DRIVER="$(WS2812_DRIVER)" is not a valid WS2812 driver)
  261. endif
  262. OPT_DEFS += -DWS2812_DRIVER_$(strip $(shell echo $(WS2812_DRIVER) | tr '[:lower:]' '[:upper:]'))
  263. ifeq ($(strip $(WS2812_DRIVER)), bitbang)
  264. SRC += ws2812.c
  265. else
  266. SRC += ws2812_$(strip $(WS2812_DRIVER)).c
  267. ifeq ($(strip $(PLATFORM)), CHIBIOS)
  268. ifeq ($(strip $(WS2812_DRIVER)), pwm)
  269. OPT_DEFS += -DSTM32_DMA_REQUIRED=TRUE
  270. endif
  271. endif
  272. endif
  273. # add extra deps
  274. ifeq ($(strip $(WS2812_DRIVER)), i2c)
  275. QUANTUM_LIB_SRC += i2c_master.c
  276. endif
  277. endif
  278. ifeq ($(strip $(VISUALIZER_ENABLE)), yes)
  279. CIE1931_CURVE := yes
  280. endif
  281. ifeq ($(strip $(CIE1931_CURVE)), yes)
  282. OPT_DEFS += -DUSE_CIE1931_CURVE
  283. LED_TABLES := yes
  284. endif
  285. ifeq ($(strip $(LED_TABLES)), yes)
  286. SRC += $(QUANTUM_DIR)/led_tables.c
  287. endif
  288. ifeq ($(strip $(TERMINAL_ENABLE)), yes)
  289. SRC += $(QUANTUM_DIR)/process_keycode/process_terminal.c
  290. OPT_DEFS += -DTERMINAL_ENABLE
  291. OPT_DEFS += -DUSER_PRINT
  292. endif
  293. ifeq ($(strip $(USB_HID_ENABLE)), yes)
  294. include $(TMK_DIR)/protocol/usb_hid.mk
  295. endif
  296. ifeq ($(strip $(WPM_ENABLE)), yes)
  297. SRC += $(QUANTUM_DIR)/wpm.c
  298. OPT_DEFS += -DWPM_ENABLE
  299. endif
  300. ifeq ($(strip $(ENCODER_ENABLE)), yes)
  301. SRC += $(QUANTUM_DIR)/encoder.c
  302. OPT_DEFS += -DENCODER_ENABLE
  303. endif
  304. ifeq ($(strip $(VELOCIKEY_ENABLE)), yes)
  305. OPT_DEFS += -DVELOCIKEY_ENABLE
  306. SRC += $(QUANTUM_DIR)/velocikey.c
  307. endif
  308. ifeq ($(strip $(VIA_ENABLE)), yes)
  309. DYNAMIC_KEYMAP_ENABLE := yes
  310. RAW_ENABLE := yes
  311. BOOTMAGIC_ENABLE := lite
  312. SRC += $(QUANTUM_DIR)/via.c
  313. OPT_DEFS += -DVIA_ENABLE
  314. endif
  315. ifeq ($(strip $(DYNAMIC_KEYMAP_ENABLE)), yes)
  316. OPT_DEFS += -DDYNAMIC_KEYMAP_ENABLE
  317. SRC += $(QUANTUM_DIR)/dynamic_keymap.c
  318. endif
  319. ifeq ($(strip $(DIP_SWITCH_ENABLE)), yes)
  320. OPT_DEFS += -DDIP_SWITCH_ENABLE
  321. SRC += $(QUANTUM_DIR)/dip_switch.c
  322. endif
  323. VALID_CUSTOM_MATRIX_TYPES:= yes lite no
  324. CUSTOM_MATRIX ?= no
  325. ifneq ($(strip $(CUSTOM_MATRIX)), yes)
  326. ifeq ($(filter $(CUSTOM_MATRIX),$(VALID_CUSTOM_MATRIX_TYPES)),)
  327. $(error CUSTOM_MATRIX="$(CUSTOM_MATRIX)" is not a valid custom matrix type)
  328. endif
  329. # Include common stuff for all non custom matrix users
  330. QUANTUM_SRC += $(QUANTUM_DIR)/matrix_common.c
  331. # if 'lite' then skip the actual matrix implementation
  332. ifneq ($(strip $(CUSTOM_MATRIX)), lite)
  333. # Include the standard or split matrix code if needed
  334. ifeq ($(strip $(SPLIT_KEYBOARD)), yes)
  335. QUANTUM_SRC += $(QUANTUM_DIR)/split_common/matrix.c
  336. else
  337. QUANTUM_SRC += $(QUANTUM_DIR)/matrix.c
  338. endif
  339. endif
  340. endif
  341. DEBOUNCE_DIR:= $(QUANTUM_DIR)/debounce
  342. # Debounce Modules. Set DEBOUNCE_TYPE=custom if including one manually.
  343. DEBOUNCE_TYPE?= sym_g
  344. ifneq ($(strip $(DEBOUNCE_TYPE)), custom)
  345. QUANTUM_SRC += $(DEBOUNCE_DIR)/$(strip $(DEBOUNCE_TYPE)).c
  346. endif
  347. ifeq ($(strip $(SPLIT_KEYBOARD)), yes)
  348. POST_CONFIG_H += $(QUANTUM_DIR)/split_common/post_config.h
  349. OPT_DEFS += -DSPLIT_KEYBOARD
  350. # Include files used by all split keyboards
  351. QUANTUM_SRC += $(QUANTUM_DIR)/split_common/split_util.c
  352. # Determine which (if any) transport files are required
  353. ifneq ($(strip $(SPLIT_TRANSPORT)), custom)
  354. QUANTUM_SRC += $(QUANTUM_DIR)/split_common/transport.c
  355. # Functions added via QUANTUM_LIB_SRC are only included in the final binary if they're called.
  356. # Unused functions are pruned away, which is why we can add multiple drivers here without bloat.
  357. ifeq ($(PLATFORM),AVR)
  358. QUANTUM_LIB_SRC += i2c_master.c \
  359. i2c_slave.c
  360. endif
  361. SERIAL_DRIVER ?= bitbang
  362. ifeq ($(strip $(SERIAL_DRIVER)), bitbang)
  363. QUANTUM_LIB_SRC += serial.c
  364. else
  365. QUANTUM_LIB_SRC += serial_$(strip $(SERIAL_DRIVER)).c
  366. endif
  367. endif
  368. COMMON_VPATH += $(QUANTUM_PATH)/split_common
  369. endif
  370. HAPTIC_ENABLE ?= no
  371. ifneq ($(strip $(HAPTIC_ENABLE)),no)
  372. COMMON_VPATH += $(DRIVER_PATH)/haptic
  373. SRC += haptic.c
  374. OPT_DEFS += -DHAPTIC_ENABLE
  375. endif
  376. ifneq ($(filter DRV2605L, $(HAPTIC_ENABLE)), )
  377. SRC += DRV2605L.c
  378. QUANTUM_LIB_SRC += i2c_master.c
  379. OPT_DEFS += -DDRV2605L
  380. endif
  381. ifneq ($(filter SOLENOID, $(HAPTIC_ENABLE)), )
  382. SRC += solenoid.c
  383. OPT_DEFS += -DSOLENOID_ENABLE
  384. endif
  385. ifeq ($(strip $(HD44780_ENABLE)), yes)
  386. SRC += drivers/avr/hd44780.c
  387. OPT_DEFS += -DHD44780_ENABLE
  388. endif
  389. ifeq ($(strip $(OLED_DRIVER_ENABLE)), yes)
  390. OPT_DEFS += -DOLED_DRIVER_ENABLE
  391. COMMON_VPATH += $(DRIVER_PATH)/oled
  392. QUANTUM_LIB_SRC += i2c_master.c
  393. SRC += oled_driver.c
  394. endif
  395. include $(DRIVER_PATH)/qwiic/qwiic.mk
  396. ifeq ($(strip $(UCIS_ENABLE)), yes)
  397. OPT_DEFS += -DUCIS_ENABLE
  398. UNICODE_COMMON := yes
  399. SRC += $(QUANTUM_DIR)/process_keycode/process_ucis.c
  400. endif
  401. ifeq ($(strip $(UNICODEMAP_ENABLE)), yes)
  402. OPT_DEFS += -DUNICODEMAP_ENABLE
  403. UNICODE_COMMON := yes
  404. SRC += $(QUANTUM_DIR)/process_keycode/process_unicodemap.c
  405. endif
  406. ifeq ($(strip $(UNICODE_ENABLE)), yes)
  407. OPT_DEFS += -DUNICODE_ENABLE
  408. UNICODE_COMMON := yes
  409. SRC += $(QUANTUM_DIR)/process_keycode/process_unicode.c
  410. endif
  411. ifeq ($(strip $(UNICODE_COMMON)), yes)
  412. SRC += $(QUANTUM_DIR)/process_keycode/process_unicode_common.c
  413. endif
  414. SPACE_CADET_ENABLE ?= yes
  415. ifeq ($(strip $(SPACE_CADET_ENABLE)), yes)
  416. SRC += $(QUANTUM_DIR)/process_keycode/process_space_cadet.c
  417. OPT_DEFS += -DSPACE_CADET_ENABLE
  418. endif
  419. MAGIC_ENABLE ?= yes
  420. ifeq ($(strip $(MAGIC_ENABLE)), yes)
  421. SRC += $(QUANTUM_DIR)/process_keycode/process_magic.c
  422. OPT_DEFS += -DMAGIC_KEYCODE_ENABLE
  423. endif
  424. GRAVE_ESC_ENABLE ?= yes
  425. ifeq ($(strip $(GRAVE_ESC_ENABLE)), yes)
  426. SRC += $(QUANTUM_DIR)/process_keycode/process_grave_esc.c
  427. OPT_DEFS += -DGRAVE_ESC_ENABLE
  428. endif
  429. ifeq ($(strip $(DYNAMIC_MACRO_ENABLE)), yes)
  430. SRC += $(QUANTUM_DIR)/process_keycode/process_dynamic_macro.c
  431. OPT_DEFS += -DDYNAMIC_MACRO_ENABLE
  432. endif
  433. ifeq ($(strip $(COMBO_ENABLE)), yes)
  434. SRC += $(QUANTUM_DIR)/process_keycode/process_combo.c
  435. OPT_DEFS += -DCOMBO_ENABLE
  436. endif
  437. ifeq ($(strip $(TAP_DANCE_ENABLE)), yes)
  438. SRC += $(QUANTUM_DIR)/process_keycode/process_tap_dance.c
  439. OPT_DEFS += -DTAP_DANCE_ENABLE
  440. endif
  441. ifeq ($(strip $(KEY_LOCK_ENABLE)), yes)
  442. SRC += $(QUANTUM_DIR)/process_keycode/process_key_lock.c
  443. OPT_DEFS += -DKEY_LOCK_ENABLE
  444. endif
  445. ifeq ($(strip $(LEADER_ENABLE)), yes)
  446. SRC += $(QUANTUM_DIR)/process_keycode/process_leader.c
  447. OPT_DEFS += -DLEADER_ENABLE
  448. endif
  449. ifeq ($(strip $(AUTO_SHIFT_ENABLE)), yes)
  450. SRC += $(QUANTUM_DIR)/process_keycode/process_auto_shift.c
  451. OPT_DEFS += -DAUTO_SHIFT_ENABLE
  452. ifeq ($(strip $(AUTO_SHIFT_MODIFIERS)), yes)
  453. OPT_DEFS += -DAUTO_SHIFT_MODIFIERS
  454. endif
  455. endif
  456. JOYSTICK_ENABLE ?= no
  457. ifneq ($(strip $(JOYSTICK_ENABLE)), no)
  458. OPT_DEFS += -DJOYSTICK_ENABLE
  459. SRC += $(QUANTUM_DIR)/process_keycode/process_joystick.c
  460. SRC += $(QUANTUM_DIR)/joystick.c
  461. endif
  462. ifeq ($(strip $(JOYSTICK_ENABLE)), analog)
  463. OPT_DEFS += -DANALOG_JOYSTICK_ENABLE
  464. SRC += analog.c
  465. endif
  466. ifeq ($(strip $(JOYSTICK_ENABLE)), digital)
  467. OPT_DEFS += -DDIGITAL_JOYSTICK_ENABLE
  468. endif