summaryrefslogtreecommitdiff
path: root/tmk_core
AgeCommit message (Collapse)Author
2020-04-20Clean up ATSAM ifdefs (#8808)Ryan
2020-04-19[Docs] Fixed minor typos (#8860)Chris Ko
2020-04-17Remove Atmel FLIP from install scripts and documentation (#8822)Ryan
2020-04-13Fix AVR SPI parameter configuration, remove timeouts due to sync protocol. ↵Nick Brassel
(#8775)
2020-04-13Add support for hardware and board initialisation overrides. (#8330)Nick Brassel
* Add support for hardware and board initialisation overrides. * qmk cformat. * Add some documentation. * Docs clarity. * Make early_hardware_init_pre a no-op for now, until migrations occur. * Doco update * Make distinction between keyboard and ChibiOS board in docs * Doc anchors. * Update tmk_core/protocol/chibios/main.c Co-Authored-By: Joel Challis <git@zvecr.com> * Rework bootloader entry to be off by default, allow opting-in. Co-authored-by: Joel Challis <git@zvecr.com>
2020-04-12Add *OPT aliases for *ALT keycodes and macros (#8714)Konstantin Đorđević
2020-04-12Fix bug with layer caching in get_event_keycode (#8693)Drashna Jaelre
* Fix bug with layer caching in get_event_keycode * Improve naming
2020-04-11format code according to conventions [skip ci]QMK Bot
2020-04-11Various fixes to how timer differences are calculated (#8585)Purdea Andrei
* tmk_core/common: Fixing TIMER_DIFF macro to calculate difference correctly after the timer wraps. Let's go through an example, using the following macro: If the first timer read is 0xe4 and the second one is 0x32, the timer wrapped. If the timer would have had more bits, it's new value would have been 0x132, and the correct difference in time is 0x132 - 0xe4 = 0x4e old code TIMER_DIFF_8(0x32, 0xe4) = 0xff - 0xe4 + 0x32 = 0x4d, which is wrong. new code TIMER_DIFF_8(0x32, 0xe4) = 0xff + 1 - 0xe4 + 0x32 = 0x4e, which is correct. This also gives a chance for a smart compiler to optimize the code using normal integer overflow. For example on AVR, the following C code: uint8_t __attribute__ ((noinline)) test(uint8_t current_timer, uint8_t start_timer) { return TIMER_DIFF_8(current_timer, start_timer); } With the original code, it gets translated to the following list of instructions: 00004c6e <test>: 4c6e: 98 2f mov r25, r24 4c70: 86 1b sub r24, r22 4c72: 96 17 cp r25, r22 4c74: 08 f4 brcc .+2 ; 0x4c78 <test+0xa> 4c76: 81 50 subi r24, 0x01 ; 1 4c78: 08 95 ret But with this commit, it gets translated to a single instruction: 00004c40 <test>: 4c40: 86 1b sub r24, r22 4c42: 08 95 ret This unfortunately doesn't always work so nicely, for example the following C code: int __attribute__ ((noinline)) test(uint8_t current_timer, uint8_t start_timer) { return TIMER_DIFF_8(current_timer, start_timer); } (Note: return type changed to int) With the original code it gets translated to: 00004c6e <test>: 4c6e: 28 2f mov r18, r24 4c70: 30 e0 ldi r19, 0x00 ; 0 4c72: 46 2f mov r20, r22 4c74: 50 e0 ldi r21, 0x00 ; 0 4c76: 86 17 cp r24, r22 4c78: 20 f0 brcs .+8 ; 0x4c82 <test+0x14> 4c7a: c9 01 movw r24, r18 4c7c: 84 1b sub r24, r20 4c7e: 95 0b sbc r25, r21 4c80: 08 95 ret 4c82: c9 01 movw r24, r18 4c84: 84 1b sub r24, r20 4c86: 95 0b sbc r25, r21 4c88: 81 50 subi r24, 0x01 ; 1 4c8a: 9f 4f sbci r25, 0xFF ; 255 4c8c: 08 95 ret Wth this commit it gets translated to: 00004c40 <test>: 4c40: 28 2f mov r18, r24 4c42: 30 e0 ldi r19, 0x00 ; 0 4c44: 46 2f mov r20, r22 4c46: 50 e0 ldi r21, 0x00 ; 0 4c48: 86 17 cp r24, r22 4c4a: 20 f0 brcs .+8 ; 0x4c54 <test+0x14> 4c4c: c9 01 movw r24, r18 4c4e: 84 1b sub r24, r20 4c50: 95 0b sbc r25, r21 4c52: 08 95 ret 4c54: c9 01 movw r24, r18 4c56: 84 1b sub r24, r20 4c58: 95 0b sbc r25, r21 4c5a: 93 95 inc r25 4c5c: 08 95 ret There is not much performance improvement in this case, however at least with this commit it functions correctly. Note: The following commit will improve compiler output for the latter example. * tmk_core/common: Improve code generation for TIMER_DIFF* macros Because of integer promotion the compiler is having a hard time generating efficient code to calculate TIMER_DIFF* macros in some situations. In the below example, the return value is "int", and this is causing the trouble. Example C code: int __attribute__ ((noinline)) test(uint8_t current_timer, uint8_t start_timer) { return TIMER_DIFF_8(current_timer, start_timer); } BEFORE: (with -Os) 00004c40 <test>: 4c40: 28 2f mov r18, r24 4c42: 30 e0 ldi r19, 0x00 ; 0 4c44: 46 2f mov r20, r22 4c46: 50 e0 ldi r21, 0x00 ; 0 4c48: 86 17 cp r24, r22 4c4a: 20 f0 brcs .+8 ; 0x4c54 <test+0x14> 4c4c: c9 01 movw r24, r18 4c4e: 84 1b sub r24, r20 4c50: 95 0b sbc r25, r21 4c52: 08 95 ret 4c54: c9 01 movw r24, r18 4c56: 84 1b sub r24, r20 4c58: 95 0b sbc r25, r21 4c5a: 93 95 inc r25 4c5c: 08 95 ret AFTER: (with -Os) 00004c40 <test>: 4c40: 86 1b sub r24, r22 4c42: 90 e0 ldi r25, 0x00 ; 0 4c44: 08 95 ret Note: the example is showing -Os but improvements can be seen at all optimization levels, including -O0. We never use -O0, but I tested it to make sure that no extra code is generated in that case.OA * quantum/debounce: Fix custom wrapping timers in eager_pr and eager_pk debounce algorithms Please see the below simulated sequence of events: Column A is the 16-bit value returned by read_timer(); Column B is the value returned by custom_wrap_timer_read(); Column C is the original code: (timer_read() % MAX_DEBOUNCE) A, B, C 65530, 19, 30 65531, 20, 31 65532, 21, 32 65533, 22, 33 65534, 23, 34 65535, 24, 35 0 25, 0 1, 26, 1 2, 27, 2 3, 28, 3 4, 29, 4 5, 30, 5 read_timer() wraps about every 1.09 seconds, and so debouncing might fail at these times without this commit. * quantum/debounce/eager_pr and eager_pk: modifications for code readability according to code review. * quantum/debounce/eager_pr and eager_pk: modifications for code readability according to code review. (2)
2020-04-09Add PS2_MOUSE_ROTATE to compensate for device orientation (#8650)Manna Harbour
* Add PS2_MOUSE_ROTATE to compensate for device orientation * fixup! Add PS2_MOUSE_ROTATE to compensate for device orientation * Reformat with IndentPPDirectives: AfterHash as per #6316
2020-04-09Fix compile issues related to NO_ACTION_MACRO/FUNCTION and LTO_ENABLE (#8663)Konstantin Đorđević
* Define NO_ACTION_MACRO/FUNCTION in header instead of makefile when LTO is enabled Currently, boards and keymaps that define NO_ACTION_MACRO/FUNCTION unconditionally will not compile with LTO_ENABLE (#8604). This fixes the issue by moving the definitions from common.mk to action.h, which enables us to check for previous definitions of those macros (this cannot be done in a makefile). * Remove LTO checks in templates Since now NO_ACTION_MACRO/FUNCTION are defined as needed in action.h (which is included by quantum.h), checking for LTO in keyboard and user code is no longer required. * Update LTO_ENABLE docs
2020-04-08spi_master for AVR (#8299)Ryan
* Change _delay_ms/us() to wait_ms/us() * Switch to platform-agnostic GPIO macros * Add AVR spi_master and migrate Adafruit BLE code * Set verbose back to false * Add clock divisor, bit order and SPI mode configuration for init * Add start and stop functions * Move configuration of mode, endianness and speed to `spi_start()` * Some breaks here would be good * Default Adafruit BLE clock divisor to 4 (2MHz on the Feather 32U4) * Remove mode and divisor enums * Add some docs * No hr at EOF * Add links in sidebar
2020-04-05format code according to conventions [skip ci]QMK Bot
2020-04-05V-USB: Remove some stuff from usbconfig.h that should not be configurable ↵Ryan
(#8656) * V-USB: Remove some stuff from usbconfig.h that should not be configurable * Clean up some ifdefs * And some more * Even more
2020-04-05V-USB remote wakeup (#7627)Drashna Jaelre
* V-USB remote wakeup Backport from tmk/tmk_keyboard@391c979be751eaf113c8f53c36644a6bb6ff12f6 * Change vusb.c remote wake config as per fauxpark's suggestion
2020-04-02format code according to conventions [skip ci]QMK Bot
2020-04-02Initial support for ATtiny85 (#8632)Joel Challis
* Initial support for ATtiny85 * Update mcu selection
2020-04-02Fix `pgm_read_ptr()` define for ARM (#8658)Ryan
2020-04-01Strip out features to allow minimum firmware sizes (#8645)Joel Challis
2020-04-01Updated V-USB template to allow usbFunctionWriteOut (#8634)yiancar
2020-04-01Miscellaneous cleanups (#8639)Ryan
* Miscellaneous cleanups * Cast NO_PIN
2020-04-01Migrate :program logic to :flash (#8631)Joel Challis
2020-03-31V-USB: Consolidate usbconfig.h's into a single file (#8584)Ryan
2020-03-30add hid_raw feature to VUSB (#8380)Takuya Urakawa
* rewrite usbhid feature on vusb * Apply suggestions from code review Co-Authored-By: Ryan <fauxpark@gmail.com> * fix typo * fix typo again * Update tmk_core/protocol/vusb/vusb.c Co-Authored-By: Ryan <fauxpark@gmail.com> * clean up defines Co-authored-by: Ryan <fauxpark@gmail.com>
2020-03-28fixed problem with implicit declaration in quantum/rgblight.c (#8406)Casper Weiss Bang
* Update tmk_core/common/progmem.h Co-Authored-By: Ryan <fauxpark@gmail.com> * Update quantum/rgblight.c Co-Authored-By: Ryan <fauxpark@gmail.com> * fixed problem with implicit declaration in quantum/rgblight.c (#8381) Co-authored-by: Ryan <fauxpark@gmail.com>
2020-03-28V-USB: Use structs for USB descriptors (#8572)Ryan
* V-USB: Use structs for USB descriptors * Update usbconfigs * cformat pass
2020-03-26Enable SLEEP_LED on ATmega32A (#8531)Joel Challis
* Port over some AVR backlight logic to SLEEP_LED * Port over some AVR backlight logic to SLEEP_LED - add timer 3 * Port over some AVR backlight logic to SLEEP_LED - clang format * Enable SLEEP_LED within vusb protocol
2020-03-26V-USB: Use manufacturer and product strings from config.h (#7797)Ryan
* V-USB: Use manufacturer and product strings from config.h * Update board configs
2020-03-26format code according to conventions [skip ci]QMK Bot
2020-03-26Add RawHID support to ATSAM (Massdrop boards) (#8530)foxx1337
* Add support for RAW endpoint for arm_atsam This the excellent work from helluvamatt/qmk_firmware in bb6eeb93b. * Reformat arm_atsam RAW endpoint code Co-authored-by: Matt Schneeberger <helluvamatt@gmail.com>
2020-03-25Run clang-format manually to fix recently changed files (#8552)Joel Challis
2020-03-23Add Post Processing to process_record (#4892)Drashna Jaelre
* Improve process_record system Code based on @colinta's * Rename and better handle functions * Fix incorrect function call to process_record_user * Add documentation for post_process_record * Add both get_event_keycode and get_record_keycode functions And add some comments about these functions * Update code format * Cleanup merge artifacts
2020-03-22Align some ChibiOS build logic (#8461)Joel Challis
* Align some ChibiOS build logic * infer more makefile logic * Move bootloader logic to chibios file
2020-03-21format code according to conventions [skip ci]QMK Bot
2020-03-21Add support for Bootmagic lite when using SPLIT_HAND_PIN (#8347)Joel Challis
* Add support for Bootmagic lite when using SPLIT_HAND_PIN * Deduplicate bootmagic_lite logic from within via * Revert location of defaults so that user overrides still work for now * Tidy up code slightly
2020-03-22Fix formatting for report.h (#8512)Ryan
2020-03-21format code according to conventions [skip ci]QMK Bot
2020-03-21Initial arm->chibios pass - simplify some platform logic (#8450)Joel Challis
2020-03-21Tidy up report.h (#8486)Ryan
* Tidy up report.h * Add link to Review Request 41 for brightness controls
2020-03-21Remove ACT_COMMAND (#8487)Ryan
* Remove ACT_COMMAND * And from action_t as well
2020-03-17Remove qmk archive generation (#8462)Joel Challis
2020-03-16format code according to conventions [skip ci]QMK Bot
2020-03-16Remove unnecessary import of rgblight.h in tmk_core/protocol/*/*.c (#8432)Takeshi ISHII
* Remove unnecessary import of rgblight.h in tmk_core/protocol/*/*.c * tmk_core/protocol/chibios/main.c * tmk_core/protocol/lufa/lufa.c see #8380 for tmk_core/protocol/vusb/main.c. * Remove '#include "rgblight.h"' from tmk_core/protocol/vusb/main.c.
2020-03-13format code according to conventions [skip ci]QMK Bot
2020-03-13Fix pressing two keys with the same keycode but different modifiers (#2710)fredizzimo
* Fix extra keyboard report during test_fixture teardown * Add tests for pressing two keys with only different modifers * Fix #1708 When two keys that use the same keycode, but different modifiers were pressed at the same time, the second keypress wasn't registered. This is fixed by forcing a key release when we detect a new press for the same keycode. * Fix the NKRO version of is_key_pressed * Fix uninitalized loop variable Co-authored-by: Jack Humbert <jack.humb@gmail.com>
2020-03-13format code according to conventions [skip ci]QMK Bot
2020-03-13Decouple mouse cursor and mouse wheel in accelerated mode (#6685)francislan
* Decouples mouse cursor and mouse wheel movements in accelerated mode. * Fixed comment indentation. * Updated docs Co-authored-by: Francis LAN <francislan@google.com>
2020-03-10Fix layer debug calls (#8370)Drashna Jaelre
2020-03-10Refactor rgblight_reconfig.h (#7773)Takeshi ISHII
* Moved contents of rgblight_reconfig.h to rgblight_post_config.h. In #3582, rgblight_reconfig.h had to be newly created. Now, the build system of qmk_firmware has a post_cofig feature, so that what was done in rgblight_reconfig.h can now be realized in rgblight_post_config.h. **This commit does not change the build result.** Testing script ```shell # build on master git checkout master echo master > /tmp/master_md5.txt # RGBLIGHT_ENABLE = no make HELIX=verbose helix/rev2:default:clean make HELIX=verbose helix/rev2:default md5 helix_rev2_default.hex >> /tmp/master_md5.txt # RGBLIGHT_ENABLE = yes, with animations make HELIX=verbose helix/rev2/back:default:clean make HELIX=verbose helix/rev2/back:default md5 helix_rev2_back_default.hex >> /tmp/master_md5.txt # RGBLIGHT_ENABLE = yes, without animations make HELIX=verbose,no_ani helix/rev2/back:default:clean make HELIX=verbose,no_ani helix/rev2/back:default md5 helix_rev2_back_default.hex >> /tmp/master_md5.txt # build on refactor_rgblight_reconfig.h git checkout refactor_rgblight_reconfig.h echo refactor_rgblight_reconfig.h > /tmp/branch_md5.txt # RGBLIGHT_ENABLE = no make HELIX=verbose helix/rev2:default:clean make HELIX=verbose helix/rev2:default md5 helix_rev2_default.hex >> /tmp/branch_md5.txt # RGBLIGHT_ENABLE = yes, with animations make HELIX=verbose helix/rev2/back:default:clean make HELIX=verbose helix/rev2/back:default md5 helix_rev2_back_default.hex >> /tmp/branch_md5.txt # RGBLIGHT_ENABLE = yes, without animations make HELIX=verbose,no_ani helix/rev2/back:default:clean make HELIX=verbose,no_ani helix/rev2/back:default md5 helix_rev2_back_default.hex >> /tmp/branch_md5.txt diff -u /tmp/master_md5.txt /tmp/branch_md5.txt ``` Test result: ``` --- /tmp/master_md5.txt 2020-01-03 15:42:22.000000000 +0900 +++ /tmp/branch_md5.txt 2020-01-03 15:42:42.000000000 +0900 @@ -1,4 +1,4 @@ -master +refactor_rgblight_reconfig.h MD5 (helix_rev2_default.hex) = f360032edd522448366d471d8f4f8181 MD5 (helix_rev2_back_default.hex) = 0c663acc6cccc44476b3b969ad22a48f MD5 (helix_rev2_back_default.hex) = e66b1195ff6d38e6e22c975b8ae42fd3 ``` * Expressions that are too long are difficult to read, so wrap them. * Edit the expression again * remove `defined(RGBLIGHT_ANIMATIONS)` in `tmk_core/common/*/suspend.c`, `tmk_core/protocol/*/main.c` move contents of rgblight_reconfig.h to rgblight.h. The following changes were made to rgblight.h. ```diff +#ifdef RGBLIGHT_USE_TIMER void rgblight_task(void); void rgblight_timer_init(void); void rgblight_timer_enable(void); void rgblight_timer_disable(void); void rgblight_timer_toggle(void); +#else +#define rgblight_task() +#define rgblight_timer_init() +#define rgblight_timer_enable() +#define rgblight_timer_disable() +#define rgblight_timer_toggle() +#endif ``` The following changes were made to tmk_core/common/avr/suspend.c, tmk_core/common/chibios/suspend.c, tmk_core/protocol/chibios/main.c, tmk_core/protocol/lufa/lufa.c, tmk_core/protocol/vusb/main.c. ```diff -# ifdef RGBLIGHT_ANIMATIONS rgblight_timer_enable(); -# endif ``` ```diff -#if defined(RGBLIGHT_ANIMATIONS) && defined(RGBLIGHT_ENABLE) +#if defined(RGBLIGHT_ENABLE) rgblight_task(); #endif ``` * remove 'defined(RGBLIGHT_ANIMATIONS)' in tmk_core/common/keyboard.c Co-authored-by: Joel Challis <git@zvecr.com>
2020-03-07Fix up Arm builds with nix-shell. (#8312)Nick Brassel