* Fix how USB queue overflow is handled in chibios.
This commit reverts PR 12472 (commit c823fe2d3f23ed090e36ce39beed4c448298bd2f),
and it implements the original intent of the commit in a better way.
The original intent of the above mentioned commit was to not deadlock the
keyboard when console is enabled, and hid_listen is not started.
The above mentioned commit had a few drawbacks:
1) When a lot of data was printed to the console, the queue would get full,
and drop data, even if hid_listen was running. (For example having matrix debug
enabled just didn't work right at all)
2) I believe the function in which this was implemented is used by all other
USB endpoints, so with the above change, overflow, and data loss could
happen in other important functions of QMK as well.
This commit implements deadlock prevention in a slightly similar way to how
it's done on AVR. There is an additional static local variable, that memorizes
whether the console has timeouted before. If we are in the timeouted=false
state, then we send the character normally with a 5ms timeout. If it does
time out, then hid_listen is likely not running, and future characters should
not be sent with a timeout, but those characters should still be sent if there
is space in the queue. The difference between the AVR implementation and this
one is that the AVR implementation checks the queue state directly, but this
implementation instead attempts to write the character with a zero timeout.
If it fails, then we remain in the timeouted=true state, if it succeeds, then
hid_listen started removing data from the queue, so we can go out of the
timeouted=true state.
* Added comment explaining the timeouted logic to console flow control.
* Console flow control: refactor chibios flowcontrol code to make it more readable, and rename the timeouted variable to timed_out on both chibios and lufa. Changed comments to says timed_out is an approximation of listener_disconnected, to make it clear that it's not the same thing
* fix typo
Before this commit, attaching an ARM-based (i.e. ChibiOS-based) keyboard that
uses CONSOLE_ENABLE = yes and produces debug messages would deadlock the
keyboard unless one was running hid_listen.
With this commit, dead-locking writes to the queue are detected and prevented.
fixes#5631
* Fix USER_PRINT on avr/atsam
* Update tmk_core/common/arm_atsam/_print.h
Co-authored-by: Ryan <fauxpark@gmail.com>
Co-authored-by: Ryan <fauxpark@gmail.com>
* Fix keycode mappings for via and ensure they don't change within protocol
* Update keycodes
* Fix broken keyboards
* added the missing keycodes found in via
* Remove invalid keycodes
Co-authored-by: David Hoelscher <infinityis@users.noreply.github.com>
* Modified tmk_core/rules.mk to avoid linking errors
Added -fcommon flag to avoid linking errors due to multiple variable definitions. Though this is neither a definitive nor good solution, proper changes and use of extern keyword to avoid those multiple definitions must be made
* Comment updated
* Initial refactor of ARM SLEEP_LED to enable more platforms
* fix build issues
* Disable SLEEP_LED for boards with no caps lock code
* Enable GPT14 for boards with caps lock code and SLEEP_LED enabled
* Enable GPT for boards with caps lock code and SLEEP_LED enabled
* tmk_core/common/report.h: define `enum mouse_buttons` in terms of `#define MOUSE_BTN_MASK()`
* tmk_core/common/action.c: collapse multiple `case KC_MS_BTN[1-8]:` into single `MOUSE_BTN_MASK(action.key.code - KC_MS_BTN1)`
We all love tapping on our keyboards but this is taking the piss.
This saves ~134 bytes on my ATmega32.
* Remove GCC check from debug
* Remove platform logic from common.mk
* Refactor platform logic within print.h
* restore debug.c format
* headers
* Rename function pointer type
* review comments
* Update tmk_core/common/printf.c
Co-authored-by: Nick Brassel <nick@tzarc.org>
* Format
Co-authored-by: Nick Brassel <nick@tzarc.org>
* Fix DEBUG_MATRIX_SCAN_RATE on chibiOS when console is enabled
* update type in dprintf
Co-authored-by: Ryan <fauxpark@gmail.com>
Co-authored-by: Ryan <fauxpark@gmail.com>
* resolve race condition between suspend and wake in LUFA
* avoid multiple calls to suspend_power_down() / suspend_wakeup_init()
* Remove duplicate suspend_power_down_kb() call
* pause on wakeup to wait for USB state to settle
* need the repeated suspend_power_down() (that's where the sleep is)
* more efficient implementation
* fine tune the pause after sending wakeup
* speculative chibios version of pause-after-wake
* make wakeup delay configurable, and adjust value
* better location for wakeup delay
* Add support for 8 buttons to mouse report
This includes support for 8 buttons in mousekeys. However, this does move the keys around due to the fact that the last mousekey keycode is already 0xFF, so any past that would not work with register_code and the like, breaking them for tap hold keys, encoders, and other features.
* Update mouse key docs
* Add changes based on feedback
* Fix VUSB report size comment
Because drashna red gud
* Fix typo in action.c
* Fix IS_MOUSE_BUTTON check
* Change start range for mousekeys so that the end is 0xFF properly
* condense mousekeys check
* fix matrix_io_delay() timing in quantum/matrix.c
* Updated comments explaining the need for matrix_io_delay() in quantum/matrix.c
* fix matrix_io_delay() timing in quantum/split_common/matrix.c
* Update quantum/matrix.c
Co-authored-by: Ryan <fauxpark@gmail.com>
* Update quantum/split_common/matrix.c
Co-authored-by: Ryan <fauxpark@gmail.com>
* Update quantum/matrix.c
Co-authored-by: Ryan <fauxpark@gmail.com>
* Update quantum/split_common/matrix.c
Co-authored-by: Ryan <fauxpark@gmail.com>
* add waitOutputPinValid() and wait_cpuclock() into quantum/quantum.h and tmk_core/common/wait.h
* add matrix_output_select_delay() and matrix_output_unselect_delay()
* fix quantum/matrix_common.c, tmk_core/common/matrix.h
* fix tmk_core/common/wait.h
* fix quantum/quantum.h, tmk_core/common/wait.h
* waitOutputPinValid() rename to waitInputPinDelay() in quantum/quantum.h.
* waitOutputPinValid() rename to waitInputPinDelay() in quantum/matrix_common.c
* update tmk_core/common/wait.h
* update comment in quantum/matrix.c, quantum/split_common/matrix.c
* update quantum/quantum.h: Make more margin in the GPIO_INPUT_PIN_DELAY default value.
Co-authored-by: Ryan <fauxpark@gmail.com>
* Allow recording of the last matrix activity time, to simplify implementation of display timeouts and the like.
* Add requested changes from code review.
* Simplify split matrix last changed.
* Add proper prototypes for Tap-Hold Per Key functions
* Fix handwired/tennie default keymap
* Remove unneeded references
* Fix tapping term per key check in space cadet
* Pre-emptive fix for tap dance
* Fix marksard/leftover30
* Replace hard coded tapping term with define
* 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>
* Update ADB impelmentation in tmk_core to recent version.
Pcked from tmk_keyboard repository revision: 48d696443857512d45f9a7329e0dd0a76345860f
* Restore convenient ADB functions used in QMK port.
* Do cformat.
* Split dmac_desc declaration and definition
According to the official documentation[1] gcc 10 is more strict about
correct extern usage.
I've had to move the definition of dmac_desc and dmac_desc_wb from
i2c_master.h to the corresponding .c file. This could be an issue if
anyone includes the i2c_master.h file without liking with the object
file.
[1]: https://gcc.gnu.org/gcc-10/porting_to.html
* Remove the keymap_config definition from keymaps
The keymap_config def was conflicting with the one found in
tmk_core/common/magic.c. Declaring it extern in magic.c breaks a bunch
of keyboard that rely on that declaration (like the ergodox). Instead
I've removed the one found in the keymap.c of the massdrop alt.
The same change will have to be made to other keyboards.