summaryrefslogtreecommitdiffstats
path: root/tmk_core/common/chibios
diff options
context:
space:
mode:
authorTakeshi ISHII <2170248+mtei@users.noreply.github.com>2021-08-24 22:34:24 +0900
committerGitHub <noreply@github.com>2021-08-24 14:34:24 +0100
commitc9c60d227e38abdf08ca86bcdad3a0cac2579e3f (patch)
tree03ec990a4d98c4a94330e4cccaadc76bc7381c67 /tmk_core/common/chibios
parentc4dbf4bf0118dd785802861beb247433b5b7411d (diff)
add wait_cpuclock() macro for AVR and CPU_CLOCK macro (#12755)
Diffstat (limited to 'tmk_core/common/chibios')
-rw-r--r--tmk_core/common/chibios/_wait.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/tmk_core/common/chibios/_wait.h b/tmk_core/common/chibios/_wait.h
index 4a5172536b..b740afbd24 100644
--- a/tmk_core/common/chibios/_wait.h
+++ b/tmk_core/common/chibios/_wait.h
@@ -41,6 +41,10 @@ void wait_us(uint16_t duration);
} while (0)
#endif
+#include "_wait.c"
+
+#define CPU_CLOCK STM32_SYSCLK
+
/* For GPIOs on ARM-based MCUs, the input pins are sampled by the clock of the bus
* to which the GPIO is connected.
* The connected buses differ depending on the various series of MCUs.
@@ -51,11 +55,8 @@ void wait_us(uint16_t duration);
* If the GPIO_INPUT_PIN_DELAY macro is not defined, the following default values will be used.
* (A fairly large value of 0.25 microseconds is set.)
*/
-
-#include "_wait.c"
-
#ifndef GPIO_INPUT_PIN_DELAY
-# define GPIO_INPUT_PIN_DELAY (STM32_SYSCLK / 1000000L / 4)
+# define GPIO_INPUT_PIN_DELAY (CPU_CLOCK / 1000000L / 4)
#endif
#define waitInputPinDelay() wait_cpuclock(GPIO_INPUT_PIN_DELAY)