1
0
Fork 0

Support using a timer for wait_us() on ChibiOS-based boards (#12211)

* Support using a timer for wait_us() on ChibiOS-based boards (#12198)

There are spare GPT timers that can be used to get a more accurate
wait_ms() time. This is required for the matrix scan unselect delay (30µs)
to be shorter than the system tick rate of 100µs.

This is limited to the maximum GPT duration of 65535 so values above that
will automatically use the previous implementation based on the system
tick.

Using a specific timer means it can't be shared by another thread at the
same time so when wait_us() is called from anything other than the main
thread it will use the system tick implementation too.

* Update tmk_core/common/chibios/wait.c

* Update tmk_core/common/chibios/wait.c

Co-authored-by: Joel Challis <git@zvecr.com>
This commit is contained in:
Simon Arlott 2021-08-20 00:31:23 +01:00 committed by GitHub
parent 462e7f075a
commit 0a1bf7f6aa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 130 additions and 82 deletions

View file

@ -211,7 +211,8 @@ CHIBISRC = $(STARTUPSRC) \
$(BOARDSRC) \
$(STREAMSSRC) \
$(CHIBIOS)/os/various/syscalls.c \
$(PLATFORM_COMMON_DIR)/syscall-fallbacks.c
$(PLATFORM_COMMON_DIR)/syscall-fallbacks.c \
$(PLATFORM_COMMON_DIR)/wait.c
# Ensure the ASM files are not subjected to LTO -- it'll strip out interrupt handlers otherwise.
QUANTUM_LIB_SRC += $(STARTUPASM) $(PORTASM) $(OSALASM) $(PLATFORMASM)