Commit Graph

608 Commits (7f8faa429e0c0662cec34a7d60e33ca58333d6d7)

Author SHA1 Message Date
QMK Bot 633d2cb648 Merge remote-tracking branch 'origin/master' into develop 2020-12-31 06:21:45 +00:00
Takeshi ISHII 6169b47e82
Add target 'check-md5' to `build_keyboard.mk` (#11338)
* Add target 'build-for-compare' to `build_keyboard.mk`

The `build-for-compare` target provides an easy way to check the md5 checksum of the generated binary.

You can easily see if there is any change in the generated binaries between the two versions, as in the example below.

```
$ git checkout 0.11.0
M	build_keyboard.mk
M	tmk_core/rules.mk
Note: checking out '0.11.0'.
HEAD is now at c66df1664 2020 November 28 Breaking Changes Update (#11053)

$ make helix:all:build-for-compare | grep ^MD5
MD5 (.build/helix_rev2_default.hex) = 5c3606562c944bb4d18832e601b45d4a
MD5 (.build/helix_rev2_edvorakjp.hex) = 9e43d13d389d518ba7e99cd7337e28d6
MD5 (.build/helix_rev2_five_rows.hex) = 8bcb61c2fd5d237c2997f2fa007d4934
MD5 (.build/helix_rev2_five_rows_jis.hex) = b97cd818d52f73ca2d4e78c86d90a791
MD5 (.build/helix_rev2_froggy.hex) = c492172364188f4e2918b10bf0f3a0a6
MD5 (.build/helix_rev2_froggy_106.hex) = b0861fd735a8f81881a8c02730641a2b
MD5 (.build/helix_rev2_led_test.hex) = 5c97d982a5da5cfb3dacb28a8934b81d
MD5 (.build/helix_rev2_xulkal.hex) = 01f603dc46bcf9094d7e106831d8f5b1
MD5 (.build/helix_rev2_yshrsmz.hex) = 5a008bca2d0c5790a151c02834c529ba

$ git checkout 0.11.1
M	build_keyboard.mk
M	tmk_core/rules.mk
Previous HEAD position was c66df1664 2020 November 28 Breaking Changes Update (#11053)
HEAD is now at cc08e3082 nix-shell: add milc dependency (#11086)

$ make helix:all:build-for-compare | grep ^MD5
MD5 (.build/helix_rev2_default.hex) = 5c3606562c944bb4d18832e601b45d4a
MD5 (.build/helix_rev2_edvorakjp.hex) = 9e43d13d389d518ba7e99cd7337e28d6
MD5 (.build/helix_rev2_five_rows.hex) = 8bcb61c2fd5d237c2997f2fa007d4934
MD5 (.build/helix_rev2_five_rows_jis.hex) = b97cd818d52f73ca2d4e78c86d90a791
MD5 (.build/helix_rev2_froggy.hex) = c492172364188f4e2918b10bf0f3a0a6
MD5 (.build/helix_rev2_froggy_106.hex) = b0861fd735a8f81881a8c02730641a2b
MD5 (.build/helix_rev2_led_test.hex) = 5c97d982a5da5cfb3dacb28a8934b81d
MD5 (.build/helix_rev2_xulkal.hex) = d848383adfd7463b138c6da179cf1436
MD5 (.build/helix_rev2_yshrsmz.hex) = 5a008bca2d0c5790a151c02834c529ba
```

* make builds reproducable by default

* update build_keyboard.mk: remove 'build-for-compare' target

* GNU make (3.81) on macOS 10.14(Mojave) does not have the 'undefine' directive.

* Adopted fauxpark's suggestion.

* Update tmk_core/rules.mk

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

* update tmk_core/rules.mk

* fix tmk_core/rules.mk

Co-authored-by: Zach White <skullydazed@gmail.com>
Co-authored-by: Ryan <fauxpark@gmail.com>
2020-12-31 15:20:56 +09:00
QMK Bot f801c69c75 Merge remote-tracking branch 'origin/master' into develop 2020-12-30 09:59:32 +00:00
Ryan 411b92e206
Remove useless wait in AVR suspend code (#11352) 2020-12-30 20:58:57 +11:00
QMK Bot 9634c72d7e Merge remote-tracking branch 'origin/master' into develop 2020-12-29 21:45:35 +00:00
xyzz 2573ed8c6b
Remove MATRIX_IS_ON macro (#11330)
* Remove MATRIX_IS_ON macro

this macro is both incorrect and excessive given that macro_is_on()
exists

* Remove massdrop matrix.h
2020-12-29 21:45:04 +00:00
QMK Bot 99d6349978 Merge remote-tracking branch 'origin/master' into develop 2020-12-27 17:37:04 +00:00
Ryan 1b7b72c0e9
Ensure single newline at EOF for core files (#11310) 2020-12-28 04:36:32 +11:00
QMK Bot 0b37c0dfa0 Merge remote-tracking branch 'origin/master' into develop 2020-12-26 04:56:43 +00:00
Ryan 1d1d5da43f
Change include guards in tmk_core/ and drivers/ to pragma once (#11240) 2020-12-26 15:56:11 +11:00
Jan Christoph Ebersbach 010271d6ea
Implement kinetic mouse movement algorithm (#6739)
* Implement kinetic mouse movement algorithm

* Adjust mouse wheel speed

* Remove unused math.h include

* Wrap mouse_timer definition in ifdef

* Replace double space by single space

* Clarify documentation of kinetic mouse speed

Co-Authored-By: lf <software@lfcode.ca>

* Clarify documentation of kinetic mouse speed

Co-Authored-By: lf <software@lfcode.ca>

* Remove superfluous definition of speed

* fix(variable): remove unused variable

Co-authored-by: lf <software@lfcode.ca>
2020-12-24 14:12:19 -08: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 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
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
XScorpion2 485e4524f4
Fix int wrapping for timer_expired macros and use MAX defines for consistency and clarity (#10996) 2020-11-30 21:18:19 +11: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
Drashna Jaelre e7497b3fba
Add references for is_keyboard_left() (#10850)
* Add references for is_keyboard_left()

* Remove proto from bootmagic_lite.c
2020-11-18 16:50:32 -08: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
Adrian 120c42255b
Added EEPROM emulation for STM32F042x6 series processors (#10685)
* Added STM32F042x6 support for EEPROM emulation

* Default to lower stack size on STM32F042

* Moved stack setting

* Re-moved stack definition

* Removed unnecessary check
2020-10-22 21:05:01 +11:00
QMK Bot a3db72df72 format code according to conventions [skip ci] 2020-08-29 22:57:48 +00:00
Ryan b89b2030af Kiibohd bootloader, take 2 (#10129) 2020-08-29 14:30:02 -07:00
Drashna Jaelre 92385b3fb6 Better handle LTO_ENABLE (#9832)
* Better handle LTO_ENABLE

Especially when calling from command line

* Replace LINK_TIME_OPTIMIZATION_ENABLE with LTO_ENABLE

* Remove long for LTO from show_options.mk
2020-08-29 14:30:02 -07:00
Ryan 3f392c09b6 More Bluetooth refactoring (#9905) 2020-08-29 14:30:02 -07:00
Drashna Jaelre e6266b19be Initialize Layer State on startup (#8318)
* Initialize Layer State on startup

Right now, on startup, the default layer state gets called and set, triggering the callback functions for the default layer state. However, the normal layer state never actually gets initialized.  It's set to 0 directly, by default, but the callback functions are never actually called.  This creates some inconsistency in the behavior for end users.  This adds a simple "clear" that triggers the callback on startup.  This should produce more consisten behavior between the two functions and layer masks.

* Stupid hack

* Fix type casting?

* Fix compile issues with magic is disabled
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
Nick Brassel 686a9d35ff Re-fix the STM32 dual-bank bootloader stuff. (#9738)
* Re-fix the dual-bank bootloader stuff.

* Use wait_ms() instead of using nop's for a delay, as ChibiOS is actually running at the time of bootloader jump.
2020-08-29 14:30:02 -07:00
Nick Brassel 93e7a8f74c Add dual-bank STM32 bootloader support, given GPIO toggle on BOOT0 to charge RC circuit. (#8778) 2020-08-29 14:30:02 -07:00
dhong44 d0abad27ab Fix the mousekey scrolling (#9174)
Mousekey scrolling should have a separate repeat variable
to keep track of scrolling acceleration, instead of being
tied to mouse movement scolling in mousekeys. The send function
should record when the last movement was made since this is
when movement is actually sent. Doing this fixes the bug where
the initial press of a mousekey scroll button causes a double scroll.

Signed-off-by: Daniel Hong <daniel.hong@live.com>
2020-08-29 14:30:02 -07:00
Ryan 1193e45bf4 Convert `CONSUMER2BLUEFRUIT()` and `CONSUMER2RN42()` macros to static inline functions (#9055) 2020-08-29 14:30:02 -07:00
Ryan d949932c08
Fix ChibiOS backlight not turning off on suspend (#10114)
* Fix ChibiOS backlight not turning off on suspend

* Add missing code for backlight as caps lock too
2020-08-26 11:15:43 -07:00
Nick Brassel 70ce4ba56f
Revert "Add Kiibohd bootloader type to bootloader.mk (#9908)" (#10126)
This reverts commit e2d4cd1a41.
2020-08-21 15:42:28 -07:00
Ryan e2d4cd1a41
Add Kiibohd bootloader type to bootloader.mk (#9908) 2020-08-12 12:28:20 +10:00
Drashna Jaelre c7b56bee96
[Bug] Fix Swap Hands bug introduced by OSH (#9968)
Fixes the handling for the oneshot cleanup, so it only cleans up if it is active.  It should not cleanup of SHO is off (eg using a normal oneshot key), nor if it's actively pressed or used.  

Previous behavior BROKE swap hand key.
2020-08-08 16:41:10 -07:00
QMK Bot 95c742ec27 format code according to conventions [skip ci] 2020-07-25 22:33:55 +00:00
Joel Challis d91987ab9a
Enable OLED support for Teensy 3.2/LC (#7591)
* I2C_TIMEOUT is not defined on arm teensy

* Work round teensy having different ChibiOS config options

* Stash OLED conf files

* update comment

* update comment

* Remove stm32 alias to allow teensy alt mode
2020-07-26 07:50:56 +10:00
QMK Bot 1778858e24 format code according to conventions [skip ci] 2020-07-21 00:09:52 +00:00
nathanvercaemert 19006c9753
Implemented New MK_COMBINED Functionality (#9557)
* implemented new mousekey_combined functionality

* minor formatting change to documentation

* Update tmk_core/common/mousekey.c

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

* Update tmk_core/common/mousekey.c

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

* Update tmk_core/common/mousekey.c

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

* Update tmk_core/common/mousekey.c

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

* Update docs/feature_mouse_keys.md

Co-authored-by: Nick Brassel <nick@tzarc.org>

* Update docs/feature_mouse_keys.md

Co-authored-by: Nick Brassel <nick@tzarc.org>

* Update docs/feature_mouse_keys.md

Co-authored-by: Nick Brassel <nick@tzarc.org>

* Update docs/feature_mouse_keys.md

Co-authored-by: Nick Brassel <nick@tzarc.org>

Co-authored-by: Nathan Vercaemert <nathan.vercaemert@gmail.com>
Co-authored-by: Ryan <fauxpark@gmail.com>
Co-authored-by: Nick Brassel <nick@tzarc.org>
2020-07-21 09:28:38 +10:00
Ryan 72d3270547
Remove `DESCRIPTION` (#9732) 2020-07-16 15:49:18 +10:00
Sven Grunewaldt 03c790a0f2
Add TAP_CODE_DELAY to Mod-Tap (#9422) 2020-07-07 21:47:59 +01:00
Manna Harbour d1819f02df
Fix sharing of mouse button state from mousekeys to ps2_mouse (#9124)
With this change, when ps2_mouse is disabled, mousekeys works as usual. With
ps2_mouse enabled, mousekeys button state is shared with ps2_mouse for clicking,
dragging, and scrolling, mousekeys clicks are produced by ps2_mouse only, and
mouskeys button state is transferred to mousekeys without generating clicks to
enable mousekeys dragging.

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

Co-authored-by: Drashna Jaelre <drashna@live.com>
2020-07-02 18:04:55 +01:00
Joshua Diamond 9c1097e768
Fix for One Shot Layer not being cleaned up after some actions (#8832) 2020-06-18 08:07:48 +01:00
Tsan-Kuang Lee 437446ba8f
Fix one shot swaphands compiler error when NO_ACTION_ONESHOT is defined (#9296)
* init

* add RETRO_TAP; tap anyway after TAP_TERM, if no interruption

* RETRO_TAP works for other types of taps

* revert to upstream/master

* explain this fork in readme

* use one readme.md file instaed

* fix the error if NO_ACTION_ONESHOT is defined

* restore readme.md to upstream master

Co-authored-by: Tsan-Kuang Lee <tsan.kuang.lee@gmail.com>
2020-06-10 22:40:17 +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
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
Nick Brassel 8d3fca57a3
Fix build when using IGNORE_MOD_TAP_INTERRUPT_PER_KEY. (#9258) 2020-06-01 11:53:01 +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
yulei d8f76f9e6d
Added missing shutdown_user() hook (#9180)
* add missing shutdown_user()

* use reset_keyboard() from quantum
2020-05-25 22:16:33 +10:00
Drashna Jaelre ef5fad137b
Disable Mousekey Command interface when Constant speed is enabled (#7017) 2020-05-19 07:29:20 -04: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
Alex Ong 361ac2f32a
Optimization for scanning less layers. (#8311)
* Optimization for scanning less layers.

* Rename NUM_LAYERS to MAX_LAYER.
2020-05-11 01:04:38 +01:00
skullY 6f30b402a2 Revert "Fix conflicting types for 'tfp_printf' (#8269)"
This reverts commit e17b55e33a.
2020-05-04 09:25:44 -07:00
Joel Challis e17b55e33a
Fix conflicting types for 'tfp_printf' (#8269)
* Refactor to use mpaland/printf

* trim firmware size

* remove keymap changes

* run clang format

* Fixup after rebase

* fix up git-submodule command for printf
2020-05-03 23:19:51 -07:00
Joel Challis 5f82b0782f
Initial vusb console support (#8559) 2020-05-03 01:25:39 +01:00
Joshua Moses Diamond 2e6959ed87
Add some usages needed for ChromeOS hosts (#8996) 2020-05-03 10:24:11 +10:00
Joel Challis c482a2944b
Provide a mechanism for split keyboards to process key press on both halves (#9001) 2020-05-03 00:39:37 +01:00
zvecr 406dc2fb2d Move encoder_read to common location 2020-05-02 22:44:36 +01:00
Chris Ko 9b70e53508
[Docs] Fixed minor typos (#8860) 2020-04-19 23:04:26 +01:00
Konstantin Đorđević 370577e4ed
Add *OPT aliases for *ALT keycodes and macros (#8714) 2020-04-12 11:37:55 -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
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
Konstantin Đorđević be2f5816b6
Fix compile issues related to NO_ACTION_MACRO/FUNCTION and LTO_ENABLE (#8663)
* 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-09 00:18:30 +01:00
QMK Bot 59188bf29d format code according to conventions [skip ci] 2020-04-02 21:59:37 +00:00
Joel Challis 9c4bf0ac4a
Initial support for ATtiny85 (#8632)
* Initial support for ATtiny85

* Update mcu selection
2020-04-02 22:23:57 +01:00
Ryan 2b427f774a
Fix `pgm_read_ptr()` define for ARM (#8658) 2020-04-02 16:52:16 +01:00
Joel Challis 58a9c84d6b
Strip out features to allow minimum firmware sizes (#8645) 2020-04-01 21:06:22 +01:00
Casper Weiss Bang 13fff52f6b
fixed problem with implicit declaration in quantum/rgblight.c (#8406)
* 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-28 23:35:11 +00:00
Joel Challis 23e942ae4e
Enable SLEEP_LED on ATmega32A (#8531)
* 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-26 18:21:33 +00:00
Drashna Jaelre 5117dff6a2
Add Post Processing to process_record (#4892)
* 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-23 00:29:05 +11:00
QMK Bot d511e52c1f format code according to conventions [skip ci] 2020-03-21 23:44:27 +00:00
Joel Challis 789e199450
Add support for Bootmagic lite when using SPLIT_HAND_PIN (#8347)
* 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-21 23:10:39 +00:00
Ryan f4799481cd
Fix formatting for report.h (#8512) 2020-03-22 06:19:01 +11:00
QMK Bot f9c53ca71a format code according to conventions [skip ci] 2020-03-21 12:58:19 +00:00
Ryan 7e80686f1e
Tidy up report.h (#8486)
* Tidy up report.h

* Add link to Review Request 41 for brightness controls
2020-03-21 16:19:15 +11:00
Ryan e967471c4f
Remove ACT_COMMAND (#8487)
* Remove ACT_COMMAND

* And from action_t as well
2020-03-21 16:17:43 +11:00
QMK Bot 5e98eaaaff format code according to conventions [skip ci] 2020-03-13 18:44:56 +00:00
fredizzimo 9e8767917d
Fix pressing two keys with the same keycode but different modifiers (#2710)
* 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-13 14:09:38 -04:00
QMK Bot f89439ae09 format code according to conventions [skip ci] 2020-03-13 17:24:38 +00:00
francislan 3cd2a27ac0
Decouple mouse cursor and mouse wheel in accelerated mode (#6685)
* 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-13 12:49:44 -04:00
Drashna Jaelre 668121bbf8
Fix layer debug calls (#8370) 2020-03-10 20:23:26 +11:00
Takeshi ISHII dbbab40981
Refactor rgblight_reconfig.h (#7773)
* 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-10 01:46:03 -07:00
QMK Bot bad9468ce1 format code according to conventions [skip ci] 2020-03-06 13:28:11 +00:00
Ryan 9810756ee0
Fix typo in uart.c backport and add 32A "support" (#8219) 2020-03-06 23:55:15 +11:00
QMK Bot 95124bf933 format code according to conventions [skip ci] 2020-03-01 19:20:09 +00:00
Joel Challis e7fb873ee2
Short term fix for conflicting types for 'tfp_printf' (#8157) 2020-03-02 05:46:40 +11:00
Ryan c9e3fa6f70
Clean up includes for glcdfont headers (#7745)
* Clean up includes for glcdfont headers

* Remove pragma once, most of these are not headers

* Missed these
2020-03-01 17:56:50 +11:00
James Young 26eef35f07
2020 February 29 Breaking Changes Update (#8064) 2020-02-29 11:59:30 -08:00
QMK Bot 61b71320f7 format code according to conventions [skip ci] 2020-02-25 18:57:18 +00:00
ridingqwerty b949343b78
New feature: PERMISSIVE_HOLD_PER_KEY (#7994)
* Implement 'PERMISSIVE_HOLD_PER_KEY'

* Document 'PERMISSIVE_HOLD_PER_KEY'

Co-authored-by: GeorgeKoenig <35542036+GeorgeKoenig@users.noreply.github.com>
2020-02-25 13:25:52 -05:00
QMK Bot a7d859dab8 format code according to conventions [skip ci] 2020-02-21 11:04:05 +00:00
Drashna Jaelre 1751c3cc25
uart.c fix from TMK (#7628)
* uart.c fix from TMK

Backport from tmk/tmk_keyboard@c41e48a0ab

* Avoid deadlock when uart.c is usind in ISR

Backport from tmk/tmk_keyboard@55443fabb7
2020-02-21 21:32:30 +11:00
Joel Challis 7707724dc4
Allow 30us matrix delay to be keyboard/user overridable (#8216)
* Allow 30us matrix delay to be configurable via define

* Move wait logic to matrix_common

* Move wait logic to matrix_common - fix wait includes
2020-02-21 14:49:33 +11:00
Ted Lin c3200aa8fc Compile error if ONESHOT_TIMEOUT defined but oneshot disabled (#8100)
* Compile error if ONESHOT_TIMEOUT defined but oneshot disabled

When ONESHOT_TIMEOUT and NO_ACTION_ONESHOT are both defined, this code
fails to compile.

Wrap the one usage of ONESHOT_TIMEOUT that is inconsistent with the
rest so all usages are properly wrapped by a check of NO_ACTION_ONESHOT.

* Run file through clang-format

Co-authored-by: Ted M Lin <tedmlin@gmail.com>
2020-02-10 04:50:45 +00:00
fauxpark 174a15d07d Remove PJRC USB stack 2020-02-08 11:07:43 -08:00
Ted M Lin d84eb14b3a
Use function for KEYCODE2 routines instead of macro. (#8101)
* Option to use function for KEYCODE2 routines.

Convert the KEYCODE2SYSTEM and KEYCODE2CONSUMER macros to functions,
defaulting to using the macros.  The function form allows the compiler
to optimize the switch statement itself, over the macro nested
ternaries.

To enable this feature, #define USE_KEYCODE2_FUNCTION.

Testing against a random selection of avr-based keyboards, this
increased available flash by ~500 bytes. For arm-based keyboards,
the available flash increased by ~400 bytes.

* Replace macro with function entirely.

As zvecr states, go bold and just commit to using the function instead
of the macro.

* Reformat whitespace now that functional review is done

Verified against clang-format output.
2020-02-07 12:53:43 +11:00
fauxpark b2ce2f8a34
Dedupe extrakey report struct, and send functions in V-USB & LUFA (#7993)
* Dedupe extrakey report struct, and send functions in V-USB & LUFA

* Doc comment for consistency

* Wrap it in ifdef to prevent unused function error

* Do the same for ATSAM
2020-02-02 12:17:05 -08:00
QMK Bot 1a79f14e43 format code according to conventions [skip ci] 2020-02-01 09:46:34 +00:00
Pavel Župa 4e6d1ae0ea
Fix timer_elapsed() overflow issue for STM32F103 and other ChibiOS boards (#7595)
* fixed strange space cadet timer owerflow on STM32F103

* Moved elapsed time fix to timer.c
2020-02-01 20:17:28 +11:00
Joel Challis d4ccb2e0e6 Fix printf buffer overflow when cols>16 (#7998) 2020-01-24 21:57:30 -05:00
QMK Bot fe50883c15 format code according to conventions [skip ci] 2020-01-24 02:15:29 +00:00
Nick Brassel d13ada1162 Add customisable EEPROM driver selection (#7274)
- uprintf -> dprintf
- Fix atsam "vendor" eeprom.
- Bump Kinetis K20x to 64 bytes, too.
- Rollback Kinetis to 32 bytes as partitioning can only be done once. Add warning about changing the value.
- Change RAM-backed "fake" EEPROM implementations to match eeconfig's current usage.
- Add 24LC128 by request.
2020-01-24 12:45:58 +11:00
Joel Challis 667045b492
Run clang-format manually to fix recently changed files (#7934)
* Run clang-format manually to fix recently changed files

* Run clang-format manually to fix recently changed files - revert template files

* Run clang-format manually to fix recently changed files - format off for ascii_to_keycode_lut
2020-01-19 16:30:34 +00:00
Joel Challis ba628a28bc
Move rgblight and backlight task to common location (#7733) 2020-01-19 00:59:09 +00:00
ridingqwerty 95c24bbaf8
Implement and document TAPPING_FORCE_HOLD_PER_KEY (#7859)
* Implement and document TAPPING_FORCE_HOLD_PER_KEY

* Added "record" parameter to "get_tapping_force_hold"

* Correct typo -- remove 'IGNORE_' from 'IGNORE_TAPPING_FORCE_HOLD_PER_KEY'

Co-authored-by: GeorgeKoenig <35542036+GeorgeKoenig@users.noreply.github.com>
2020-01-17 15:49:23 -05:00
Drashna Jaelre 1b0854fdca Cleanup check for PERMISSIVE_HOLD (#7861)
* Fix bug in PERMISSIVE_HOLD check

caused by #5009 (aka, me)

* Remove check for per key
2020-01-17 15:33:08 -05:00
fauxpark 1e670f5e67
Remove `KEYMAP_SECTION_ENABLE` (#7882) 2020-01-17 00:32:09 +11:00
zk-phi 7f388b6553 Add per-key IGNORE_MOD_TAP_INTERRUPT feature (#7838)
* Implement IGNORE_MOD_TAP_INTERRUPT_PER_KEY

- Add configurable option IGNORE_MOD_TAP_INTERRUPT_PER_KEY
- Add function get_ignore_mod_tap_interrupt iff the option is enabled

Unless IGNORE_MOD_TAP_INTERRUPT_PER_KEY is defined, this patch does not affect the resulting binary.

* Add documentation for IGNORE_MOD_TAP_INTERRUPT_PER_KEY
2020-01-10 02:48:06 -05:00
Joel Challis dcb7ca3f79
Move some common matrix code to a common location (#7699)
* Move some common matrix code to a common location

* Refactor some 'custom_matrix_helper' logic to use custom matrix lite

* Fix build for kinesis/stapelberg - abuse of vpath was picking up matrix.c from core when custom matrix was enabled

* Add validation for CUSTOM_MATRIX
2020-01-04 20:29:44 +00:00
Wilba 320822d75b VIA Configurator Refactor (#7268)
* VIA Refactor

* Remove old code

* review changes

* review changes

* Fix cannonkeys/satisfaction75/prototype:via build

* Add via.h to quantum.h

* Move backlight init to after backlight config load

* Merge branch 'master' into via_refactor_pr

* Update user's rules.mk to new way of enabling VIA

* Added id_switch_matrix_state

* Review changes
2020-01-03 12:52:00 -08:00
xyzz 8ec0b378bc Fix typo in action.c (#7757) 2020-01-02 12:49:53 +00:00
Joel Challis 376419a4f7
Add central location for ChibiOS defines (#7542)
* Add central location for chibios defines

* Add central location for chibios defines - actually add files this time....

* Add Copyright header

* Update include order to resolve i2cv1 build errors
2019-12-21 18:22:49 +00:00
Drashna Jaelre 85f4c3ebb4 [Core] Optimize matrix processing (#7621)
Backport of tmk/tmk_keyboard@ad6059adc7
2019-12-16 16:31:59 +00:00
Joel Challis efb21c00ce Fix FORCE_NKRO handling (#7601) 2019-12-11 11:39:30 -08:00
Joel Challis 071eb2478f Remove mbed files (#7605)
* Remove mbed files

* Remove mbed files - fix comment

* Remove mbed logic blocks
2019-12-11 11:36:00 -08:00
fauxpark 02412156d5
Add 4-character aliases for sendstring keycodes (#7409)
* Add 4-character aliases for sendstring keycodes

* Remove pointless mail keycode redefinition

* Forgot brightness keycodes
2019-11-22 14:11:28 +11:00
zvecr a91c0c4765 Run clang-format manually to fix recently changed files 2019-11-17 08:25:58 -08:00
Joel Challis c1970e284d Fix LAYER_STATE_8BIT compile issues (#7304) 2019-11-08 18:23:26 -08:00
Jonathan Rascher 680d401faf Support RGBLIGHT_SLEEP when ChibiOS boards suspend (#7280)
Copypasta from the AVR suspend implementation with a Teensy-specific
hack removed
2019-11-08 21:43:02 +00:00
fauxpark dfb78d2a08 New and improved lock LED callbacks (#7215)
* New and improved lock LED callbacks

* Include stdbool

* Update documentation

* Use full function signatures and add keyboard-level example
2019-11-06 00:42:16 +00:00
Joel Challis abfd6ed961
Move tmk_core/common/backlight to quantum/backlight (#6710)
* Move tmk_core/common/backlight to quantum/backlight

* Add guards to backlight inclusion

* Add guards to backlight inclusion

* Update backlight guards on clueboard/60

* Use full paths to avoid vpath issues
2019-10-17 17:48:58 +01:00
fauxpark 63f4806d7a Fix bug in `do_code16()` (#6935)
* Fix bug in `do_code16()`

* Remove qk_ mods functions
2019-10-16 00:02:09 +01:00
Joel Challis 2ac4197b73
Add binary support to tinyprintf (#7024) 2019-10-15 13:33:06 +01:00
Joel Challis cc5edb9eeb
Port DEBUG_MATRIX_SCAN_RATE to core (#7029)
* Port DEBUG_MATRIX_SCAN_RATE to core

* Remove duplicate DEBUG_MATRIX_SCAN_RATE implementations

* Remove duplicate DEBUG_MATRIX_SCAN_RATE implementation from handwired/xealous

* Add console logic from ergodox_ez
2019-10-15 13:32:52 +01:00
Joel Challis 38aefaf78e
ARM - Initial backlight support (#6487)
* Move AVR backlight to own file, add borrowed ARM implementation

* Tiny fix for backlight custom logic

* Remove duplicate board from rebase

* Fix f303 onekey example

* clang-format

* clang-format

* Remove backlight keymap debug

* Initial pass of ARM backlight docs

* Initial pass of ARM backlight docs - resolve todos

* fix rules validation logic

* Add f072 warning

* Add f072 warning

* tidy up breathing in backlight keymap

* tidy up breathing in backlight keymap

* add missing break to backlight keymap
2019-10-05 16:57:00 +01:00
fauxpark 41b9be560d
Wrap util.h functions in `extern "C"` (#6762) 2019-10-04 09:24:47 +10:00
Joel Challis 17794e0b25
ARM split - Add support for dfu-util EE_HANDS flashing (#6543)
* Initial stab at some fake dfu-util-split-left behaviour

* Apply suggestions from code review

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

* Clang format fixes

* Fake eeprom init for both left and right hand
2019-09-27 21:33:55 +01:00
Joel Challis ad8dbd5ca5
ARM split - Add bootmagic/magic keycodes for setting handedness (#6545)
* Add docs on bootmagic/magic keycodes for setting handedness

* Clang format fixes

* Maintain backwards compatibility

* Maintain backwards compatibility
2019-09-24 15:24:12 +01:00
XScorpion2 2f49cae9bc Fixing wrapping math logic for timer_expired functions (#6746) 2019-09-23 00:52:33 +10:00
fauxpark 91bd2117df Banish some more magic numbers (#6662) 2019-09-07 08:12:46 -07:00
skullY b624f32f94 clang-format changes 2019-08-30 15:01:52 -07:00
skullY 691be16b23 Have clang ignore the code in bootloader_size.c 2019-08-30 15:01:52 -07:00
Drashna Jaelre 931e9bdbe4 Decrement EECONFIG magic number
This will manually wipe the EEPROM. This is a hacky solution for when new ranges are added or moved around. 

A better (more complicated) solution would be to zero out everything, not just known ranges.  But for now, this is a hacky solution that will work.
2019-08-27 20:32:36 -07:00
XScorpion2 957070a6b5 Added OLED Display autoscroll during periods of OLED data inactivity (#6546)
* Added OLED Display autoscroll during periods of OLED data inactivity.

* Fixing compile errors

* Feedback from review
2019-08-25 12:37:55 -07:00
Drashna Jaelre b62e160a89
Additional changes for Layer State typedef compatibility (#5906)
* Additional changes for Layer State typedef compatibility

* Replace biton32 with get_highest_layer in docs

* Change additional layer structure code

* Fix uGFX reference issue

* Remove dynamic_keymap check

* Where did all these extra spaces come from

Co-Authored-By: fauxpark <fauxpark@gmail.com>
2019-08-21 17:07:49 -07:00
Stephen Wanhella d534c72a54 Added keycodes for swapping and unswapping the Control and OS keys (#6110)
* Add MAGIC_SWAP_CONTROL_LGUI and MAGIC_UNSWAP_CONTROL_LGUI keycodes

Key codes to swap and unswap the control and windows/cmd keys

* Fix issues with pull request #6110

Renamed swap/unswap lctl and lgui key codes, added key codes to swap/unswap rctl and rgui, and moved new bool inside keycode_config.h struct to the end

* Move new keycodes to the end of the enum (#6110)

* add cases for swapped control and OS keys to mod_config (#6110)

* Add new keycodes to feature_bootmagic.md (#6110)

* Add R+L swap codes to keep in parity with AG_* codes

* Extend Magic range check to include new magic codes

* Update audio docs

* Combine 2 byte ranges into 1 word for EECONFG

Fix names for Keymap config EEPROM

* Update docs/feature_bootmagic.md

Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>

* Update docs/feature_bootmagic.md

Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>

* Update docs/feature_bootmagic.md

Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>

* Update docs/feature_bootmagic.md

Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>
2019-08-21 17:07:08 -07:00
fauxpark f2c179de58 Remove superfluous JTAG disable code (#6445)
* Remove superfluous JTAG disable code

* 32A has differently named register

* Accidentally some operators

* 32A also has different JTAG pins

* Wrap disable_jtag() in an ifndef

* Document this new define

* Rename the define, it conflicts with a LUFA thing

Also, move the ifndef wrapping to the call in keyboard_setup()
2019-08-20 22:18:52 -07:00
Joel Challis d8d2a09674 Fix LT() crashing some ARM keyboards (#6529) 2019-08-13 10:23:14 -07:00
fauxpark 2f6c068e0d Extend allowed range of tappable keycodes to include modifiers (#5809)
* Extend allowed range of tappable keycodes to include modifiers

* Get rid of the magic numbers altogether

* Remove some more magic numbers

* Extract LM() functionality from ACT_LAYER_TAP

* Use ACTION() macro everywhere
2019-08-08 13:58:05 -07:00
Drashna Jaelre 3261c408e4 Add support for TAP_CODE_DELAY to Hold-Tap keys (#5400)
* Add support for TAP_CODE_DELAY to Hold-Tap keys

* Better handling for tap code delay and caps version
2019-07-22 20:23:57 -07:00
Konstantin Đorđević a2e91ebec9 Update IS_COMMAND definitions to use MOD_MASK_SHIFT (#6348)
* Update IS_COMMAND definition in templates to use MOD_MASK_SHIFT

* Update IS_COMMAND in docs

* Update IS_COMMAND default definition in tmk_core

* Update table in Command docs based on suggestion

Co-Authored-By: fauxpark <fauxpark@gmail.com>
2019-07-20 13:21:40 -07:00
fauxpark 3895b4b868 Extend maximum number of backlight levels to 31 (#6351) 2019-07-16 21:58:29 -07:00
Drashna Jaelre f6651424a0 Make Caps Lock delay more reasonable (#6199)
* Make Caps Lock delay more reasonable

* Update documentation

* Update docs/config_options.md

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

* Update docs/config_options.md

Co-Authored-By: Konstantin Đorđević <vomindoraan@gmail.com>
2019-07-16 01:21:52 -07:00
fauxpark a32f7e1a25 Store backlight breathing state in EEPROM (#6105)
* Store backlight breathing state in EEPROM

* Reduce backlight_config.level from 6 bits to 4 (max 15 "on" levels)

* Error out if BACKLIGHT_LEVELS is > 15

* Remove mention of default backlight pin in rules.mk template

* Remove pointless comment
2019-07-16 00:56:36 -07:00
XScorpion2 e2dfb787da Adding rgb matrix speed into eeprom storage. (#5965)
Zeroing out spd in eeconfig_init_quantum

Switched to block read & update

Update tmk_core/common/eeconfig.h

Co-Authored-By: Drashna Jaelre <drashna@live.com>

Fixing init compile error

Update eeconfig.c

Dead / Missing API cleanup

alignment
2019-07-16 00:40:43 -07:00
yiancar 3538955778 Usbasploader bootloader option addition (#6304)
* Added USBasp bootloader option for USBasploader

* author comment

* ifdef fix :)

* Add usbasp target

* Update docs/flashing.md

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

* Update docs/flashing.md

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

* Update docs/flashing.md

Co-Authored-By: fauxpark <fauxpark@gmail.com>
2019-07-15 19:11:59 -07:00
fauxpark d16056e60a Fix TO() and DF() calling layer_state_set_[kb,user] twice (#6003) 2019-05-29 07:45:28 -07:00
Ryan Caltabiano ba26736d7e Fix bit count calculation for iterating layers 2019-05-18 13:47:34 -07:00
Alex Ong 00d1d7828c Typedef'ed layer_state_t to uint32_t (#3637)
* Typedef'ed layer_state_t to uint32_t.

This enables future work with layer_state_t to uint8_t for optimization purposes.

* Removed accidental xeal60 commit

* Revert to egyptian brackets, added sizeof(layer_state_t) so when layer_state_t is redefined it will automagically work.

* Add additional typedefs

* Add checks for setting layer state

* Update tmk_core/common/action_layer.h

Co-Authored-By: alex-ong <the.onga@gmail.com>

* Revert commit.
2019-05-17 13:47:50 -07:00
Drashna Jaelre 48b01446ba Make delay for Capslock in Hold-Tap functions configurable (#5497)
* Increase delay for Hold-Tap register for CAPSLOCK

Because it seems that the 80ms delay wasn't too much

* Screw it, make the caps delay a define and make it configurable
2019-05-16 10:28:06 -07:00
XScorpion2 e01b2d518a [Keyboard] Sol keyboard conversion to split common (#5773)
* Split common conversion

* Updated serial and encoder pins

* Fixing default folder until r2

* Fixing oled driver on slave split common

* Fixing keymap compile errors

* Fixing oled inactivity timer on slave split common

* Hoisted oled driver task, init, & activity to keyboard.c

* Update keyboards/sol/config.h

Co-Authored-By: XScorpion2 <rcalt2vt@gmail.com>

* Remove TAPPING_FORCE_HOLD
2019-05-06 15:06:43 -07:00
Drashna Jaelre 8a9c90ad78 Re-fix Mousekey Movements (#5740)
* Re-fix Mousekey Movements

After the new movement model was instroduced, it broke diagonal momement, again.  Reapplying fix from #3147 to both old and new acceleration method.

* Make diagonal mouse report checks more readable

Co-Authored-By: drashna <drashna@live.com>
2019-05-06 08:35:01 -07:00
Drashna Jaelre 90cd383d46 Fix wakeup function on ChibiOS (#5707)
Somebody was a very, very bad boy, and did a poor job of copy-pasting
2019-04-26 11:03:51 -07:00
Drashna Jaelre dd64a4e738 Init RGB Matrix EEPROM
I'm not sure how to check if it's the same as RGBLIGHT's EEPROM, but if you don't init it, it **will not** work properly until it is initialized.
2019-04-19 14:58:08 -07:00
Danny Nguyen 746058306b Make sure NOBITS is set on reset_key
Patch from https://github.com/qmk/qmk_firmware/issues/3657#issuecomment-415147411

Long story short, in avr-gcc pre-8.2, reset_key was assigned to a memory area that was in a normal range, but when 8.2 came out, that memory got moved to an out of range area, causing errors like 0x800293 out of range. Apparently, this was fixed up in avr-gcc, but we haven't seen a release with the fix yet (we expected it in 8.3, but that didn't happen for some reason).

What this commit does is move the reset_key back to the original memory location it was in before.
2019-04-19 14:44:16 -07:00
Markus Weimar e3a940026e Improve mouse keys docs and constant speed mode 2019-04-18 23:31:17 -07:00
patrickmt 3542f594d9 Fix wake from suspend LED functionality
When waking from suspend, only enable the LED drivers if they were not previously set to disabled by the user. This functionality was removed by the recent updates to adapt Massdrop keyboards to QMK RGB Matrix. Affects Massdrop CTRL and ALT keyboards compiled using Massdrop Configurator mode.
2019-04-18 11:55:45 -07:00
Drashna Jaelre 5701b75e3c Custom Tapping Term per key (#5009)
* Add customizable tapping terms

* Add Documentation

* Fix function

* Fixes

* It's not a pointer

* Add debugging output

* Update documentation to be at least vaguely accurate

* Use `get_tapping_term(tapping_key.event)` instead

`e` doesn't include column and row information, properly. It registers as 255, regardless of the actual keypress.

However `tapping_key.event` actually gives the correct column and row information.  It appears be the correct structure to use. 

In fact, it looks like the issue is that `e` is actually the "TICK" structure, as defined in keyboard.h

* Use variable tapping term value rather than define

* Silly drashna - tapping_key.event, not event

* add get_event_keycode() function

* Fix typo

Co-Authored-By: drashna <drashna@live.com>

* Remove post_process_record_quantum since it's the wrong PR

* Update quantum/quantum.c

Co-Authored-By: drashna <drashna@live.com>

* Better handle ifdef statement for permissive hold

Since we can't be sure that tapping term is actually 500

* Update quantum.c comments based on feedback

* Clean up get_tapping_term function

Clean up function so that users don't need to call the event function, and instead only check the keycode

* Add ability to run functionality on and off

* Make ifdef's more compact
2019-04-05 15:47:25 -04:00
Daniel Prilik 763b26cdb9 RGB Matrix support for Massdrop CTRL/ALT (#5328)
* port Massdrop CTRL/ALT to use RGB Matrix

Co-authored-by: Matt Schneeberger <helluvamatt@gmail.com>

* Massdrop lighting support working

This commit is to get the Massdrop lighting code working again through use of the compilation define USE_MASSDROP_CONFIGURATOR added to a keymap's rules.mk.
Added keymaps for both CTRL and ALT named default_md and mac_md. These should be used if the Massdrop style lighting is desired.

* Updating config based on testing results with patrickmt & compile errors

* Updates for PR5328

For CTRL and ALT:
Moved location of new RGB Matrix macros from config_led.h to config.h.
Added RGB_MATRIX_LED_FLUSH_LIMIT (time between flushes) to config.h for correct LED driver update timing.
Re-added missing breathing code for when Massdrop configurator mode is defined.

* remove prilik keymap form PR
2019-04-03 18:30:47 -07:00
Jon Arintok 346cbd8816 Add 3 speed mousekey movement option (#2246)
This allows for constant, non-accelerated mouse movement, while retaining the original functionality. Configurable by a define.
2019-03-26 19:34:33 -07:00
James Churchill 37932c293c Next set of split_common changes (#4974)
* Update split_common to use standard i2c drivers

* Eliminate RGB_DIRTY/BACKLIT_DIRTY

* Fix avr i2c_master error handling

* Fix i2c_slave addressing

* Remove unneeded timeout on i2c_stop()

* Fix RGB I2C transfers

* Remove incorrect comment
2019-03-12 10:23:28 -07:00
Chris Lewis c1c5922aae 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
2019-02-21 07:22:46 -08:00
Konstantin Đorđević 5cb713148d Change Command keycode defaults to match corresponding Bootmagic codes (#5078)
* Change Command keycode defaults to match corresponding Bootmagic codes

* Make alternate magic key keycodes consistent

* Reflect changes from previous commit in tmk_core/common/command.c

* Remove unnecessary MAGIC_KEY_* definitions from keymaps compatible with these changes

* Swap E and BSPACE for MAGIC_KEY_EEPROM

* Add MAGIC_KEY_EEPROM_CLEAR instead of MAGIC_KEY_EEPROM_ALT

* Remove BOOTMAGIC_ENABLE checks around EECONFIG stuff

* Update Command descriptions
2019-02-17 22:23:32 -08:00
ishtob 2cee371bf1 Haptic feedback generalized - DRV2605 and solenoids (#4939)
* initial work to add eeprom to haptic feedback and decouple the feedback process from keyboards

* Haptic feedback enhancements: on/off toggle working, feedback order working
todo:
-work on modes switching
-get modes switching to save to eeprom

* haptic enhancement - eeprom and modes added

* Added set and get functions for haptic feedback

* initial implementation of solenoids under haptic feedback

* changed eeprom to 32 bits to reserve blocks for future features

* start documentation of haptic feedback

* change keycode per comment from reviewers

* typo fixes

* added eeprom for solenoid configs

* added solenoid and docs

* Add/fix default parameters configs, improve docs

* more doc cleanup

* add in solenoid buzz toggle, clean up doc

* some fixes for error in compiling solenoid

* fix a chibios specific i2c read function and added one for AVR controllers in DRV2605L.c

* fixes for avr side issues

* update keymap

* fix keymap compile error

* fix bugs found during solenoid testing

* set pin that is not powered during bootloader

* added warning about certain pins on the MCU may trip solenoid during DFU/bootloader
2019-02-16 18:39:30 -08:00
Drashna Jaelre c22f3ba3a2
Debounce refactor / API (#3720)
* Added xeal60 via clone of lets split

* Delete removed other keymaps

* Basic keymap (no FN). Compiles.

* Removed NP_STAR and NP_SLSH.

* Removed "debounce_algo = manual" in all keyboards with CUSTOM_MATRIX = yes.

* Changed order of rules in TMK. Documented feature.

* Fixed missing whitespace in debounce documentation

Table wasn't working due to missing newline.

* Added bold in a few areas.

* DO NOT USE - Removed debounce from TMK.

* Remove accidental xeal60 commit

* DO NOT USE - debounce successfully compiled.

* DO NOT USE Revert back to original API to support split_keyboards.

* Working eager_pk

* Whitespace cleanup.

* Restored debounce.h since there wasnt any real change.

* Moved debouncing_time variable  to inside #if debounce

* Removed check for custom_matrix. We can safely include the debounce file for compilation when custom_matrix is used.

* Removed #include "matrix.h" from debounce.h

* Bug fix - was using MATRIX_ROWS instead of num_rows

* Fixed compilation error with debounce_sym_g

* Renamed DEBOUNCE_ALGO to DEBOUNCE_TYPE

* Malloc array in debounce_eager_pk, since split keyboards only use MATRIX_ROWS/2.

* Fix compile error in debounce_eager_pk

* Stricter, leaner DEBOUNCE_TYPE section in common_features.mk. Cleanup debounce_type.mk
2019-02-14 20:36:20 -08:00
Drashna Jaelre cc5c6b449a Add kb and user level keyboard initialization functions (#3113)
* Add suspend functions

* Disable RGB code if it's disabled

* Add keyboard_init functions

* Change where references so it will compile

* Wrong command chained in wake up kb function

* Fix non-feature file changes

* Add documentation

* Re-add matrix init docs

* add rgblight code to example

* Remove suspend code

* Clean up docs

* Fix docs

* Fix suspend code

* more doc fixes

* change function to startup_* rather than keyboard_init_

* fix spelling error

* fix up docs to finish removing keyboard_init

* Use Pre and Post init functions

* Update Documenation

* Remove changes to my keymap and userspace code

* Cleanup

* Revert changes to extra files

* Forgot a semicolon

* Make sure all protocols call keyboard_setup

* Cleanup functions

* Unset startup_user

* Remove changes from division keyboard

* Readd startup_user function

* Remove all to startup_user

* Update docs/custom_quantum_functions.md

Co-Authored-By: drashna <drashna@live.com>

* Update docs/custom_quantum_functions.md

Co-Authored-By: drashna <drashna@live.com>

* Add suggestion line

* Rebase fixes

* Update documentation to be more useful/accurate

* Cleanup of documentation

* Fix spacing inconsistency

* Revert unexpected change to keymap
2019-02-14 20:18:54 -08:00
Andrew Kannan 6b4549da8c Add Satisfaction75 to QMK, Enable EEPROM on stm32f072 (#5094)
* Add stm32f072 base ck4x4 to handwired

* add prints

* Save these tries

* Save changes again

* Working hadron oled

* OLEd working but ws2812b still iffy:

* save another try

* Encoder feature + OLED

* RTC code

* Implement clock setting mode

* Whitespace

* Encoder hooked up to working LED PWM code

* Add missing files

* eeprom changes

* Save changes

* Move i2c master

* Move satisfaction75 under cannonkeys

* Set proper default folder

* Revert some core changes

* Undo paved iris changes

* Reorganize code for maintainability and prep for new features

* Add starting code for clock OLED mode

* Clock set mode finished

* Add custom encoder modes

* Actually add VIA keymap

* Gate to only 072

* fix gate for only 072

* Update header guards and includes

* Update i2c selection strategy

* Update board.c to handle software reset to DFU
2019-02-13 08:03:26 -08:00
skullY bf2670601d compiles, but long delay on startup and problems 2019-02-10 15:37:12 -08:00
Thomas Baart 47051f506f Add One Shot Key callbacks (#4697)
* Added callbacks to one shot modifier changes

* Altered signature of callback functions

* Reordered the callback methods, shortened brief documentation

* Added One Shot Modifier callback documentation

* First attempt at unit tests

* Revert "First attempt at unit tests"

This reverts commit 5ec21a782202c0d74cf21cb852bd319f0c8b4842.

* Simplified oneshot function implementations

* Made clear_oneshot_locked_mods to be conform action_util.h, adhering to the (void) signature

* Made used datatypes for oneshot mods consistently unsigned integers

* Corrected callback to call clear callback when clear_oneshot_locked_mods is invoked

* Simplified oneshot equals statements

* Corrected return type and signature of get and set oneshot locked mods

* Consolidated one shot callbacks, added initial layer callback version

* Fixed non-updating one shot layer variable after timeout or other clear, added code comments

* Added better one shot key docs
2019-02-05 10:19:56 -08:00
fauxpark d8e9a0f7a3 Change return type of layer_switch_get_layer() to uint8_t (#5011)
* Change return type of layer_switch_get_layer() to uint8_t

* Keep loop index signed so we don't wrap around
2019-01-31 16:40:12 -08:00
Andrew Kannan 7186d1581a Moving cannonkeys boards to one place, eeprom fix (#4999)
* Move boards to cannonkeys and share resources

* Share common files between cannonkey boards

* Fix ortho60 keymap

* update LED numbers

* Add RGB keys to Ortho60 and Ortho48

* Add Backlight control to default layout Ortho60 and 48

* Remove unnecessary ws2812.c SRC from rules.mk
2019-01-29 20:04:20 -08:00
Rockman18 df251d7a13 Backlight - New option : BACKLIGHT_CAPS_LOCK (#4769)
* [BACKLIGHT_CAPS_LOCK_INDICATOR] Use backlight toggling as Caps Lock LED

I've implemented this feature because S65-X doesn't have LED indicators
and the existing led_set_kb(usb_led) function try to use backlight as
indicator but that creates an inconsistency with backlight_config state.

- define `BACKLIGHT_CAPS_LOCK_INDICATOR` to enable Caps Lock indicator
  using backlight (for keyboards without dedicated LED)

- Don't turn off LED indicators when suspend because backlight is
  already turned off. Else led_set(0) will turn back on backlight.

- Documentation has been updated

* [BACKLIGHT_CAPS_LOCK_INDICATOR] Turn off all LED indicators except Caps Lock if BACKLIGHT_CAPS_LOCK_INDICATOR

* [BACKLIGHT_CAPS_LOCK] Rename BACKLIGHT_CAPS_LOCK_INDICATOR

* [BACKLIGHT_CAPS_LOCK] Use new IS_LED_ON method
2019-01-28 16:57:56 -08:00
Andrew Kannan 0f507f0169 Practice60 RGB and PWM Backlight (#4929)
* Update Practice60 to enable RGB via SPI DMA and use PWM backlight breathing

* Correct stm32f103c8t6 flash size in eeprom definition

* Remove unused files and improve ifdef checks

* Update quantum/rgblight.c

Co-Authored-By: awkannan <andrew.kannan@klaviyo.com>

* Update quantum/rgblight.c

Co-Authored-By: awkannan <andrew.kannan@klaviyo.com>

* EEPROM implementation fix and updated p60 code

* Update define

* Remove dead code

* Update keymap to remove test key

* Update keymap again
2019-01-28 16:40:02 -08:00
Konstantin Đorđević 4d9b11af14 Fix Command feature: use get_mods() instead of keyboard_report->mods (#4955)
* Remove unnecessary IS_COMMAND definition in clueboard/66/rev4

* Replace keyboard_report->mods with get_mods() in IS_COMMAND definitions

* Update docs to use get_mods() instead of keyboard_report->mods

* Replace keyboard_report->mods with get_mods() in tmk_core/protocol/usb_hid/test

For some reason, this occurrence used KB_LSHIFT and KB_RSHIFT, which don't exist

* Replace keyboard_report->mods with get_mods() in Massdrop keyboards (as per @patrickmt)
2019-01-27 00:28:40 -08:00
Drashna Jaelre b05c0e46c6 Adds a default value for IS_COMMAND for COMMAND feature (#4301)
* Add default value for IS_COMMAND for COMMAND feature

* Cleanup and consistency

* Update Templates to reflect change

* Fix IS_COMMAND in template

* Fix IS_COMMAND define

* Use consistent IS_COMMAND block in templates

* Remove unnecessary `#undef IS_COMMAND` directives

* Fix compile issue on orthodox

* Reomve IS_COMMAND option for newer boards

* Remove all existing definitions of IS_COMMAND if they use default LSHIFT and RSHIFT setting

* Remove a couple of additional IS_COMMAND defines

* Remove remaining redundant IS_COMMAND definitions

* Remove #undef IS_COMMAND from orthodox:drashna and whitefox:konstantin

* Remove multiple empty lines in modified config.h files

* Update additional boards

* Reomve IS_COMMAND from newer boards

* Update Alice keyboard

* Remove IS_COMMAND from additional boards

Jan 24th edition
2019-01-26 15:49:45 -08:00
alex-ong 574fc6444b Whitespace cleanup. 2019-01-26 17:38:52 +11:00
alex-ong 39ca330f10 DO NOT USE - Removed debounce from TMK. 2019-01-26 16:56:01 +11:00
Alex Ong c9ba618654 DO NOT USE Merge branch 'master' into debounce_refactor
Merged, however now there are two debounce.h and debounce.c to mess around with and coalesce.
# Conflicts:
#	quantum/matrix.c
2019-01-26 12:13:19 +11:00
Drashna Jaelre 7aba1fd176 Fix RGBLIGHT_SLEEP function (#4865)
* Only re-enable RGBLIGHT if it was on when going to sleep

* Reformat file to follow QMK Standards

* Fix check, since this is a loop, whoops

Much thanks to @Rockman18 for catching this and posting the additional code!
2019-01-25 17:11:49 -08:00
Konstantin Đorđević 2f009d7461 Add MOD_MASK_* macros to core code (#4337)
* Add MOD_MASK_* macros to core code

* MOD_MASK_ALL → MOD_MASK_CSAG
2019-01-25 13:02:38 -08:00
Shihpin Tseng b416113616 Fix oneshot_time wrong type (#3696)
* Fix oneshot_time wrong type

* Fix oneshot_time_layer wrong type
2019-01-25 12:09:53 -08:00
lambda_sakura 8e47f64888 Add support for RETRO_TAPPING to LT(layer, kc) 2019-01-25 11:27:14 -08:00
Konstantin Đorđević 0f8431a57f Tidy up IS_{,HOST_}LED_{ON,OFF} macros (#4894)
* Tidy up IS_{,HOST_}LED_{ON,OFF} macros

* Tweak LED control docs
2019-01-20 20:16:36 -08:00
Junya Ogura 1d0bc5b7ba Flip definitions of macOS brightness alias
Before:
KC_BRMU - Brightness Down
KC_BRMD - Brightness Up

After:
KC_BRMU - Brightness Up
KC_BRMD - Brightness Down
2019-01-17 22:24:20 -08:00
DidierLoiseau 94ba2e5a9f Defined IS_(HOST_)LED_ON/OFF() and improved LED documentation (#4853)
* Defined IS_(HOST_)LED_ON/OFF() and improved LED documentation

* Update docs/custom_quantum_functions.md

Co-Authored-By: DidierLoiseau <didierloiseau+github@gmail.com>

* Update docs/custom_quantum_functions.md

Co-Authored-By: DidierLoiseau <didierloiseau+github@gmail.com>

* Integrated @drashna and @fauxpark's PR comments

- changed all plurals of "LED" to "LEDs" in the file
- rewording of the note about host_keyboard_leds() vs. led_set_user()

* Update docs/custom_quantum_functions.md

Co-Authored-By: DidierLoiseau <didierloiseau+github@gmail.com>
2019-01-17 17:28:33 -08:00
Jeremy Bernhardt 77399bfe51 MacOS Brightness Alias (#4836)
* Added aliases for OSX brightness

* Updated docs for alises

* Moved aliases, added docs to Brightness section

* Update docs/keycodes.md

Co-Authored-By: germ <jeremythegeek@gmail.com>

* Update docs/keycodes.md

Co-Authored-By: germ <jeremythegeek@gmail.com>

* Update keycode.h

* Update keycode.h

* Update keycodes.md

* Update docs/keycodes.md

Co-Authored-By: germ <jeremythegeek@gmail.com>
2019-01-17 17:23:01 -08:00
James Churchill 28929ad017 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.
2019-01-17 10:08:14 -08:00
Drashna Jaelre 5fcca9a226 Add documentation and fix formating (#4860) 2019-01-17 09:04:35 -08:00
Nikolaus Wittenstein 2fd86f4252 Add some function comments in action_layer.c (#4858) 2019-01-16 10:57:48 -08:00
Konstantin Đorđević 64c957d907 Add missing parentheses to some important macros (#4775)
* Add missing parentheses to quantum_keycodes macros

* Add missing parentheses to progmem macros
2019-01-08 15:08:17 -08:00
patrickmt 6e984a8b5e Update to arm_atsam wait and timer routines
Microsecond (us) delays are now handled by a busy wait loop according to MCU frequency. This replaces the system counter method which had an overhead of around 12us.
TC5 device and supporting routines removed as it was the old us delay counter.
wait_ms is now properly a macro to CLK_delay_ms.
wait_us is now properly a macro to CLK_delay_us.
Removed CLK_get_us as it has no use.
All calls to CLK_get_ms() have been replaced by timer_read64() with corrected typing.
All calls to CLK_delay_ms() have been replaced by wait_ms().
All calls to CLK_delay_us() have been replaced by wait_us() and timings verified or updated as needed after review on scope.
Corrected typing of variables using 64bit ms timer readings if needed.
2019-01-07 12:44:55 -08:00
yiancar 2bfac351ed Final HS60v2 changes. (#4790)
* initial commit, this now mostly works

- RGB controls work
- Dynamic keymap still broken due to eeprom
- Via works

* STM32 eeprom update

- Update EEPROM emulation library to handle 8bit data like AVR.
- This library also allows for multiple page pairs resulting in greater EEPROM size flexibility

* hs60 changes

* HS60 hhkb added

* Update keyboards/hs60/v2/config.h

Co-Authored-By: yiancar <yiangosyiangou@cytanet.com.cy>
2019-01-06 17:22:19 -08:00
Konstantin Đorđević be666b2d8a Add underscores to names of brightness control constants in report.h (#4764) 2019-01-05 08:31:24 -08:00
Alex Ong 2bb2977c13 Merge branch 'master' into debounce_refactor
# Conflicts:
#	tmk_core/common/keyboard.c
2019-01-04 19:43:45 +11:00
Konstantin Đorđević 93b004c943 Keep pressed keys on layer state change (fixes #2053, #2279) (#3905)
* Keep pressed keys on layer state change

* Add doc comment for clear_keyboard_but_mods_and_keys

* Keep pressed keys only if PREVENT_STUCK_MODIFIERS is on

* Check STRICT_LAYER_RELEASE instead of PREVENT_STUCK_MODIFIERS
2018-12-28 11:07:56 -08:00
Takeshi ISHII 8f790948e5 Refactor quantum/split_common/i2c.c, quantum/split_common/serial.c (#4522)
* add temporary compile test shell script

* Extended support of SKIP_VERSION to make invariant compile results during testing.

* build_keyboard.mk, tmk_core/rules.mk: add LIB_SRC, QUANTUM_LIB_SRC support

Support compiled object enclosed in library.

e.g.
```
LIB_SRC += xxxx.c
xxxx.c --> xxxx.o ---> xxxx.a
```

* remove 'ifdef/ifndef USE_I2C' from quantum/split_common/{i2c|serial}.c

* add SKIP_DEBUG_INFO into tmk_core/rules.mk

When SKIP_DEBUG_INFO=yes is specified, do not use the -g option at compile time.

* tmk_core/rules.mk: Library object need -fno-lto

* add SKIP_DEBUG_INFO=yes

* remove temporary compile test shell script

* add '#define SOFT_SERIAL_PIN D0' to keyboards/lets_split/rev?/config.h

* quantum/split_common/serial.c: Changed not to use USE_I2C.
2018-12-14 21:31:56 -08:00
Drashna Jaelre 02d44beb44 Fix up tap_code functionality (#4609)
* Add delay in Tap Code to avoid issues

I think a few people have reporting issues with it working properly, and it may be a timing issue.  The 'register_code' uses this sort of delay in some of the functions, and
this is probably why.

Adding the 100ms delay should hopefully fix any issues with it.

* Make tap_code delay configurable

* Update documentation

* Bring tap_code16 inline with changes

* Fix type for tap_code16

Bad copy-paste job

* Just use the value check for the define

* Clarify timing in docs

Co-Authored-By: drashna <drashna@live.com>

* Wordsmithing

Co-Authored-By: drashna <drashna@live.com>
2018-12-14 09:01:58 -08:00
Konstantin Đorđević 28fbf84cc5 Add standard definitions for ALGR and KC_ALGR (#4389)
* Add standard ALGR defition, remove (re)definitions from language files

* Use ALGR(kc) consistently in ALTGR(kc) aliases

* Non-Nordic keymaps should not use NO_ALGR

* Add standard KC_ALGR definition

* Update docs with ALGR and KC_ALGR

* Update SS_ALGR and ALGR_T aliases
2018-12-12 10:17:19 -08:00