Commit graph

304 commits

Author SHA1 Message Date
Nick Brassel 44f1bd9b3a
ChibiOS 21.11.1 update. (#16251)
* ChibiOS 21.11.1 update.

* `uf2-tinyuf2` => `tinyuf2`

* Updated chibios-contrib, fixup preprocessor for tinyuf2 bootloader.

* Fixup keychron L433 boards.

* Makefile cleanup.

* RISC-V build fixes.

* Fixup RISC-V build.
2022-03-07 21:04:22 +11:00
QMK Bot bcd4f34b26 Merge remote-tracking branch 'origin/master' into develop 2022-03-04 03:57:31 +00:00
Ryan d412854e37
analog.[ch]: remove unnecessary includes (#16471) 2022-03-04 14:56:59 +11:00
Stefan Kerkmann 156f0561f2
[Core] Squeeze AVR some more with -mrelax and -mcall-prologues (#16269) 2022-02-26 19:05:03 -08:00
Joel Challis 4fd04b2371
Fix compilation of ChibiOS UART driver (#16348)
Cherry picked fix from 15724
2022-02-13 20:44:44 +00:00
QMK Bot 63646e8906
Format code according to conventions (#16322) 2022-02-12 18:29:31 +00:00
Nick Brassel d31dd6d2a0
Followup to #16220, more test error output. (#16221) 2022-02-05 12:51:23 +11:00
Joel Challis 135c935990
Initial migration of suspend callbacks (#16067)
* Initial migration of suspend logic

* Add header
2022-02-05 05:10:00 +11:00
Sergey Vlasov 580ef6d88f
ChibiOS timer fixes (#16017)
* chibios/timer: Move the 16-bit timer handling into a separate function

Extract the code which effectively makes a 32-bit tick counter from a
possibly 16-bit ChibiOS system timer into a separate function.  Does
not really change the behavior of the timer API, but makes the actions
done in `timer_clear()` and `timer_read32()` more obvious.

* chibios/timer: Rename some variable to better reflect their role

* chibios/timer: Fix 32-bit tick counter overflow handling

The QMK timer API implementation for ChibiOS used a 32-bit tick counter
(obtained from the ChibiOS system timer) and then converted the value to
milliseconds to produce the timer value for QMK.  However, the frequency
of the ChibiOS timer is above 1000 Hz in most cases (values of 10000 Hz
or even 100000 Hz are typically used), and therefore the 32-bit tick
counter was overflowing and wrapping around much earlier than expected
(after about 5 days for 10000 Hz, or about 12 hours for 100000 Hz).
When this wraparound happened, the QMK timer value was jumping back to
zero, which broke various code dealing with timers (e.g., deferred
executors).

Just making the tick counter 64-bit to avoid the overflow is not a good
solution, because the ChibiOS code which performs the conversion from
ticks to milliseconds may encounter overflows when handling a 64-bit
value.  Adjusting just the value converted to milliseconds to account
for lost 2**32 ticks is also not possible, because 2**32 ticks may not
correspond to an integer number of milliseconds.  Therefore the tick
counter overflow is handled as follows:

  - A reasonably large number of ticks (the highest multiple of the
    ChibiOS timer frequency that fits into uint32_t) is subtracted from
    the tick counter, so that its value is again brought below 2**32.
    The subtracted value is chosen so that it would correspond to an
    integer number of seconds, therefore it could be converted to
    milliseconds without any loss of precision.

  - The equivalent number of milliseconds is then added to the converted
    QMK timer value, so that the QMK timer continues to count
    milliseconds as it was before the tick counter overflow.

* chibios/timer: Add a virtual timer to make 16-bit timer updates more reliable

The code which extends the 16-bit ChibiOS system timer to a 32-bit tick
counter requires that it is called at least once for every overflow of
the system timer (otherwise the tick counter can skip one or more
overflow periods).  Normally this requirement is satisfied just from
various parts of QMK code reading the current timer value; however, in
some rare circumstances the QMK code may be blocked waiting for some
event, and when this situation is combined with having a rather high
timer frequency, this may result in improper timekeeping.

Enhance the timer reliability by adding a ChibiOS virtual timer which
invokes a callback every half of the timer overflow period.  The virtual
timer callback can be invoked even when the normal QMK code is blocked;
the only requirement is that the timer interrupts are enabled, and the
ChibiOS kernel is not locked for an excessive time (but the timer update
will eventually work correctly if the virtual timer handling is not
delayed by more than a half of the timer overflow period).

Keeping a virtual timer always active also works around a ChibiOS bug
that can manifest with a 16-bit system timer and a relatively high timer
frequency: when all active virtual timers have delays longer than the
timer overflow period, the handling of virtual timers stops completely.
In QMK this bug can result in a `wait_ms()` call with a delay larger
than the timer overflow period just hanging indefinitely.  However, when
the timer update code adds a virtual timer with a shorter delay, all
other virtual timers are also handled properly.
2022-02-05 05:08:50 +11:00
Nick Brassel 0be2eaf174
Create a build error if no bootloader is specified. (#16181)
* Create a build error if no bootloader is specified.

* Update builddefs/bootloader.mk

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

Co-authored-by: Ryan <fauxpark@gmail.com>
2022-02-03 19:22:49 +11:00
Nick Brassel 1bdc1c23c7
Fixup builds so that teensy EEPROM knows which MCU it's targeting. (#16168) 2022-02-02 16:21:07 +11:00
Nick Brassel e22efc037a
Don't make EEPROM size assumptions with dynamic keymaps. (#16054)
* Don't make EEPROM size assumptions with dynamic keymaps.

* Add support for checking against emulated flash, error out if someone attempts to build a board without specifying EEPROM size.

* Reorder defines so that MCU is considered last.

* Refactor EEPROM definitions for simplicity.

* Fix max sizing of kabedon/kabedon980.

* Fix max sizing of mechlovin/olly/jf.

* Fix unit tests.

* Review comments, add messages with values during build failures.
2022-02-02 15:04:37 +11:00
Stefan Kerkmann be59e8af2b
Deprecate split transactions status field (#16023) 2022-01-26 21:13:27 -08:00
Joel Challis 6a9ec74b32
Remove unused suspend_idle (#16063) 2022-01-26 14:57:28 -08:00
Ryan c71c0fba90
Fix bootloader_jump for certain CTRL boards (#16026) 2022-01-25 09:28:13 +11:00
Nick Brassel 8f22819d47
Default EEPROM implementation should be transient when not implemented. Removed the equivalent eeprom_teensy fallback. (#16020) 2022-01-24 14:18:05 +00:00
Nick Brassel 77062e9a36
Add L432, L442. (#16016) 2022-01-24 08:49:36 +11:00
Dasky 08a42dc72c
Fix broken bootloader builds in develop. (#15880) 2022-01-15 01:04:58 +00:00
QMK Bot ceab485e58 Merge remote-tracking branch 'origin/master' into develop 2022-01-09 21:17:55 +00:00
Michael Stapelberg 7c186ebb97
Revert "core: make the full 4096 bytes of EEPROM work on Teensy 3.6 (#12947)" (#15695)
This reverts commit 7f8faa429e.

related to https://github.com/qmk/qmk_firmware/issues/15521
2022-01-10 08:17:15 +11:00
Ryan 5fb93934d0
Fixes for bootloader refactor build failures (#15638) 2022-01-06 06:55:46 +11:00
QMK Bot be2265d0d1
Format code according to conventions (#15593) 2021-12-27 21:20:52 +11:00
Ryan 6bc870d899
Refactor bootloader_jump() implementations (#15450)
* Refactor `bootloader_jump()` implementations

* Fix tests?

* Rename `atmel-samba` to `md-boot`
2021-12-27 21:10:07 +11:00
Nick Brassel 4d96e53222
More GPIO compilation fixes. (#15592) 2021-12-26 21:36:52 -08:00
Nick Brassel 3a3272a3d6
Defer pin operations to gpio.h (#15589) 2021-12-27 13:27:38 +11:00
Nick Brassel 6e40dfa022
Add open-drain GPIO support. (#15282)
* Add open-drain GPIO support.

* `qmk format-c`

* Wording.

* Remove port GPIO implementations as the only board that uses it has its own internal defs anyway. Will wait for first-class handling of ports in core before reimplementing.
2021-12-27 11:52:10 +11:00
Drashna Jael're af936c6ae6
Merge remote-tracking branch 'origin/master' into develop 2021-12-08 08:17:55 -08:00
Andrew-Fahmy 755731f0ba
Fix RESET not working for keyboards with Kiibohd bootloader (#15430) 2021-12-07 20:36:39 -08:00
QMK Bot 12b9831eeb Merge remote-tracking branch 'origin/master' into develop 2021-12-05 19:52:49 +00:00
Joy Lee 679f83f9de
Modified config.h default configuration (#15387)
* Modified config.h default configuration

* Modified config.h default configuration
2021-12-06 06:52:08 +11:00
Joel Challis 3bf2403244
Tidy up existing i2c_master implementations (#15376)
* Move chibios defines out of header

* Make some avr defines internal
2021-12-02 14:32:31 +00:00
Joy Lee 193a1350a0
[Core] Added chconf.h for WB32 (#15359) 2021-11-30 09:51:44 -08:00
Nick Brassel 94d7cc3712
WB32F3G71 config migration with removal of unnecessary items. (#15309)
* Config migration with removal of unnecessary items.

* Removed as per suggestion.
2021-11-27 10:35:24 +11:00
Joy Lee 68838bb700
Westberrytech pr (#14422)
* Added support for WB32 MCU

* Modified eeprom_wb32.c

* Remove the eeprom_wb32-related code
2021-11-27 09:28:18 +11:00
Joel Challis 5e9c29da0d
Tidy up adjustable ws2812 timing (#15299) 2021-11-25 19:35:06 +00:00
Jordan Banasik 3d00620711
Add ifndef to WS2812 timing constraints (#14678)
* Add ifndef to WS2812 timing constraints

Due to the way that the PrimeKB Meridian PCB was designed, this change
is needed in order to properly adjust the LEDs.

Testing:
* Compiled primekb/meridian:default successfully
* Compiled random board (walletburner/neuron:default) successfully

* Fix linting errors

Missed some spacing

* More linting fixes

Spacing on the comments... really?

* Rename WS2812 timing parameters for clarity; add comments

* Add docs update for the WS2812 timing macros

* Fix typo on comment

* Add ifndef for WS2812_RES

* Update double backticks and table with parameters

* Move timing adjustments documentation to ws2812_drivers

* Move timings adjustment discussion to bitbang section

* Update T0H and T1H definitions in subtractions

* format

Co-authored-by: Gondolindrim <alvaro.volpato@usp.br>
Co-authored-by: zvecr <git@zvecr.com>
2021-11-25 16:55:46 +00:00
Joel Challis 282e916d86
Remove use of __flash due to LTO issues (#15268) 2021-11-24 18:38:49 +11:00
Stefan Kerkmann 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
Joel Challis 2728603fe6
Move tmk_core/common/<plat> (#13918) 2021-11-19 10:41:02 -08:00
Drashna Jaelre ca4b54bb30
Fix uart function prototypes (#15162) 2021-11-15 20:15:45 +11:00
Ryan 04b51e381e
Update UART driver API (#14839)
* Add uart_puts() and uart_gets()

* Add some docs

* Rework API

* Formatting

* Update docs/uart_driver.md

Co-authored-by: Sergey Vlasov <sigprof@gmail.com>

* Simplify a uart_write() loop

* Update platforms/avr/drivers/uart.c

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

Co-authored-by: Sergey Vlasov <sigprof@gmail.com>
Co-authored-by: Joel Challis <git@zvecr.com>
2021-11-13 18:23:14 +00:00
Nick Brassel 5da04fb45b
Update to ChibiOS 20.3.4, support builds against trunk (#14208)
* Add support for building against ChibiOS svn/trunk.

* Swap to 21.6.x

* Update to latest branch revision as released version is broken.

* Updated configs.

* Conf updates.

* Updated ChibiOS

* Convert STM32L422 to actual L422 ChibiOS platform.

* Downgrade to 20.3.4 as ChibiOS 21.6.x is being aborted.

* Rollback L422-based boards.
2021-11-03 08:26:40 +11:00
Joel Challis 92385e30cd
Manually format develop (#15003) 2021-11-01 19:18:33 +00:00
Joel Challis 19b9e406dc
Align usbasp flashing behaviour (#14928) 2021-10-24 14:18:57 +01:00
Joel Challis d4be4b67a2
Relocate PS2 code (#14895)
* Relocate ps2 protocol code

* clang

* Move makefile logic
2021-10-20 21:18:49 +01:00
Stefan Kerkmann 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
bwisn 7e3ff206b8
Add HT32 support to core (#14388)
* tmk_core: temporary fix to allow HT32 based keyboards to work without patched ChibiOS-contrib (AnnePro2)

* HT32: add spi support

Add persistent led support with eeprom (#9)

* adding HT32 support to chibios SPI master driver

update spi driver, fix bad merging with master

* HT32: fix formatting

HT32: Fix formatting: tmk_core/protocol/chibios/usb_main.c

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

* HT32: Apply suggestions from fauxpark's code review

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

* HT32: update spi driver

* ht32: apply code review suggestions, remove old workaround

Co-authored-by: tech2077 <tech2077@gmail.com>
Co-authored-by: Drashna Jaelre <drashna@live.com>
Co-authored-by: Ryan <fauxpark@gmail.com>
2021-10-18 16:17:29 +11:00
Joel Challis 40bc5a8192
Enable CLI flashing via mdloader (#14729)
* Enable CLI flashing via mdloader

* remove flag

* Update qmk flash help
2021-10-15 22:07:33 +01:00
Dasky 7b753f227a
Enable eeprom with F401xE ld (#14752) 2021-10-08 22:26:57 +01:00
Joel Challis 951331cd8d
Fix i2c_readReg16 (#14730) 2021-10-07 11:45:59 +11:00
Ryan bc1f5ef381
i2c_master: Add support for reading/writing to 16-bit registers (#14289) 2021-10-07 10:29:35 +11:00
Drashna Jaelre ba8f1454f4
Move Audio drivers from quantum to platform drivers folder (#14308)
* Move Audio drivers from quantum to platform drivers folder

* fix path for audio drivers

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

Co-authored-by: Ryan <fauxpark@gmail.com>
2021-10-06 12:01:45 +11:00
Joel Challis 3a2a39e5ec
Initial pass of F405 support (#14584)
* Initial pass of F405 support

* remove some conf files

* docs

* clang
2021-09-25 00:19:41 +01:00
Drashna Jaelre 7c10d00ca6
Add RGBW support to PWM and SPI drivers for ChibiOS (#14327)
* Add RGBW support to PWM and SPI drivers for ChibiOS

* Apply suggestions from code review

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

Co-authored-by: Ryan <fauxpark@gmail.com>
2021-09-18 17:28:57 +10:00
Stefan Kerkmann efde8d657a
Use opendrain pin with external pullup again (#14474) 2021-09-17 12:12:20 +01:00
Drashna Jaelre c060ab4e64
Add i2c defaults for Convert to Proton C (#14470)
* Add i2c defaults for Convert to Proton C

* Hide default defines behing CTPC check
2021-09-16 21:40:25 +01:00
Joel Challis 84dba25533
Make ChibiOS PAL interactions less STM32 specific - Round 2 (#14456) 2021-09-16 08:18:58 +10:00
Joel Challis 1a68feb842
Implement F4 eeprom (#14195) 2021-09-15 16:30:26 +01:00
Joel Challis a78f0e8a0b
Refactor use of _STM32_ defines (#14439) 2021-09-15 11:19:51 +10:00
Joel Challis 0ca4a56a04
Refactor use of STM32_SYSCLK (#14430)
* Refactor use of STM32_SYSCLK

* clang
2021-09-14 12:18:36 +10:00
Joel Challis 0fa217a5b7
Align ChibiOS I2C defs with other drivers (#14399)
* Align ChibiOS I2C defs with other drivers

* Update keyboards/xelus/valor_frl_tkl/config.h

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

Co-authored-by: Ryan <fauxpark@gmail.com>
2021-09-12 15:41:33 +01:00
fauxpark a7c972b329 Merge remote-tracking branch 'upstream/master' into develop 2021-09-10 17:36:17 +10:00
Ryan d5cb7de5e4
Change USBasp and bootloadHID bootloaders to lowercase (#14354) 2021-09-10 17:17:54 +10:00
Ryan d977e5d3e9
Remove Arduino-style analogRead() (#14348) 2021-09-08 14:37:59 +01:00
JX 5ed8edae49
Update ws2812_spi.c (#14237) 2021-08-30 20:34:19 +01:00
Joel Challis 48d0ad28e7
Move to correct location (#14171) 2021-08-26 14:14:48 +01:00
Drashna Jaelre d57d9aec4f
Fix bootloadHID comments breaking :flash (#14133) 2021-08-23 23:46:06 +01:00
Path Nirvana f314705921
adding uf2 flash support for blackpill 401 (#13968)
* adding uf2 flash support for blackpill 401

* forgot to add blackpill to keyboard header file

* making changes requested by drashna

* fixing tzarc s comments

* removing the keyboard

* undo the change to dactyl_manuform.h
2021-08-24 08:05:10 +10:00
Joakim Tufvegren 0ae20e7457
Make solo half of split keyboards (more) usable. (#13523)
* Make solo half of split keyboards (more) usable.

Using only one half of a split keyboard (that's using the split_common
framework to communicate) is not a great experience, since several read
timeouts per scan cycle cause an unusably slow scan rate.

This change blocks all split communication attempts for 500 ms
(configurable) after an error occurs, causing the scan rate to become at
least _more_ usable, but might need some tweaking to work fully on most
keyboards. One read timeout still needs to occur after the 500 ms has
passed, and if that timeout isn't low enough, some scan cycles may still
be too slow.

* Fix lint complaint.

* Require 25 consecutive comm errors to see comms as disconnected.

The number of max errors can be overridden by defining
`SPLIT_MAX_CONNECTION_ERRORS`.

* Add comments to new defines, and ability to disable disconnection check.

Also increase `SPLIT_MAX_CONNECTION_ERRORS` to 40, since it's divisible
by most relevant numbers for the description.

* Make lint happy ...again

* Only update `connection_check_timer` when needed.

* Add new defines to split keyboard documentation.

* Move connection timeout logic to transport.c, add `is_transport_connected`.

* Use split_common disconnection logic in matrix.c.

Instead of doing more or less the same thing twice.

* Move disconnection logic to `transport_master`.

Is a cleaner implementation, and causes the scan rate while disconnected
to increase instead of decrease.

* Lint fixes.

* Lower default `SERIAL_USART_TIMEOUT` to 20 ms.

The read timeout must be low enough to not cause exessively long scan
cycles when using a solo split half. 10 ms was determined from testing
to work fine even with the slowest defined baudrate of 19200 (5 ms was
too low for that case), so 20 ms should be fine for most cases.

* Remove `SERIAL_USART_TIMEOUT` from ergodox_infinity/config.h

Was somewhat mistakenly included in an earlier PR.

* Fix building with `USE_I2C`.

* Reduce built firmware size.

Not really sure why this works, the idea was taken from tzarc's work on
split disconnection.

* Tweak and improve opt-out for split disconnection logic.

There are now two ways to opt out from this feature:
* Set `SPLIT_MAX_CONNECTION_ERRORS` to 0. This will completely disable
  the connection status checks (also affects the slave matrix reset logic in
  matrix.c, though).
* Set `SPLIT_CONNECTION_CHECK_TIMEOUT` to 0. This will only disable the
  communication throttling while disconnected. Will make the firmware
  smaller.

* Make split disconnection logic work with custom transports.

Includes a fallback implementation for keyboards using a custom
split_util.c but not a custom matrix.c (currently no such keyboard seems
to be merged, though).

* Remove unnecessary include of timer.h

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

Co-authored-by: Joel Challis <git@zvecr.com>
2021-08-22 10:51:17 +10:00
Joel Challis 4c9003b177
Move chibios board files to allow tmk_core platform migration (#13777)
* Move board files

* fix up after rebase
2021-08-18 00:04:15 +01:00
ruro 3b28178deb
--parallel improvements (#13800)
* improve make parallel jobs support

* document the --parallel option

* disable the output-sync for interactive targets
2021-08-18 08:46:59 +10:00
Joel Challis 1bb7af4d44
Relocate platform specific drivers (#13894)
* Relocate platform specific drivers

* Move stm eeprom

* Tidy up slightly
2021-08-17 23:43:09 +01:00
Ryan 37496f4b60
Add alternate ldscript for STM32duino (F103xB) (#12914)
* Add alternate ldscript for STM32duino (F103xB)

* Refactor out common ldscript stuff

* Move ldscripts into stm32duino board dir, add search path to ldflags
2021-08-18 04:23:22 +10:00
Joel Challis ab941ce614
Move all the flash logic from tmk_core (#13927) 2021-08-15 21:55:23 +01:00
thpoll83 b43c6bc176
Add support for STM32F407x MCUs. (#13718)
* Add support for STM32F407x MCUs.

* Removing STMF407 MCU variation

* Update quantum/mcu_selection.mk

Remove options for dfu flashing

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

* DISABLE STM32_USB_USE_OTG1

* Update platforms/chibios/GENERIC_STM32_F407XE/configs/mcuconf.h

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

* Update platforms/chibios/GENERIC_STM32_F407XE/configs/mcuconf.h

Co-authored-by: thomas.pollak <thomas.pollak@dynatrace.com>
Co-authored-by: Ryan <fauxpark@gmail.com>
Co-authored-by: Drashna Jaelre <drashna@live.com>
Co-authored-by: Nick Brassel <nick@tzarc.org>
2021-08-09 06:52:13 +10:00
Joakim Tufvegren 1409b36851
Remove the #10088 hotfix for Teensy 3.1-like Input:Club keyboards (#12870)
* Remove the #10088 hotfix for K20x MCU:s.

It seems to _cause_ the issue it intended to solve there.

* Cleaner way of removing #10088 hotfix.

Now only affects Ergodox Infinity, Whitefox and K-type, though.

Switches over Ergodox Infinity to the `IC_TEENSY_3_1` board, since that
was a nice place to implement the `restart_usb_driver` override.
However, I would guess this issue is present for other K20x/Teensy 3.1
boards as well...

* Fix comment regarding `IC_TEENSY_3_1` for all keyboards using it.
2021-08-04 07:38:37 +10:00
Stefan Kerkmann 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
Nick Brassel 8bb231aa1c
Adds support for STM32L412xB, STM32L422xB. (#13383)
* Adds support for STM32L412xB, STM32L422xB.

* Add to list of supported MCUs.

* Disable SPI1 by default.
2021-06-30 10:07:40 +10:00
Michael Stapelberg 9956ff4e03
core: wire up flash make target for Teensy 4.x (#13077)
related to https://github.com/kinx-project/kint/issues/5
2021-06-17 04:15:45 +10:00
Ryan 9dcd03b6ca
Set BOOTLOADER = stm32-dfu for all applicable STM32 boards (#12956)
* Set bootloader to stm32-dfu for STM32F303

* Set bootloader to stm32-dfu for STM32F0x2

* Set bootloader to stm32-dfu for STM32F4x1

* Set bootloader to stm32duino for sowbug

* Delete redundant bootloader_defs headers

* Add some missing MCU name comments

* Move APM32 dfu-suffix overrides underneath bootloader

* Remove redundant STM32_BOOTLOADER_ADDRESS defines/rules
2021-06-08 19:48:46 +10:00
James Young 1646c0f26c
2021 May 29 Breaking Changes Update (#13034)
* Add Per Key functionality for AutoShift (#11536)

* LED Matrix: Reactive effect buffers & advanced indicators (#12588)

* [Keyboard] kint36: switch to sym_eager_pk debouncing (#12626)

* [Keyboard] kint2pp: reduce input latency by ≈10ms (#12625)

* LED Matrix: Split (#12633)

* [CI] Format code according to conventions (#12650)

* feat: infinite timeout for leader key (#6580)

* feat: implement leader_no_timeout logic

* docs(leader_key): infinite leader timeout docs

* Format code according to conventions (#12680)

* Update ADC driver for STM32F1xx, STM32F3xx, STM32F4xx (#12403)

* Fix default ADC_RESOLUTION for ADCv3 (and ADCv4)

Recent ChibiOS update removed ADC_CFGR1_RES_10BIT from the ADCv3 headers
(that macro should not have been there, because ADCv3 has CFGR instead of
CFGR1).  Fix the default value for ADC_RESOLUTION to use ADC_CFGR_RES_10BITS
if it is defined (that name is used for ADCv3 and ADCv4).

* Update ADC docs to match the actually used resolution

ADC driver for ChibiOS actually uses the 10-bit resolution by default
(probably to match AVR); fix the documentation accordingly.  Also add
both ADC_CFGR_RES_10BITS and ADC_CFGR1_RES_10BIT constants (these names
differ according to the ADC implementation in the particular MCU).

* Fix pinToMux() for B12 and B13 on STM32F3xx

Testing on STM32F303CCT6 revealed that the ADC mux values for B12 and
B13 pins were wrong.

* Add support for all possible analog pins on STM32F1xx

Added ADC mux values for pins A0...A7, B0, B1, C0...C5 on STM32F1xx
(they are the same at least for STM32F103x8 and larger F103 devices, and
also F102, F105, F107 families).  Actually tested on STM32F103C8T6
(therefore pins C0...C5 were not tested).

Pins F6...F10, which are present on STM32F103x[C-G] in 144-pin packages,
cannot be supported at the moment, because those pins are connected only
to ADC3, but the ChibiOS ADC driver for STM32F1xx supports only ADC1.

* Add support for all possible analog pins on STM32F4xx

Added ADC mux values for pins A0...A7, B0, B1, C0...C5 and optionally
F3...F10 (if STM32_ADC_USE_ADC3 is enabled).  These mux values are
apparently the same for all F4xx devices, except some smaller devices may
not have ADC3.

Actually tested on STM32F401CCU6, STM32F401CEU6, STM32F411CEU6 (using
various WeAct “Blackpill” boards); only pins A0...A7, B0, B1 were tested.

Pins F3...F10 are inside `#if STM32_ADC_USE_ADC3` because some devices
which don't have ADC3 also don't have the GPIOF port, therefore the code
which refers to Fx pins does not compile.

* Fix STM32F3xx ADC mux table in documentation

The ADC driver documentation had some errors in the mux table for STM32F3xx.
Fix this table to match the datasheet and the actual code (mux settings for
B12 and B13 were also tested on a real STM32F303CCT6 chip).

* Add STM32F1xx ADC pins to the documentation

* Add STM32F4xx ADC pins to the documentation

* Add initial support for tinyuf2 bootloader (when hosted on F411 blackpill) (#12600)

* Add support for jumping to tinyuf2 bootloader. Adds blackpill UF2 example.

* Update flashing.md

* Update chconf.h

* Update config.h

* Update halconf.h

* Update mcuconf.h

* eeprom driver: Refactor where eeprom driver initialisation (and EEPROM emulation initialisation) occurs to make it non-target-specific. (#12671)

* Add support for MCU = STM32F446 (#12619)

* Add support for MCU = STM32F446

* Update platforms/chibios/GENERIC_STM32_F446XE/configs/config.h

* Restore mcuconf.h to the one used by RT-STM32F446RE-NUCLEO64

* stm32f446: update mcuconf.h and board.h for 16MHz operation, with USB enabled, and other peripherals disabled.

* Format code according to conventions (#12682)

* Format code according to conventions (#12687)

* Add STM32L433 and L443 support (#12063)

* initial L433 commit

* change to XC

* fix L433

* disable all peripherals

* update system and peripheral clocks

* 433 change

* use its own board  files

* revert its own board files

* l433 specific change

* fix stm32l432xx define

* remove duplicate #define

* fix bootloader jump

* move to L443xx and add i2c2, spi2, usart3 to mcuconf.h

* move to L443

* move to L443

* fix sdmmc in mcuconf.h

* include STM32L443

* add L443

* Include L443 in compatible microcontrollers

* Include L443 in compatible microcontrollers

* Update config bootloader jump description

* Update ChibiOS define reasoning

* Update quantum/mcu_selection.mk

* fix git conflict

* Updated Function96 with V2 files and removed chconf.h and halconf.h (#12613)

* Fix bad PR merge for #6580. (#12721)

* Change RGB/LED Matrix to use a simple define for USB suspend (#12697)

* [CI] Format code according to conventions (#12731)

* Fixing transport's led/rgb matrix suspend state logic (#12770)

* [CI] Format code according to conventions (#12772)

* Fix comment parsing (#12750)

* Added OLED fade out support (#12086)

* fix some references to bin/qmk that slipped in (#12832)

* Resolve a number of warnings in `qmk generate-api` (#12833)

* New command: qmk console (#12828)

* stash poc

* stash

* tidy up implementation

* Tidy up slightly for review

* Tidy up slightly for review

* Bodge environment to make tests pass

* Refactor away from asyncio due to windows issues

* Filter devices

* align vid/pid printing

* Add hidapi to the installers

* start preparing for multiple hid_listeners

* udev rules for hid_listen

* refactor to move closer to end state

* very basic implementation of the threaded model

* refactor how vid/pid/index are supplied and parsed

* windows improvements

* read the report directly when usage page isn't available

* add per-device colors, the choice to show names or numbers, and refactor

* add timestamps

* Add support for showing bootloaders

* tweak the color for bootloaders

* Align bootloader disconnect with connect color

* add support for showing all bootloaders

* fix the pyusb check

* tweaks

* fix exception

* hide a stack trace behind -v

* add --no-bootloaders option

* add documentation for qmk console

* Apply suggestions from code review

* pyformat

* clean up and flesh out KNOWN_BOOTLOADERS

* Remove pointless SERIAL_LINK_ENABLE rules (#12846)

* Make Swap Hands use PROGMEM (#12284)

This converts the array that the Swap Hands feature uses to use PROGMEM,
and to read from that array, as such. Since this array never changes at
runtime, there is no reason to keep it in memory. Especially for AVR
boards, as memory is a precious resource.

* Fix another bin/qmk reference (#12856)

* [Keymap] Turn OLED off on suspend in soundmonster keymap (#10419)

* Fixup build errors on `develop` branch. (#12723)

* LED Matrix: Effects! (#12651)

* Fix syntax error when compiling for ARM (#12866)

* Remove KEYMAP and LAYOUT_kc (#12160)

* alias KEYMAP to LAYOUT

* remove KEYMAP and LAYOUT_kc

* Add setup, clone, and env to the list of commands we allow even with broken modules (#12868)

* Rename `point_t` -> `led_point_t` (#12864)

* [Keyboard] updated a vendor name / fixed minor keymap issues (#12881)

* Add missing LED Matrix suspend code to suspend.c (#12878)

* LED Matrix: Documentation (#12685)

* Deprecate `send_unicode_hex_string()` (#12602)

* Fix spelling mistake regarding LED Matrix in split_common. (#12888)

* [Keymap] Fix QWERTY/DVORAK status output for kzar keymap (#12895)

* Use milc.subcommand.config instead of qmk.cli.config (#12915)

* Use milc.subcommand.config instead

* pyformat

* remove the config test

* Add function to allow repeated blinking of one layer (#12237)

* Implement function rgblight_blink_layer_repeat to allow repeated blinking of one layer at a time

* Update doc

* Rework rgblight blinking according to requested change

* optimize storage

* Fixup housekeeping from being invoked twice per loop. (#12933)

* matrix: wait for row signal to go HIGH for every row (#12945)

I noticed this discrepancy (last row of the matrix treated differently than the
others) when optimizing the input latency of my keyboard controller, see also
https://michael.stapelberg.ch/posts/2021-05-08-keyboard-input-latency-qmk-kinesis/

Before this commit, when tuning the delays I noticed ghost key presses when
pressing the F2 key, which is on the last row of the keyboard matrix: the
dead_grave key, which is on the first row of the keyboard matrix, would be
incorrectly detected as pressed.

After this commit, all keyboard matrix rows are interpreted correctly.

I suspect that my setup is more susceptible to this nuance than others because I
use GPIO_INPUT_PIN_DELAY=0 and hence don’t have another delay that might mask
the problem.

* ensure we do not conflict with existing keymap aliases (#12976)

* Add support for up to 4 IS31FL3733 drivers (#12342)

* Convert Encoder callbacks to be boolean functions (#12805)

* [Keyboard] Fix Terrazzo build failure (#12977)

* Do not hard set config in CPTC files (#11864)

* [Keyboard] Corne - Remove legacy revision support (#12226)

* [Keymap] Update to Drashna keymap and user code (based on develop) (#12936)

* Add Full-duplex serial driver for ARM boards (#9842)

* Document LED_MATRIX_FRAMEBUFFER_EFFECTS (#12987)

* Backlight: add defines for default level and breathing state (#12560)

* Add dire message about LUFA mass storage bootloader (#13014)

* [Keyboard] Remove redundant legacy and common headers for crkbd (#13023)

Was causing compiler errors on some systems.

* Fix keyboards/keymaps for boolean encoder callback changes (#12985)

* `backlight.c`: include `eeprom.h` (#13024)

* Add changelog for 2021-05-29 Breaking Changes merge (#12939)

* Add ChangeLog for 2021-05-29 Breaking Changes Merge: initial version

* Add recent develop changes

* Sort recent develop changes

* Remove sections for ChibiOS changes per tzarc

No ChibiOS changes this round.

* Add and sort recent develop changes

* add notes about keyboard moves/deletions

* import changelog for PR 12172

Documents the change to BOOTMAGIC_ENABLE.

* update section headings

* re-sort changelog

* add additional note regarding Bootmagic changes

* remove changelog timestamp

* update dates in main Breaking Changes docs

* fix broken section anchors in previous changelogs

* add link to backlight/eeprom patch to changelog

* highlight some more changes

* link PRs from section headers

* Restore standard readme

* run: qmk cformat --core-only
2021-05-29 14:38:50 -07:00
Nick Brassel a2412e3f4c
Allow for overriding clocks on F4xx. (#12886) 2021-05-13 12:29:28 +10:00
Nick Brassel 620a946d01
Add STM32G431 and STM32G474 board definitions. (#11793)
* Add STM32G431 and STM32G474 board definitions.

* Add docs.
2021-02-06 11:27:46 +11:00
Ryan 30b46fad57
UART driver refactor (#11637) 2021-01-27 17:42:49 +11:00
Nick Brassel 3b1ffd2ede
ChibiOS enable memory allocations (#11620) 2021-01-19 14:50:51 +00:00
Nick Brassel a7c45daeb8
ChibiOS 20.3.2 (#11495)
* Update ChibiOS submodule

* Update ChibiOS-Contrib submodule

* Update ChibiOS config files
2021-01-20 00:59:12 +11:00
Nick Brassel d85b27bbbc
Leftover early initialisation conversions (#11615)
* jm60

* ergodox_stm32

* F042 bootloader jumps.

* xiaomi/mk02 custom bootloader, no early-init bootloader jump for F072.

* matrix/m20add, matrix/noah
2021-01-20 00:23:07 +11:00
Nick Brassel 75111e967f
Disable subsystems repo-wide. (#11449) 2021-01-10 09:52:49 +11: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
Nick Brassel 296a6cf4ea
ChibiOS conf migrations... take 3 (#11261)
* Add SPI1 DMA stream definitions.

* ChibiOS conf upgrade for acheron/lasgweloth

 acheron/lasgweloth - 3bedb0fe1f1b542b4d90daeaeab8905cd9ee992c

* ChibiOS conf upgrade for box75

 box75 - ff91bacf5cec0b42df02967eb0ecbf4bd1b56928

* ChibiOS conf upgrade for geekboards/macropad_v2

 geekboards/macropad_v2 - 1c205720d47f7e636173064b1aef1637860a9134

* ChibiOS conf upgrade for iron180

 iron180 - 867929d78361a50e34671e4e167cafd927d8982b

* ChibiOS conf upgrade for technika

 technika - cb9295b90980eb8dfdc63d6031533edbb344c045
2020-12-21 15:02:38 +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
QMK Bot 5689df7490 Merge remote-tracking branch 'origin/master' into develop 2020-12-09 08:56:17 +00:00
Nick Brassel 01c7108db5
Fixup config template to match <> instead of "" for includes. (#11166) 2020-12-09 19:55:43 +11:00
Nick Brassel f05b1b54a9
Add default early-init bootloader to F042/F072. (#11120) 2020-12-04 22:03:16 +11:00
Nick Brassel 4444f3cc55
Disable almost all ChibiOS subsystems in default configs (#11111)
* Disable almost all ChibiOS subsystems.

* Modify ChibiOS config updater script to fixup mcuconf include, use develop as base instead of master.

* Add default early-init bootloader to F042/F072.

* Back to 100k freq.
2020-12-04 10:45:39 +11:00
Nick Brassel 87291437bd
Add board specific to Proton-C, with usual defaults turned on. (#10976)
- Set all other ChibiOS defaults to 'off', when not targeting Proton-C
- Modified all existing F303 boards to point at the QMK_PROTON_C to ensure repeatable binary output
- Modified version.h generation so that SKIP_VERSION=yes generates the same output
2020-12-03 13:04:28 +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
Joel Challis b8443863c0
Remove references to ch-bootloader-jump.patch (#10998) 2020-11-22 21:12:30 +00:00
Ryan 9ef4526a2f Remove unused CORTEX_VTOR_INIT (#10053) 2020-08-29 14:30:02 -07:00
Joel Challis 21a00b7f02 ARM backlight - timer implementation (#8291)
* Add GPT timer based backlight driver

* Update to tim15 to avoid conflict with audio

* Update quantum/backlight/backlight_timer.c
2020-08-29 14:30:02 -07:00
Nick Brassel 86e30c2609 F303/Proton-C migration. (#9315) 2020-08-29 14:30:02 -07:00
Nick Brassel 385d49cc39 Initial work for consolidation of ChibiOS platform files (#8327)
* Initial work for consolidation of board files and default ChibiOS configs.

* Migrate F401/F411 black pills for testing.

* Add early init bootloader jump flag.

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

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

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

* Fix up ordering for bootloader_defs file check.

* Match previous $(KEYBOARD_PATHS) value for Proton-C, updated for all board configs.
2020-08-29 14:30:02 -07:00