Commit Graph

1439 Commits (972f8ba69ae34420009082b0e89ee6c018f3de69)

Author SHA1 Message Date
Ryan 806aa9bc67
Remove comments about custom ldscript for Teensy LC (#11224) 2020-12-23 15:01:44 +11:00
QMK Bot 603d5fbeb1 Merge remote-tracking branch 'origin/master' into develop 2020-12-22 17:52:34 +00:00
Joshua Diamond f40b564683
Partial fix for Issue #9405 - Caps Lock not working with Unicode Map's XP on Linux (#11232) 2020-12-23 04:51:47 +11:00
QMK Bot 96a5e560d7 Merge remote-tracking branch 'origin/master' into develop 2020-12-22 17:23:53 +00:00
Joshua Diamond 54e2bf3ede
Fix Issue #9533 - Delayed shift state handling (#11220)
Co-authored-by: Ryan <fauxpark@gmail.com>
2020-12-22 18:23:09 +01:00
QMK Bot 06f9297f94 Merge remote-tracking branch 'origin/master' into develop 2020-12-18 17:29:08 +00:00
Joel Challis a9f7d4dccc
Various compilation fixes for avr-gcc 10 (#9269) 2020-12-18 17:28:29 +00:00
Ryan 115b60b0e1
Fix duplicate I2C_KEYMAP_START define (#11237) 2020-12-17 15:49:24 +00:00
fauxpark 7797070b37 Merge remote-tracking branch 'upstream/master' into develop 2020-12-18 02:15:28 +11:00
Ryan 6ea4b06f9f
Run cformat and dos2unix manually (#11235) 2020-12-17 14:06:30 +00:00
Casey Webster 5e2b53541b
Add modifier state to the split keyboard transport (#10400)
* Add modifier state to the split transport

This adds modifier state to the i2c and serial transport for split
keyboards.  The purpose of this is to allow e.g. displaying modifier
state on the slave side of a split keyboard on an oled.  This adds one
byte to the data transferred between halves.

This also fixes a missing ifdef guard for BLACKLIGHT_ENABLE.

Break modifiers into real/weak/oneshot

Fix incorrect slave serial mod setting

Fix typo in serial weal mod setter

Fix build errors for the I2C code that I introduced

Code cleanup and formatting per project preferences

Correctly get oneshot mods

Fix missing braces

Remove unneeded ifdef guard

Make the added state transport optional

Add documentation for the new define to enable this feature

Fix stray grave mark

* Fix error introduced in conflict resolution
2020-12-17 16:21:26 +11:00
QMK Bot 2e0f2025bd Merge remote-tracking branch 'origin/master' into develop 2020-12-16 03:27:52 +00:00
Ryan 9366ed7282
Normalise include statements in keyboard code (#11185) 2020-12-16 14:27:23 +11:00
QMK Bot 416dea2c54 Merge remote-tracking branch 'origin/master' into develop 2020-12-16 03:25:18 +00:00
Ryan 37fb14f1b5
CLI-ify rgblight_breathing_table_calc.c (#11174)
Co-authored-by: Takeshi ISHII <2170248+mtei@users.noreply.github.com>
Co-authored-by: Zach White <skullydazed@drpepper.org>
2020-12-16 14:24:42 +11:00
QMK Bot 11ee2736bd Merge remote-tracking branch 'origin/master' into develop 2020-12-12 18:19:43 +00:00
Takeshi ISHII 10e4487ba3
Fix incorrect search order for `rgblight_breathe_table.h` that `rgblight.c` includes. (#11192)
When `rgblight.c` includes `rgblight_breathe_table.h`, the search order should be as follows.

* `keyboards/KEYBOARD/keymaps/USER/rgblight_breathe_table.h`
* `users/USER/rgblight_breathe_table.h`
* `quantum/rgblight_breathe_table.h`

However, the current implementation was wrong, so I fixed it.
2020-12-13 03:19:15 +09:00
QMK Bot d7e285a4d9 Merge remote-tracking branch 'origin/master' into develop 2020-12-11 19:00:42 +00:00
Hedgestock 8ea7f4f45f
Fixed french quotes on canadian multilingual (#11183) 2020-12-11 19:00:07 +00:00
QMK Bot fdfcce57e1 Merge remote-tracking branch 'origin/master' into develop 2020-12-11 02:46:19 +00:00
Ryan 501f2fdef1
Normalise include statements in core code (#11153)
* Normalise include statements in core code

* Missed one
2020-12-11 13:45:24 +11:00
QMK Bot e199fb6190 Merge remote-tracking branch 'origin/master' into develop 2020-12-06 06:16:19 +00:00
Josh Hinnebusch c59f87a5d7
add definition WS2812_BYTE_ORDER to fix RGB LED issues (#10184)
* add define for WS2812B-2020 to fix RGB issues

* update driver doc

* add WS2812_BYTE_ORDER definition to correct RGB byte issues

* add definition variable thing

* update per PR request

* update per PR reqs

* update per PR request

* inital changes

* move defines to color.h and add rgbw incase

* Update docs/ws2812_driver.md

Co-authored-by: Ryan <fauxpark@gmail.com>

Co-authored-by: hineybush <hineybushkeyboards@gmail.com>
Co-authored-by: Xelus22 <preyas22@gmail.com>
Co-authored-by: Ryan <fauxpark@gmail.com>
2020-12-06 17:15:48 +11:00
QMK Bot 5cfbfc2c52 Merge remote-tracking branch 'origin/master' into develop 2020-12-06 06:11:48 +00:00
r-pufky 08bf9f9e74
Add definitions for RGB off/black. (#11132) 2020-12-06 17:10:58 +11:00
QMK Bot 684773f2d4 Merge remote-tracking branch 'origin/master' into develop 2020-12-05 06:01:27 +00:00
Sergey Omelchenko e3888281f4
Fix missing define to map rgb_matrix function set to rgblight. (#11084) 2020-12-05 17:00:58 +11:00
XScorpion2 a8d0ec0749
[Split] Sync Timer feature (#10997)
A timer that is kept in sync between the halves of a split keyboard
2020-12-01 10:04:42 -08:00
James Young c66df16644
2020 November 28 Breaking Changes Update (#11053)
* Branch point for 2020 November 28 Breaking Change                                                

* Remove matrix_col_t to allow MATRIX_ROWS > 32 (#10183)                                           

* Add support for soft serial to ATmega32U2 (#10204)                                               

* Change MIDI velocity implementation to allow direct control of velocity value (#9940)            

* Add ability to build a subset of all keyboards based on platform.                                

* Actually use eeprom_driver_init().                                                               

* Make bootloader_jump weak for ChibiOS. (#10417)                                                  

* Joystick 16-bit support (#10439)                                                                 

* Per-encoder resolutions (#10259)                                                                 

* Share button state from mousekey to pointing_device (#10179)                                     

* Add hotfix for chibios keyboards not wake (#10088)                                               

* Add advanced/efficient RGB Matrix Indicators (#8564)                                             

* Naming change.                                                                                   

* Support for STM32 GPIOF,G,H,I,J,K (#10206)                                                       

* Add milc as a dependency and remove the installed milc (#10563)                                  

* ChibiOS upgrade: early init conversions (#10214)                                                 

* ChibiOS upgrade: configuration file migrator (#9952)                                             

* Haptic and solenoid cleanup (#9700)                                                              

* XD75 cleanup (#10524)                                                                            

* OLED display update interval support (#10388)                                                    

* Add definition based on currently-selected serial driver. (#10716)                               

* New feature: Retro Tapping per key (#10622)                                                      

* Allow for modification of output RGB values when using rgblight/rgb_matrix. (#10638)             

* Add housekeeping task callbacks so that keyboards/keymaps are capable of executing code for each main loop iteration. (#10530)

* Rescale both ChibiOS and AVR backlighting.                                                       

* Reduce Helix keyboard build variation (#8669)                                                    

* Minor change to behavior allowing display updates to continue between task ticks (#10750)        

* Some GPIO manipulations in matrix.c change to atomic. (#10491)                                   

* qmk cformat (#10767)                                                                             

* [Keyboard] Update the Speedo firmware for v3.0 (#10657)                                          

* Maartenwut/Maarten namechange to evyd13/Evy (#10274)                                             

* [quantum] combine repeated lines of code (#10837)                                                

* Add step sequencer feature (#9703)                                                               

* aeboards/ext65 refactor (#10820)                                                                 

* Refactor xelus/dawn60 for Rev2 later (#10584)                                                    

* add DEBUG_MATRIX_SCAN_RATE_ENABLE to common_features.mk (#10824)                                 

* [Core] Added `add_oneshot_mods` & `del_oneshot_mods` (#10549)                                    

* update chibios os usb for the otg driver (#8893)                                                 

* Remove HD44780 References, Part 4 (#10735)                                                       

* [Keyboard] Add Valor FRL TKL (+refactor) (#10512)                                                

* Fix cursor position bug in oled_write_raw functions (#10800)                                     

* Fixup version.h writing when using SKIP_VERSION=yes (#10972)                                     

* Allow for certain code in the codebase assuming length of string. (#10974)                       

* Add AT90USB support for serial.c (#10706)                                                        

* Auto shift: support repeats and early registration (#9826)                                       

* Rename ledmatrix.h to match .c file (#7949)                                                      

* Split RGB_MATRIX_ENABLE into _ENABLE and _DRIVER (#10231)                                        

* Split LED_MATRIX_ENABLE into _ENABLE and _DRIVER (#10840)                                        

* Merge point for 2020 Nov 28 Breaking Change
2020-11-28 12:02:18 -08:00
Ryan 3afe0ea9b9
ST7565 tidyup (#10907) 2020-11-26 23:44:17 +11:00
Geoffrey BOTIN 2ffac90c99
Fix typo causing `redefined error` in keymap_french_osx (#10962)
Co-authored-by: gbotin <geoffrey.botin@gmail.com>
2020-11-17 09:27:09 +11:00
Joel Challis 94e94ffb5b
Recommend use of LED Indicator config (#10895)
* Recommend use of LED Indicator config

* Recommend use of LED Indicator config - update link

* Update quantum/template/ps2avrgb/config.h

Co-authored-by: Ryan <fauxpark@gmail.com>

Co-authored-by: Ryan <fauxpark@gmail.com>
2020-11-16 14:16:42 +11:00
Joel Challis 1ff5ee255f
Indicator LEDs as config (#10816)
* First pass

* Add config options to docs

* Update some wording

* Slight tidy up of backlight caps logic

* Init pin to correct state

* Move init location

* Reverse default state
2020-11-08 22:31:16 +00:00
X-Bows Tech f2eb080aa2
Add support for 4 IS31FL3731 devices (#10860)
This is a simple change.Support for IS31FL3731 has been changed from 2 to 4.
2020-11-05 19:58:46 +00:00
Ryan 2c92ee1f56
Allow modified keycodes in Unicode input (#10658) 2020-10-27 06:14:56 +11:00
Félix Sanz 168ce1a743
Update keymap_spanish_dvorak.h (#10213)
Co-authored-by: Ryan <fauxpark@gmail.com>
2020-10-23 04:42:34 +11:00
Ryan 6c78f80fa1
Partial fix for sendstring_french.h (#10623) 2020-10-13 03:17:11 +11:00
a_p_u_r_o bc79e51990
Fix issue introduced by PR#10404 (#10559) 2020-10-07 13:30:43 +11:00
3araht 2bcac45650
Fix for MIDI sustain effect issue (#10361) 2020-10-04 14:32:24 -07:00
QMK Bot c8cff1489a format code according to conventions [skip ci] 2020-10-04 20:54:31 +00:00
Drashna Jaelre c4f910b1b3
Merge pull request #10404 from cmdremily/opendeck-core
Allow the use of only one IS31FL3731 LED driver
2020-10-04 13:05:26 -07:00
sol 01d2a03258
Fix SPLIT_KEYBOARD compilation for ATMega*U2, which doesn't have VBUS/OTG control (#10460)
Co-authored-by: s-ol <s-ol@users.noreply.github.com>
2020-10-02 04:17:03 +10:00
Ryan 70fce6564f
Add logic for AT90USBxx7 where needed (#10203) 2020-09-27 20:33:03 +10:00
Ryan c16ee22784
`setrgb()`: Use arrow operator (#10451) 2020-09-26 19:42:40 +01:00
Ryan b6f9ca3b09
Fix Belgian sendstring properly (#10444) 2020-09-26 14:14:34 +10:00
Drashna Jaelre 9570b1bbb4
Fix Belgian sendstring file (#10443)
Specifically, the `BE_CIRC` is an alt-ed keycode, which means it 
doesn't fit into the 8 bit keycode range...  It should be `BE_SECT`,
as it is already alt-ed by the alt lut.

Confirmed that this change fixes compilation warnings and works 
correctly, on reddit. 
https://www.reddit.com/r/olkb/comments/iywin1/unsigned_conversion_from_int_to_unsigned_char/g6jvfgl/
2020-09-26 05:34:38 +10:00
cmdremily ef7c79b781 Fix issues with unused variables and functions preventing a clean compile. 2020-09-23 14:15:25 +02:00
cmdremily 8711dda0d3 Allow the use of a single IS31FL3731 LED driver 2020-09-23 14:15:25 +02:00
Wilba bc7a745227
Fix typo in via.c (#10000) 2020-09-21 04:21:19 -07:00
Ryan 0140baf7e0
Add STM32F401/F411 to mcu_selection.mk (#10278)
* Reorder STM32 MCUs

* Add STM32F4xx to mcu_selection.mk

* Set MCU for phoenix and tkw/stoutgat/v2/f411
2020-09-18 20:00:18 -07:00
Xelus22 97122d203b
[Core] DYNAMIC_KEYMAP_EEPROM_MAX_ADDR check (#10315)
* add error check

* remove quotes

* update error message

Co-authored-by: Ryan <fauxpark@gmail.com>

Co-authored-by: Ryan <fauxpark@gmail.com>
2020-09-16 16:16:01 +10:00
Purdea Andrei f7ccbfcea8
quantum/debounce: rename debouncing algorithms (#9564)
* quantum/debounce: rename debouncing algorithms according to Issue 8763

This is the second attempt at implementation, with no ts_ and cy_ prefixes, since those will be implemented with macros.

* Debouncing documentation: Refactor, add some generic info, and merge into a single document
2020-09-06 13:13:49 -07:00
Olivier Li 9bca381b98
Unflip < and > for canadian mutlilingual (#10222)
Co-authored-by: Olivier Li <olivierli@google.com>
2020-09-06 09:51:38 +10:00
Félix Sanz 69804bb243
Fixed Spanish keymap extra ES_DIAE symbol (#10211)
* Fixed Spanish keymap extra ES_DIAE symbol

`ES_DIAE` should be `S(ES_ACUT)` not `S(ES_GRV)`

* Update quantum/keymap_extras/keymap_spanish.h

Co-authored-by: Ryan <fauxpark@gmail.com>

Co-authored-by: Ryan <fauxpark@gmail.com>
2020-09-01 08:23:31 +10:00
QMK Bot a3db72df72 format code according to conventions [skip ci] 2020-08-29 22:57:48 +00:00
Ryan 629cfc7f5e K-Type refactor (#9864)
* K-Type refactor

* Declare QMK in product name again

* Hopefully fix matrix scanning

* Maybe this time

* Partial (literally) RGB Matrix support

* Put RGB_MATRIX_ENABLE into rgb keymap for now

* Add ifdefs for RGB config

* Set layer 1 to actually be layer 1...

* Update keyboards/k_type/readme.md

* Put all RGB config in keymap for now

* Set SDB high?

* Before `rgb_matrix_init()` would be best

* User level, not keyboard

* Combating dropped keys

* Nope

* Readme for RGB keymap

* Remove custom matrix
2020-08-29 14:30:02 -07:00
Ryan b89b2030af Kiibohd bootloader, take 2 (#10129) 2020-08-29 14:30:02 -07:00
Joel Challis 15b5ff1dc2 Remove f072 backlight warning (#10040)
* Remove f072 backlight warning

* Remove f072 backlight warning from docs
2020-08-29 14:30:02 -07:00
Joel Challis 21a00b7f02 ARM backlight - timer implementation (#8291)
* Add GPT timer based backlight driver

* Update to tim15 to avoid conflict with audio

* Update quantum/backlight/backlight_timer.c
2020-08-29 14:30:02 -07:00
Greg Wright 568cae28ec #define AUTO_SHIFT_SETUP (#8441)
* #define AUTO_SHIFT_SETUP

* Clarification

Changed `#ifndef` to `#ifdef` and moved enable disable outside AUTO_SHIFT_SETUP

* AUTO_SHIFT_NO_SETUp
2020-08-29 14:30:02 -07:00
David Kosorin dba8148764 Fix Czech keycodes (#9987) 2020-08-29 14:30:02 -07:00
Tynan Beatty e34eca361f Noeeprom functions for rgb_matrix (#9487)
* Add eeprom_helpers for toggle, mode, sethsv, speed; add set_speed; add noeeprom versions of toggle, step, hue, sat, val, and speed

* qmk cformat rgb_matrix

* Add rgb_matrix_set_speed and *_noeeprom functions

* Do not expose rgb_matrix_*_eeprom_helper functions
2020-08-29 14:30:02 -07:00
Nick Brassel c990dc1e6c Add support for hsv->rgb conversion without using CIE curve. (#9856)
* Add support for hsv->rgb conversion without using CIE curve.

* Modify anavi/macropad8 to disable unicode (was unused), otherwise firmware size is too large.
2020-08-29 14:30:02 -07:00
TerryMathews 4764aa8711 The Key Company project consolidation (#9547)
* Consolidate TKC projects and increase VIA keymap count to 4.

* Updated readme files.

* Removed config.h via limitation of 2 dynamic keymaps

* Reduce dynamic keymaps from 4 to 3 due to EEPROM space limitations.

* Update dynamic_keymap.c

* Restore 4 dynamic keymaps for VIA in TKC projects.

* Update quantum/dynamic_keymap.c
2020-08-29 14:30:02 -07:00
Max Rumpf 4b74f985ec Tweak the Christmas animation effect to be less harsh on the eyes (#7648)
* Tweak the Christmas animation effect to be less harsh on the eyes

* Further improve the tweaked Christmas animation code

- Use constants where it makes sense
- Instead of complicated math, use a static variable to keep track if it's animating from or to red
- Don't use pow (but a simple macro instead)
- Using floating point math is necessary for the fraction in the cubic bezier function to work

* Update docs for the tweaked Christmas animation effect

* Further improve memory usage

- Don't use floats, but 32 bit ints instead (where needed)
- Replace limits.h with constant

* Fix typo
2020-08-29 14:30:02 -07:00
a-chol d4be07dad3 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>
2020-08-29 14:30:02 -07:00
Drashna Jaelre 9d3b26a475 Update features to use Custom Tapping Term when appropriate (#6259)
* Update Space Cadet to use Custom Tapping Term functionality

* Detect correct keycode for space cadet tapping term

* Update tap dancing to use global custom tapping term

* Update documentation for Tap Dances

* formatting pass

* Apply suggestions from code review

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Update docs/feature_tap_dance.md

Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com>

* Update for future

* Update user keymaps for space cadet

* Fix typos

* Clean up tapping term stuff

* Fix compiler issue if NO_ACTION_TAPPING is enabled

Co-authored-by: fauxpark <fauxpark@gmail.com>
Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com>
2020-08-29 14:30:02 -07:00
Pete Sevander b0335b2731 Bigger combo index (#9318)
* Add change log

* Change combo index from uint8_t to uint16_t
2020-08-29 14:30:02 -07:00
Ryan 3b34858b77 Don't compile outputselect.c if Bluetooth is disabled (#9356) 2020-08-29 14:30:02 -07:00
Ryan 69e0ad1b2c Additional cleanups for V-USB code (#9310) 2020-08-29 14:30:02 -07:00
Nick Brassel 385d49cc39 Initial work for consolidation of ChibiOS platform files (#8327)
* Initial work for consolidation of board files and default ChibiOS configs.

* Migrate F401/F411 black pills for testing.

* Add early init bootloader jump flag.

* Add support for I2C in order to use i2c_scanner keymap.

* Add F401/F411 HSE bypass to get things booting.

* Exempt "hooked" ChibiOS conf files from updater script.

* Fix up ordering for bootloader_defs file check.

* Match previous $(KEYBOARD_PATHS) value for Proton-C, updated for all board configs.
2020-08-29 14:30:02 -07:00
Drashna Jaelre b338a4d886
Add noeeprom speed function for RGBLIGHT (#9706)
* [Docs] Add Speed functions to RGB Light docs

* Add noeeprom functions for speed

* Fix wording in doc

Co-authored-by: Ryan <fauxpark@gmail.com>

Co-authored-by: Ryan <fauxpark@gmail.com>
2020-08-25 19:08:09 +10:00
Drashna Jaelre 1fd2f2f022
Compiler warning when using WS2812 (#9955)
Specifically, when rgb matrix is enabled and using the ws2812 driver, and rgb light is enabled at the same time, print a message about coexistance because it can cause issues, since you cannot change pins/config for the WS2812 driver.
2020-08-25 19:05:39 +10:00
nopunin10did b4ae7badd4
Issue 9942: Add LSA, RSA, RCS, LSA_T, RSA_T, and RCS_T (#9943)
* Issue 9942: Add Quantum defines

Add codes to quantum_keycodes for LSA, RSA, RCS, and their corresponding _T macros

* 9942: Add documentation for new defines

Add documentation for new defines in feature request 9942. Also define SAGR and SAGR_T as aliases for RSA and RSA_T.

* Update quantum/quantum_keycodes.h

* Update docs/keycodes.md

* Update docs/keycodes.md

* Update docs/keycodes.md

* Update docs/keycodes.md
2020-08-17 02:08:15 -07:00
Drashna Jaelre 4c14b11fc7
Add Indicator flag for RGB Matrix (#9933)
* Add Indicator flag for RGB Matrix

This adds a new flag for the RGB Matrix feature that lets you specify if the LED is an indicator LED, to be used to indicate the system state of the keyboard (eg caps/num/etc lock status, layer indication, modifer status, etc).

* Better formatting of table
2020-08-05 13:29:04 -07:00
BeefaloKing 349646bfe0
Fix RGB_DISABLE_TIMEOUT overflow warning (#9866) (#9874)
* Fix RGB_DISABLE_TIMEOUT overflow warning (#9866)

* Adjust capitalization (#9874)
2020-08-04 21:03:29 -07:00
Konstantin Đorđević 61b64bb82a
Redefine IS_LAYER_ON/OFF() as aliases for existing layer functions (#6352)
* Add IS_LAYER_ON_STATE()/IS_LAYER_OFF_STATE() macros

* Add docs for IS_LAYER_ON/OFF(_STATE) macros

* Remove IS_LAYER_ON/OFF_STATE redefinition in userspace

* Run clang-format on quantum/quantum.h

* Redefine IS_LAYER_ON/OFF(_STATE) as aliases of existing layer functions

Also update relevant doc entries.

Needs testing to check if this breaks existing IS_LAYER_ON/OFF usage in certain
edge cases (namely calling the macros with 0).

* Reformat layer check function docs
2020-07-16 22:27:55 +10:00
Drashna Jaelre f11437aef3
Allow for user song list (#9281) 2020-07-16 16:45:50 +10:00
Hedgestock fc13315300
Fixed CA_DOTA key code (#9722) 2020-07-16 15:50:51 +10:00
Ryan 72d3270547
Remove `DESCRIPTION` (#9732) 2020-07-16 15:49:18 +10:00
Ryan e8d577c081
Update new keyboard templates (#9636)
* Update new keyboard templates

* Switch on Bootmagic Lite by default

* Remove MIDI_ENABLE and FAUXCLICKY_ENABLE
2020-07-15 18:52:02 +10:00
Drashna Jaelre 584d38b5f5
Fix RGB Matrix using RGBW WS2812 LEDs (#9705)
This should be a pointer, as that is what the function expects.
2020-07-13 23:28:42 +01:00
Joel Challis aec4125989
Refactor ARM backlight (#7959) 2020-07-10 09:12:40 +01:00
Oskar Holstensson ca598c3df6
Changed US_RBRC to KC_RBRC instead of KC_LBRC (#9664) 2020-07-08 21:45:43 +01:00
Guillaume Gérard 5f9fb01020
[Keymap Extra] Add French AZERTY (AFNOR - NF Z71-300) (#9644)
Co-authored-by: Ryan <fauxpark@gmail.com>
2020-07-08 19:55:02 +01:00
QMK Bot 9ae15e8c79 format code according to conventions [skip ci] 2020-07-07 21:43:51 +00:00
Dongfeng Yu 666cb44673
Allowing Pressing the Start Buttons Again to Stop Dynamic Macro Recording (#9446) 2020-07-07 21:59:13 +01:00
QMK Bot 355f075b57 format code according to conventions [skip ci] 2020-07-04 15:01:25 +00:00
Takeshi ISHII c2ca57c8f4
add DIP_SWITCH_MATRIX_GRID support (#8772)
* dipsw test on helix/rev2/sc/back:five_rows

* add peek_matrix() to matrix_common.c

* add DIP_SWITCH_MATRIX_GRID support to quantum/dip_switch.c

* update docs/feature_dip_switch.md about DIP_SWITCH_MATRIX_GRID

* Test end. remove test code. Revert "dipsw test on helix/rev2/sc/back:five_rows"

This reverts commit 6d4304c74557597c9fb4d324f79c3ae4793ae874.
2020-07-04 23:20:49 +09:00
Takeshi ISHII 5c8b23ccff
add SPLIT_HAND_MATRIX_GRID support (#8685)
Co-authored-by: Danny <nooges@users.noreply.github.com>
2020-07-04 15:04:47 +01:00
Olli b30d0361c5
Fix “G” in Neo2 keymap (#9645)
Fix duplicated “NE_H” definition to use “NE_G” in Neo2 keymap,
introduced with commit 44ff14f.
2020-07-04 11:43:52 +01:00
Ryan 00fc35539d
Make sendstring respect `TAP_CODE_DELAY` (#9623) 2020-07-02 18:08:19 +01:00
Guillaume Gérard 9b85bd68a4
feat: add dvorak-fr as extra keymap (#9512) 2020-06-24 22:52:40 -07:00
Joshua Diamond 4b80ee46f8
Add Hebrew keymap aliases (#9383)
* Add Hebrew keymap aliases

* Use NBSP for internal space in box drawings

* Apply suggestions from code review

* More whitespace fixes

* IL_DVAV, IL_DYOD and IL_VYOD were incorrect

* Add IL_DEG, IL_MUL, IL_DIV

* Hebrew is now ISO (no more BAE)

* Use ISO left shift

* Apply suggestions from code review

* DYOD and VYOD were reversed in diagram.

Oops!
2020-06-23 22:35:43 -07:00
Drashna Jaelre 98642ca028
Improve keycode handling for RGB (#7677)
Co-authored-by: drashna <drashna@live.com>
Co-authored-by: noroadsleft <18669334+noroadsleft@users.noreply.github.com>
2020-06-22 09:38:58 +01:00
Nick Brassel 3d6d899666
`qmk cformat` (#9500) 2020-06-22 11:21:48 +10:00
Drashna Jaelre 30cdf9331a
Change `led` variable in rgb_matrix_drivers to avoid conflicts (#9412)
* Change `led` to `led_matrix` in rgb_matrix_drivers

Is a minor change that only affects the driver file. 

However, this will allow somebody to run rgblight along side rgb matrix
using the ws2812 driver, as well.  Specifically, so you can use the
custom driver for rgblight to set a different pin (barring a change to
the `ws2812_setleds` function).  

Courtesy of discord conversion:
https://discordapp.com/channels/440868230475677696/568161140534935572/721555623191248906

* Change name to be super specific

* Update rgb_matrix_drivers.c
2020-06-20 23:07:26 +01:00
MelGeek d9eae3ef03
Support IS31FL3741 and IS31FL3741A. (#9201) 2020-06-20 14:49:15 +10:00
Jason Laqua f7eb030e91
Standardize how unicode is processed (fixes #8768) (#8770)
Co-authored-by: Konstantin Đorđević <vomindoraan@gmail.com>
2020-06-18 08:07:34 +01:00
itsnoteasy 7aa4cc9603
adds support for the atmega328 (#9043)
Co-authored-by: Ryan <fauxpark@gmail.com>
2020-06-10 22:23:11 +01:00
Adrian cff3c3bf28
Fixed slave-side keyboard half unresponsiveness (#9360)
* Fixed slave-side keyboard half unresponsiveness
due to how LUFA handles USB_Disable()

* changes to formatting

Co-authored-by: Joel Challis <git@zvecr.com>

Co-authored-by: Joel Challis <git@zvecr.com>
2020-06-10 17:25:45 +01:00
Joel Challis d17572b125
Move encoder_read to common location (#9003) 2020-06-03 00:54:53 +01:00
Drashna Jaelre 1110fe6c6f
Move dip switch init to back of the init process (#9233) 2020-06-03 00:32:02 +01:00
Joshua Diamond 563d5919b3
Fix layer mask size for RGBLIGHT_LAYER_BLINK (#9260) 2020-06-01 17:12:08 -07:00
Joshua Diamond e2e287ec5f
Option to allow lighting layers when RGB Lighting is off (#9051) 2020-06-01 11:02:28 +02:00
Kimat Boven dfcd4f0d25
BE_J should map to KC_J (#9243) 2020-06-01 14:04:44 +10:00
James Young fced377ac0
2020 May 30 Breaking Changes Update (#9215)
* Branch point for 2020 May 30 Breaking Change

* Migrate `ACTION_LAYER_TOGGLE` to `TG()` (#8954)

* Migrate `ACTION_MODS_ONESHOT` to `OSM()` (#8957)

* Migrate `ACTION_DEFAULT_LAYER_SET` to `DF()` (#8958)

* Migrate `ACTION_LAYER_MODS` to `LM()` (#8959)

* Migrate `ACTION_MODS_TAP_KEY` to `MT()` (#8968)

* Convert V-USB usbdrv to a submodule (#8321)

* Unify Tap Hold functions and documentation (#8348)

* Changing board names to prevent confusion (#8412)

* Move the Keyboardio Model01 to a keyboardio/ subdir (#8499)

* Move spaceman keyboards (#8830)

* Migrate miscellaneous `fn_actions` entries (#8977)

* Migrate `ACTION_MODS_KEY` to chained mod keycodes (#8979)

* Organizing my keyboards (plaid, tartan, ergoinu) (#8537)

* Refactor Lily58 to use split_common (#6260)

* Refactor zinc to use split_common (#7114)

* Add a message if bin/qmk doesn't work (#9000)

* Fix conflicting types for 'tfp_printf' (#8269)

* Fixed RGB_DISABLE_AFTER_TIMEOUT to be seconds based & small internals cleanup (#6480)

* Refactor and updates to TKC1800 code (#8472)

* Switch to qmk forks for everything (#9019)

* audio refactor: replace deprecated PLAY_NOTE_ARRAY (#8484)

* Audio enable corrections (2/3) (#8903)

* Split HHKB to ANSI and JP layouts and Add VIA support for each (#8582)

* Audio enable corrections (Part 4) (#8974)

* Fix typo from PR7114 (#9171)

* Augment future branch Changelogs (#8978)

* Revert "Branch point for 2020 May 30 Breaking Change"
2020-05-30 13:14:59 -07:00
Nick Brassel fd4f102977
Fix build. (#9163) 2020-05-22 06:25:03 +10:00
Joel Challis 526c185e7e
Initial arm serial partially based on old lets split code (#7072) 2020-05-21 19:39:51 +01:00
QMK Bot c63fd051da format code according to conventions [skip ci] 2020-05-21 17:39:29 +00:00
zvecr b95979560c Initial arm serial partially based on old lets split code 2020-05-21 18:04:30 +01:00
Joel Challis 205321c377
Slight speed increases for matrix scanning (#9150) 2020-05-21 17:59:56 +01:00
Joel Challis 1816ad01d0
Use LUFA funcs for split_util (#8594) 2020-05-21 17:59:01 +01:00
QMK Bot 010c5b12bd format code according to conventions [skip ci] 2020-05-18 13:42:23 +00:00
Drashna Jaelre d0e0202b27
Add query functions for RGB Light and RGB Matrix (#8960)
* Add additional query functions for RGBLIGHT

* Add additional query functions for RGB Matrix

* Change names of enable check functions

* Fix macro for rgb matrix takeover of rgblight functions

* Add documentation for rgb_matrix_get_hsv()

* Add *_get_hsv function to rgblight
2020-05-18 06:05:35 -07:00
Ryan ce842f912e
Remove `DEBUG_LEVEL` from V-USB rules.mk (#9117) 2020-05-17 21:37:04 +01:00
Zsolt Parragi 805f5cb72b
One shot support for swap hands (#8590)
This commits add the SH_OS keycode, which works similarly to one shot
layers:
* while pressed, the keyboard is swapped
* if no keys were pressed while it was pressed, the next key press is
swapped

SH_OS also supports chaining with one shot layers:
OSL(x) + SH_OS + key interprets the key press on the oneshot layer.

The ONESHOT_TIMEOUT setting used by one shot keys and layers is also
used by oneshot swap hands. In the above chaining scenario the timeout
of the oneshot layer is reset when swap hands is activated.

Resolves #2682
2020-05-14 07:36:55 +10:00
Joshua Diamond a8a8bf0ff3
Allow expanding from 8 to 32 RGB Lighting Layers (#8941)
* Allow 16 lighting layers

* Require #define RGBLIGHT_LAYERS_16 to enable 16 layers

* Override RGBLIGHT_MAX_LAYERS to set maximum number of lighting layers

* Enforce lower bound on RGBLIGHT_MAX_LAYERS

Co-Authored-By: Takeshi ISHII <2170248+mtei@users.noreply.github.com>

* Fix an error in the check for valid RGBLIGHT_MAX_LAYERS

* Don't use bitfield / PACKED, as it causes bloat

* Update documentation re: up to 32 lighting layers

* Run cformat

* Add note about increasing FW size in docs/config_options.md

Co-authored-by: Drashna Jaelre <drashna@live.com>

* Remove no-longer-valid comment

* Add doc note that split sync will be slower

Co-authored-by: Takeshi ISHII <2170248+mtei@users.noreply.github.com>
Co-authored-by: Drashna Jaelre <drashna@live.com>
2020-05-13 21:39:05 +01:00
Ryan 44ff14f290
Update Neo2 keymap (#9063) 2020-05-13 19:34:55 +01:00
Ryan 741c7d5eec
Update Canadian Multilingual keymap and add sendstring LUT (#8786) 2020-05-13 19:34:31 +01:00
QMK Bot e7860d673b format code according to conventions [skip ci] 2020-05-09 09:31:49 +00:00
Joshua Diamond 2fe7e221ec
New RGB Lighting effect: Twinkle (#8887)
* Add twinkle RGB Lighting effect

* 2nd twinkle algo - double-buffering

* Further refinement: Per-LED twinkle

* Add documentation for Twinkle RBG Lighting mode

* Bias twinkle saturation closer to the set value

* Fix whitespace
2020-05-09 01:56:16 -07:00
Joshua Diamond e0f548085c
Add ability to blink lighting layer for a specified duration (#8760)
* Implement momentarily blink of lighting layers

* Refactor spidey3 userspace to use rgb layer blink

* Remove un-necessary line from example in documentation

* Revert "Refactor spidey3 userspace to use rgb layer blink"

This reverts commit 831649bb680c41c6d663ae6fa86d13f4f8bebdd8.

* Adds a missing bit of documentation about lighting layer blink

* Update docs/feature_rgblight.md per suggestions

Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com>

* Update docs/feature_rgblight.md per suggestions

Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com>

* Update docs/feature_rgblight.md per suggestions

Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com>

* cformat, as suggested

Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com>
2020-05-09 01:38:33 -07:00
Konstantin Đorđević 94fc32f431
Fix bug in UC_RMOD, add shift and audio support for UC_MOD/UC_RMOD(#8674)
* Invert UC_MOD/UC_RMOD direction when Shift is held

Also use MOD_MASK_SHIFT in process_rgb.c

* Allow audio to be played for UC_MOD, UC_RMOD keycodes as well

* Fix signedness bug in reverse input mode cycling

* Misc formatting in process_unicode_common.c

* Address clang-format issues

* Make decode_utf8 helper function file-local (static)
2020-05-09 01:22:02 -07:00
zvecr 406dc2fb2d Move encoder_read to common location 2020-05-02 22:44:36 +01:00
JohSchneider ddd055b1e2
Audio_Enable, AVR template update (#8901)
* Branch point for 2020 May 30 Breaking Change

* audio-configuration: template: audio_avr.c does NOT default to C6

not on its own, it needs a pin configured per define in config.h for audio to actually work
otherwise only parts of the code are included in the firmware, wasting space and possibly breaking builds because auf hitting the firmware-size limits

* audio-configuration: strip comment to bare essentials

Co-Authored-By: Ryan <fauxpark@gmail.com>

* revert future change

Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com>
Co-authored-by: Johannes <you@example.com>
Co-authored-by: Ryan <fauxpark@gmail.com>
Co-authored-by: zvecr <git@zvecr.com>
2020-05-01 21:30:12 +01:00
Ryan 16a15c1cfc
QMK-ify some GPIO macros (#8315) 2020-04-30 16:24:47 +10:00
QMK Bot 231464c49c format code according to conventions [skip ci] 2020-04-29 11:38:51 +00:00
JohSchneider d26a14c169
add 'togglePin' convenience function (#8734)
* add 'togglePin' conveniance function

for AVR and chibios

* drop outmost parantheses

Co-Authored-By: Konstantin Đorđević <vomindoraan@gmail.com>

* toggle pin on avrs

toggle a pin configured as output by writing the corresponding bit to the PIN register

Co-Authored-By: Takeshi ISHII <2170248+mtei@users.noreply.github.com>

* togglepin: add documentation for newly added function

* Update docs/internals_gpio_control.md

Co-Authored-By: Konstantin Đorđević <vomindoraan@gmail.com>

* on AVR: use PORTD to toggle the output

... since not all MCUs support toggling through writing to PIN

Co-Authored-By: Ryan <fauxpark@gmail.com>

Co-authored-by: Johannes <you@example.com>
Co-authored-by: Konstantin Đorđević <vomindoraan@gmail.com>
Co-authored-by: Takeshi ISHII <2170248+mtei@users.noreply.github.com>
Co-authored-by: Ryan <fauxpark@gmail.com>
2020-04-29 04:04:29 -07:00
QMK Bot 812d80efbd format code according to conventions [skip ci] 2020-04-29 08:57:41 +00:00
Drashna Jaelre 86c4c4e91d
Convert clipping variables in rgblight.c to a structure (#7720) 2020-04-29 10:22:28 +02:00
Nick Brassel b17482c3fd
Add SPI master for ChibiOS/ARM. (#8779) 2020-04-29 14:01:20 +10:00
QMK Bot bd639752db format code according to conventions [skip ci] 2020-04-28 07:04:07 +00:00
Ryan aaeef7a833
Add Romanian keymap and sendstring LUT (#8852) 2020-04-28 16:23:48 +10:00
Ryan 43785126a7
Merge pull request #8710 from vomindoraan/keymap_extras_fixup 2020-04-19 19:18:05 +10:00
Konstantin Đorđević ed910c8e97 Add back deprecated SE_AE keycode 2020-04-19 02:56:52 +02:00
joseandres42 195324cc4c
Add dvorak's spanish variant to quantum/keymap_extras (#8732)
* Added dvorak's spanish variant.

* Fixed spacing

* Fixed filename typo

* Applied fixes and suggestions.

* Fixed spacing

* Added sendstring_spanish_dvorak.h

* Fixed sendstring_spanish.h

* Update quantum/keymap_extras/sendstring_spanish_dvorak.h

Co-Authored-By: Ryan <fauxpark@gmail.com>

* Update quantum/keymap_extras/sendstring_spanish.h

Co-Authored-By: Ryan <fauxpark@gmail.com>

* Update quantum/keymap_extras/sendstring_spanish_dvorak.h

Co-Authored-By: Ryan <fauxpark@gmail.com>

Co-authored-by: joseandres42 <joseandres42@Orion-PC.localdomain>
Co-authored-by: Ryan <fauxpark@gmail.com>
2020-04-18 17:12:36 -07:00
Ryan cd5399942b
Merge pull request #8722 from fauxpark/keymap-extras-bepo 2020-04-19 06:58:01 +10:00
Ryan fd4bbd8d11
Update Italian macOS keymaps and add sendstring LUTs (#8701)
* Update Italian macOS keymaps and add sendstring LUTs

* Wrong letter
2020-04-19 06:57:36 +10:00
Ryan f43cb31476
Update French and German macOS keymaps and add sendstring LUTs (#8700) 2020-04-19 06:57:05 +10:00
Ryan 89eb3a9e42
Update Swiss French/German keymaps and add sendstring LUTs (#8689) 2020-04-19 06:56:49 +10:00
fauxpark 09a1917103 Slight rename of double angle quote keycodes 2020-04-13 21:15:37 +10:00
Takeshi ISHII d3c29c9b3c
Bugfix for quantum/dip_switch.c (#8731)
* dipsw test on helix/rev2/sc/back:five_rows

* bug fix quantum/dip_switch.c

* test end. remove test code. Revert "dipsw test on helix/rev2/sc/back:five_rows"

This reverts commit 4b13ebb996e1c4997e6deb1fa3b3227db5fa9661.

* dipsw test on helix/rev2/sc/back:five_rows

* update quantum/dip_switch.c

* test end. remove test code. Revert "dipsw test on helix/rev2/sc/back:five_rows"

This reverts commit bf99ace095528ad65c531229bcf5ece037dda595.
2020-04-12 12:44:24 -07:00
Konstantin Đorđević 370577e4ed
Add *OPT aliases for *ALT keycodes and macros (#8714) 2020-04-12 11:37:55 -07:00
QMK Bot 5380c29dd7 format code according to conventions [skip ci] 2020-04-12 18:11:52 +00:00
artjomsR 23f19852b9
Added Workman ZXCVM variation (#8686)
* Added Workman ZXCVM variation

* Update quantum/keymap_extras/keymap_workman_zxcvm.h

Co-Authored-By: Konstantin Đorđević <vomindoraan@gmail.com>

* Update quantum/keymap_extras/sendstring_workman_zxcvm.h

Co-Authored-By: Ryan <fauxpark@gmail.com>

* Update quantum/keymap_extras/keymap_workman_zxcvm.h

Co-Authored-By: Ryan <fauxpark@gmail.com>

* Update quantum/keymap_extras/keymap_workman_zxcvm.h

Co-Authored-By: Ryan <fauxpark@gmail.com>

* Update quantum/keymap_extras/sendstring_workman_zxcvm.h

Co-Authored-By: Ryan <fauxpark@gmail.com>

Co-authored-by: Konstantin Đorđević <vomindoraan@gmail.com>
Co-authored-by: Ryan <fauxpark@gmail.com>
2020-04-12 10:37:17 -07:00
Drashna Jaelre 23124b9fd1
Fix bug with layer caching in get_event_keycode (#8693)
* Fix bug with layer caching in get_event_keycode

* Improve naming
2020-04-12 17:27:17 +02:00
Purdea Andrei b8c3f4c60b
quantum/debounce: Added sym_pk debounce algorithm (#8587)
* quantum/debounce: Added sym_pk debounce algorithm

* Apply suggestions from code review

Co-Authored-By: Ryan <fauxpark@gmail.com>

* quantum/debounce/sym_pk: delete comments and rename functions following code review

* quantum/debounce/sym_pk: Modifications for code readability according to code review

* quantum/debounce/sym_pk: Modifications for code readability according to code review (2)

* quantum/debounce/sym_pk: code review: cleaner code

Co-Authored-By: Nick Brassel <nick@tzarc.org>

Co-authored-by: Ryan <fauxpark@gmail.com>
Co-authored-by: Nick Brassel <nick@tzarc.org>
2020-04-11 21:29:48 +10:00
QMK Bot cc38627816 format code according to conventions [skip ci] 2020-04-11 00:48:16 +00:00
Purdea Andrei 6c2c3c13e9
Various fixes to how timer differences are calculated (#8585)
* 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-11 10:14:28 +10:00