Commit Graph
66 Commits
Author SHA1 Message Date
Stefan KerkmannandGitHub 27dec8d16d [Core] Allow custom timings for WS2812 PIO driver (#18006) 2022-11-10 07:58:15 +11:00
Stefan KerkmannandGitHub 19145704e4 [Core] Adjust PWM hardware audio driver for RP2040 (#17723) 2022-10-27 19:26:16 +02:00
Stefan KerkmannandGitHub c76d2074b6 [Bug] Fix ST7565 handler deadlock (#18609) 2022-10-05 19:22:57 +02:00
Stefan KerkmannandGitHub 7e844a4d55 [Core] RP2040: use built-in integer hardware divider and optimized i64 multiplication (#18464) 2022-10-04 23:43:38 +02:00
Stefan KerkmannandGitHub 996a9006d3 [Core] PWM Backlight for RP2040 (#17706) 2022-10-04 23:10:24 +02:00
Stefan KerkmannandGitHub b6ea8837e4 [Bug] RP2040: only clear RX FIFO for serial pio driver clear (#18581) 2022-10-04 19:56:40 +01:00
Stefan KerkmannandGitHub 56f7b34289 [Core] rewrite locking in split transaction handlers (#18417) 2022-10-05 05:49:29 +11:00
Stefan KerkmannandGitHub 976f454df0 [Bug] Update ChibiOS-Contrib for USB IRQ and bus handling fixes (#18574) 2022-10-03 18:57:13 +01:00
Stefan KerkmannandGitHub 6bbcabe0cc [Core] Serial-protocol: always clear receive queue on main half of split keyboard (#18419) 2022-10-03 18:23:45 +02:00
Stefan KerkmannandGitHub 6f13a76530 [Core] ChibiOS: Fix USB bus disconnect handling (#18566) 2022-10-02 15:35:33 +02:00
Stefan KerkmannandGitHub b8ffaa6331 Copy RP2040 vector table to RAM on startup (#18424)
...this reduces possible latency when invoking interrupt handlers by
mitigating XIP cache misses which are not existent when running code from
RAM.
2022-09-22 22:48:20 +01:00
Stefan KerkmannandGitHub 828a1db035 Update chibios-contrib for RP2040 i2c fixes take 2 (#18455)
...includes missing system locking inside a timeout waiting condition and
updates to the rp2040 linker file.
2022-09-22 20:57:50 +01:00
Stefan KerkmannandGitHub 881aab9e76 Stabilize Half-duplex PIO split comms take 2 (#18421)
...by moving the actually timing critical `enter_rx_state()` and
`leave_rx_state()` functions to RAM in order to not be affected by XIP
cache spikes. This commit also reverts the hacky USB interrupt disabling
that was done in 293c53d774
2022-09-20 08:54:43 +02:00
Stefan KerkmannandGitHub 5a563444ac Update ChibiOS to latest 21.11.2 (#18428)
This includes a hotfix for RP2040 deadlocks due to XIP cache misses in
the ChibiOS virtual timer implementation.
2022-09-20 01:14:43 +01:00
Stefan KerkmannandGitHub 613e3f68b5 Update pico-sdk to version 1.4.0 (#18423)
...which contains fixes for GCC warnings.
2022-09-19 19:30:16 +01:00
Stefan KerkmannandGitHub 2aa3a8e059 [Core] remove busy waiting from rgblight functions (#18418) 2022-09-19 18:05:31 +02:00
Stefan KerkmannandGitHub e99ec28f5f [Core] Introduce pointing device specific debug messages (#17663) 2022-08-29 19:16:49 +02:00
Stefan KerkmannandGitHub f74ed5fc53 Fix GD32VF103 WS2812 PWM driver (#18067)
...by adding the missing STM32 DMA defines.
2022-08-15 18:00:22 +01:00
Stefan KerkmannandGitHub 8ce946b5c8 [Bug] Add key event check to is_tap_record and remove is_tap_key (#18063) 2022-08-15 16:40:51 +02:00
Stefan KerkmannandGitHub f27b617f36 [Core] Process all changed keys in one scan loop, deprecate QMK_KEYS_PER_SCAN (#15292) 2022-08-06 20:51:13 +10:00
Stefan KerkmannandGitHub ed9bdcbc36 [Core] guard RPC invocation by checking RPC info against crc checksum (#17840) 2022-08-06 18:46:59 +10:00
Stefan KerkmannandGitHub a204523bbb [Core] RP2040 disable PIO IRQs on serial timeout (#17839) 2022-07-29 20:13:16 +02:00
Stefan KerkmannandGitHub 157ea96411 ChibiOS: use correct status codes in i2c_master.c (#17808)
msg_t is MSG_OK in the success case and either MSG_RESET or MSG_TIMEOUT
in case of errors. So actually use them in the comparison.
2022-07-28 02:02:10 +01:00
Stefan KerkmannandGitHub 59d940c9f3 ChibiOS-Contrib: Update for RP2040 PWM and I2C driver (#17817) 2022-07-27 10:06:18 +02:00
083b42068a Chibios: Stop I2C peripheral on transaction error (#17798)
From the ChibiOS HAL I2C driver pages:

After a timeout the driver must be stopped and restarted because the bus is in
an uncertain state.

This commit does that stopping explicitly on any error that occurred, not only
timeouts. As all the i2c functions restart the peripheral if necessary it is
safe to do so.

Co-authored-by: Dasky <32983009+daskygit@users.noreply.github.com>

Co-authored-by: Dasky <32983009+daskygit@users.noreply.github.com>
2022-07-26 21:40:14 +02:00
Stefan KerkmannandGitHub a304a9b51e Use correct angle tune range of +/-127 on PMW33XX (#17708)
...partially reverts 580bcff4f6 as the
datasheet doesn't claim that the angle tuning as limited to +/- 30
degrees.
2022-07-17 21:08:55 +02:00
580bcff4f6 Use correct angle tune range of +/-30 on PMW33XX (#17693)
Co-authored-by: Daniel Kao <daniel.m.kao@gmail.com>

Co-authored-by: Daniel Kao <daniel.m.kao@gmail.com>
2022-07-16 11:33:18 +02:00
Stefan KerkmannandGitHub 3c58f98929 [Core] PMW33XX drivers overhaul (#17613)
* PMW33XX drivers overhaul

This combines the PMW3389 and PM3360 drivers as they only differ in the
firmware blobs and CPI get and set functions. The following changes have
been made:

* PMW3389 now gets the same multi-sensor feature that is already available on the
  PMW3360.

* Introduced a shared pmw33xx_report_t struct is now directly readable via SPI
  transactions instead of individual byte-sized reads, saving multiple
  copies and bitshift operations.

* pmw33(89/60)_get_report functions had unreachable branches in their motion
  detection logic these have been simplied as much as possible.

* The fast firmware upload option has been removed as this becomes obsolete by
  the newly introduced polled waiting functions for ChibiOS polled waiting

* PMW33(60/89)_SPI_LSBFIRST and PMW33(60/89)_SPI_MODE config options
  have been removed as they don't need to be configurable.

* All PMW3389 and PMW3360 defines have been unified to a PMW33XX prefix
  to reduce code duplication and make the defines interchangeable

* Adjust keyboards to PMW33XX naming scheme
2022-07-14 11:50:00 +02:00
Stefan KerkmannandGitHub 45ffe42f1a [Fix] Make ChibiOS _wait.h independent of quantum.h (#17645) 2022-07-12 21:54:33 +02:00
Stefan KerkmannandGitHub 3f5dc47296 [Core] Use polled waiting on ChibiOS platforms that support it (#17607)
* Use polled waiting on platforms that support it

Due to context switching overhead waiting a very short amount of time on
a sleeping thread is often not accurate and in fact not usable for timing
critical usage i.e. in a driver. Thus we use polled waiting for ranges
in the us range on platforms that support it instead. The fallback is
the thread sleeping mechanism.

This includes:

* ARM platforms with CYCCNT register (ARMv7, ARMv8) this is
  incremented at CPU clock frequency
* GD32VF103 RISC-V port with CSR_MCYCLE register this is incremented at
  CPU clock frequency
* RP2040 ARMv6 port which uses the integrated timer peripheral which is
  incremented with a fixed 1MHz frequency

* Use wait_us() instead of chSysPolledDelayX

...as it is powered by busy waiting now.

* Add chibios waiting methods test bench
2022-07-11 15:17:05 +02:00
Stefan KerkmannandGitHub 0348071810 Stabilize Half-duplex PIO split comms (#17612) 2022-07-11 04:05:04 -07:00
Stefan KerkmannandGitHub 643f6367a1 [Fix] Patches after printf library update (#17584)
* Add missing '(' to print_bin_reverse32 declaration
* Fix insufficient character buffers on satisfaction75
* Remove \0 character in format string and use corrected offset math
  instead on rocketboard 16
* Replace snprintf_ with snprintf for djinn
* Explicitly ignore format checks for tracktyl manuform that uses %b
  specifier
* Print properly escaped version string in command.c, as PRODUCT or
  other defines can contain constructs like 'Vendor keyboard 66%' which
  will be interpreted as a format specifier
2022-07-07 14:14:09 +02:00
Stefan KerkmannandGitHub 8224f62806 Make debounce() signal changes in the cooked matrix as return value (#17554) 2022-07-07 10:00:40 +02:00
Stefan KerkmannandGitHub d9bb189e25 [Core] Update mpaland/printf to eyalroz/printf fork (#16163)
mpaland printf implementation was abandoned in ~2019 and the fork by
eyalroz is now regarded to be the goto replacement of it. So this commit
incoporates the changes needed to use this fork in QMK.

Note that pointer ptrdiff_t is always supported since commit
51c90f93a97fdaef895783ecbe24569be0db7cb8
2022-07-07 09:27:50 +02:00
Stefan KerkmannandGitHub 77d960cce3 Disable clang-format for stage2_bootloaders (#17516) 2022-06-30 20:07:54 +01:00
d717396708 [Core] Add Raspberry Pi RP2040 support (#14877)
* Disable RESET keycode because of naming conflicts

* Add Pico SDK as submodule

* Add RP2040 build support to QMK

* Adjust USB endpoint structs for RP2040

* Add RP2040 bootloader and double-tap reset routine

* Add generic and pro micro RP2040 boards

* Add RP2040 onekey keyboard

* Add WS2812 PIO DMA enabled driver and documentation

Supports regular and open-drain output configuration. RP2040 GPIOs are
sadly not 5V tolerant, so this is a bit use-less or needs extra hardware
or you take the risk to fry your hardware.

* Adjust SIO Driver for RP2040

* Adjust I2C Driver for RP2040

* Adjust SPI Driver for RP2040

* Add PIO serial driver and documentation

* Add general RP2040 documentation

* Apply suggestions from code review

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

Co-authored-by: Nick Brassel <nick@tzarc.org>
2022-06-30 13:19:27 +02:00
Stefan KerkmannandGitHub 9aa9155e88 [Core] Mark GD32VF103 as ChibiOS-Contrib (#17444) 2022-06-23 08:37:40 +10:00
Stefan KerkmannandGitHub 6a81cb44f2 [Fix] Fix compilation warning for non-split keebs after #17423 (#17439) 2022-06-21 09:31:20 +10:00
Stefan KerkmannandGitHub 2703ecc9e9 [BUG] Fix deadlocks on disconnected secondary half (#17423) 2022-06-21 08:24:53 +10:00
Stefan KerkmannandGitHub fe680a8568 [Core] Split ChibiOS usart split driver in protocol and hardware driver part (#16669) 2022-06-18 08:04:17 +10:00
Stefan KerkmannandGitHub 6d67e9df4b [Core] Allow usage of ChibiOS's SIO driver for split keyboards (#15907) 2022-06-17 22:06:44 +02:00
Stefan KerkmannandGitHub e89478eb0f [Core] Update C standard to GNU11, C++ to GNU++14 (#17114) 2022-06-06 08:47:22 +10:00
Stefan KerkmannandGitHub 4c48760558 Apply EXPECT_REPORT and EXPECT_EMPTY_REPORT (#17311)
...convenience macros to test cases that where missed during #17284
2022-06-05 20:06:05 +01:00
Stefan KerkmannandGitHub 4d107feca9 Check for ongoing transfers on the OUT endpoint (#16974)
...when attempting to start a receiving USB transfer. Previously, we would
check on the IN endpoint which is the transmitting part of the USB endpoint.
This is wrong and lead to two USB transfers being started immediately
after each other in case of e.g. RAW HID endpoints:

1. When finishing an OUT transfer the low level USB driver calls the out_cb
callback, which in turn initiates another OUT transfer by calling
qmkusbDataReceived.

2. When the raw hid receive channel runs empty inside the raw_hid task,
another OUT transfer is started to potentially fill the channel again. This
happens by calling ibnotify.

Both events occur directly after each other, thus triggering the bug.
2022-05-14 23:17:14 +01:00
b1681fb6a1 [Core] Allow usage of AVRs minimal printf library (#16266)
Co-authored-by: Sergey Vlasov <sigprof@gmail.com>
2022-04-22 18:13:31 +10:00
Stefan KerkmannandGitHub 7712a286dc [Core] Use a mutex guard for split shared memory (#16647) 2022-04-19 20:56:16 +10:00
Stefan KerkmannandGitHub 147e57fd59 [QP] Check BPP capabilities before loading the palette (#16863) 2022-04-17 08:30:51 +10:00
Stefan KerkmannandGitHub 119abc4375 Refactor writePin to work with statements (#16738) 2022-03-27 15:07:25 -07:00
Stefan KerkmannandGitHub 7e669421f8 Rename TICK to TICK_EVENT to prevent naming conflicts (#16649) 2022-03-14 20:06:21 +00:00
Stefan KerkmannandGitHub 2bface8f89 Add flash target for UF2 bootloaders (#16525) 2022-03-07 08:59:06 -08:00
Stefan KerkmannandGitHub 156f0561f2 [Core] Squeeze AVR some more with -mrelax and -mcall-prologues (#16269) 2022-02-26 19:05:03 -08:00
Stefan KerkmannandGitHub be59e8af2b Deprecate split transactions status field (#16023) 2022-01-26 21:13:27 -08:00
Stefan KerkmannandGitHub 5470e4a8ad [Core] ChibiOS: shorten USB disconnect state on boot to 50ms (#15805) 2022-01-10 15:01:20 -08:00
Stefan KerkmannandGitHub 8b865a9d64 [Core] Don't send keyboard reports that propagate no changes to the host (#14065) 2021-12-14 10:40:18 -08:00
Stefan KerkmannandGitHub c1297ceb97 [Core] Remove matrix_is_modified() and debounce_is_active() (#15349) 2021-11-29 08:22:10 -08:00
Stefan KerkmannandGitHub ca5670762b Fix HOLD_ON_OTHER_KEY_PRESS after #11059 (#15307)
that broke compilation because of a typo: KEYPRESS should have been
KEY_PRESS
2021-11-28 05:54:51 +11:00
a24bdccee0 [Tests] Increase QMK test coverage take 2 (#15269)
* Add per-test keymaps

* Add better trace and info logs for failed unit-tests

* Add layer state assertion with tracing message

* Use individual test binaries configuration options

* Add basic qmk functionality tests

* Add tap hold configurations tests

* Add auto shift tests

Co-authored-by: Nick Brassel <nick@tzarc.org>
2021-11-23 13:31:01 +11:00
b6054c0206 [Tests] Increase QMK test coverage (#13789)
* Add per-test keymaps

* Add better trace and info logs for failed unit-tests

* Add layer state assertion with tracing message

* Use individual test binaries configuration options

* Add basic qmk functionality tests

* Add tap hold configurations tests

* Add auto shift tests

* `qmk format-c

* Fix tests

Co-authored-by: Nick Brassel <nick@tzarc.org>
2021-11-23 08:15:04 +11:00
Stefan KerkmannandGitHub 5c2052fd47 [Core] RISC-V toolchain and picolibc fixes (#15109)
* [Core] Fix RISC-V toolchain installation

The risc-v toolchain is only available on distributions based on Debian 11+
so we check for their availability before installing them.

* [Core] Fix heap symbols and syscalls for picolibc

picolibc internally uses __heap_start and __heap_end instead of the
defacto chibios linker script standard __heap_base__ and __heap_end__
therefore we introduce these symbols as an alias. Usually all memory
used within QMK is statically allocated, but some algorithms make usage
of malloc and friends.

Also the timeval struct is not defined by picolibc for syscalls, therefore it
is declared as stub.
2021-11-20 20:04:16 +00:00
Stefan KerkmannandGitHub e50867d52d [Core] Add support for RISC-V builds and GD32VF103 MCU (#12508)
* Add support for RISC-V builds and GD32VF103 MCU

* Add toolchain selection in chibios.mk based on the mcu selected in
mcu_selection.mk
* Reorder and added comments to chibios.mk to have a streamlined makefile
* Add GD32VF103 mcu to possible targets for QMK.
* Add STM32 compatibility for GD32VF103 MCU, this is hacky but more efficent
  then rewriting every driver.
* Add GigaDevice DFU bootloader as flash target, please note that
  dfu-util of at least version 0.10 is needed.
* Add analog driver compatibility
* Add apa102 bitbang driver compatibility
* Add ws2812 bitbang driver compatibility
* Add eeprom in flash emulation compatibility
* Allow faster re-builds with ccache

* Add SiPeed Longan Nano to platform files

* Add SiPeed Longan Nano Onekeys

* Make quine compatible with other bootloaders

* Support builds with picolibc

* Add risc-v toolchain to arch and debian/ubuntu scripts
2021-10-18 16:23:20 +11:00
Stefan KerkmannandGitHub efde8d657a Use opendrain pin with external pullup again (#14474) 2021-09-17 12:12:20 +01:00
Stefan KerkmannandGitHub 04bc74d8f5 Switch split_common to CRC subsystem (#13418) 2021-07-02 22:28:32 +01:00
117bff17ba [Core] Unite half-duplex and full-duplex serial drivers (#13081)
* Unite half-duplex and full-duplex serial driver.

* Add full duplex operation mode to the interrupt based driver
* Delete DMA UART based full duplex driver
* The new driver targets #11930

* Fix freezes with failing transactions in half-duplex

* Increase default serial TX/RX buffer size to 128 bytes

* Correctly use bool instead of size_t

Co-authored-by: Nick Brassel <nick@tzarc.org>
2021-07-02 08:24:08 +10:00
Stefan KerkmannandGitHub ef92c9ee2c Add CRC8 calculation subsystem to quantum (#12641)
* Intended usage is data validation in split transport code.
* Default space efficient algorithm.
* Opt-in fast table based algorithmn with #define CRC8_USE_TABLE switch.
* Define switches for size and speed optimized versions, the default is size
  optimized by using uint_least8_t as datatype for calculations.
  * #define CRC8_OPTIMIZE_SPEED uses uint_fast8_t as datatype for
    calculations, this only affects 32-bit Archs like ARM and RISC-V.
* Placeholder crc_init() function for hardware backed crc calculation,
  not implemented yet.
2021-06-18 00:09:43 +01:00
Stefan KerkmannandGitHub 49fd3c0760 [Core] ChibiOS fix O3 and LTO breakage of extra keys and joystick (#12819) 2021-06-06 22:16:55 -07:00
Stefan KerkmannandGitHub d9610120de Add Full-duplex serial driver for ARM boards (#9842) 2021-05-26 20:37:54 -07:00