diff options
Diffstat (limited to 'quantum/quantum.h')
| -rw-r--r-- | quantum/quantum.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/quantum/quantum.h b/quantum/quantum.h index dd2a6dd53..36a983d57 100644 --- a/quantum/quantum.h +++ b/quantum/quantum.h | |||
| @@ -53,6 +53,7 @@ | |||
| 53 | #include "eeconfig.h" | 53 | #include "eeconfig.h" |
| 54 | #include "bootloader.h" | 54 | #include "bootloader.h" |
| 55 | #include "timer.h" | 55 | #include "timer.h" |
| 56 | #include "sync_timer.h" | ||
| 56 | #include "config_common.h" | 57 | #include "config_common.h" |
| 57 | #include "gpio.h" | 58 | #include "gpio.h" |
| 58 | #include "atomic_util.h" | 59 | #include "atomic_util.h" |
| @@ -194,6 +195,42 @@ extern layer_state_t layer_state; | |||
| 194 | # include "wpm.h" | 195 | # include "wpm.h" |
| 195 | #endif | 196 | #endif |
| 196 | 197 | ||
| 198 | #ifdef USBPD_ENABLE | ||
| 199 | # include "usbpd.h" | ||
| 200 | #endif | ||
| 201 | |||
| 202 | // Function substitutions to ease GPIO manipulation | ||
| 203 | #if defined(__AVR__) | ||
| 204 | |||
| 205 | /* The AVR series GPIOs have a one clock read delay for changes in the digital input signal. | ||
| 206 | * But here's more margin to make it two clocks. */ | ||
| 207 | # if !defined(GPIO_INPUT_PIN_DELAY) | ||
| 208 | # define GPIO_INPUT_PIN_DELAY 2 | ||
| 209 | # endif | ||
| 210 | # define waitInputPinDelay() wait_cpuclock(GPIO_INPUT_PIN_DELAY) | ||
| 211 | |||
| 212 | #elif defined(__ARMEL__) || defined(__ARMEB__) | ||
| 213 | |||
| 214 | /* For GPIOs on ARM-based MCUs, the input pins are sampled by the clock of the bus | ||
| 215 | * to which the GPIO is connected. | ||
| 216 | * The connected buses differ depending on the various series of MCUs. | ||
| 217 | * And since the instruction execution clock of the CPU and the bus clock of GPIO are different, | ||
| 218 | * there is a delay of several clocks to read the change of the input signal. | ||
| 219 | * | ||
| 220 | * Define this delay with the GPIO_INPUT_PIN_DELAY macro. | ||
| 221 | * If the GPIO_INPUT_PIN_DELAY macro is not defined, the following default values will be used. | ||
| 222 | * (A fairly large value of 0.25 microseconds is set.) | ||
| 223 | */ | ||
| 224 | # if !defined(GPIO_INPUT_PIN_DELAY) | ||
| 225 | # if defined(STM32_SYSCLK) | ||
| 226 | # define GPIO_INPUT_PIN_DELAY (STM32_SYSCLK / 1000000L / 4) | ||
| 227 | # elif defined(KINETIS_SYSCLK_FREQUENCY) | ||
| 228 | # define GPIO_INPUT_PIN_DELAY (KINETIS_SYSCLK_FREQUENCY / 1000000L / 4) | ||
| 229 | # endif | ||
| 230 | # endif | ||
| 231 | # define waitInputPinDelay() wait_cpuclock(GPIO_INPUT_PIN_DELAY) | ||
| 232 | |||
| 233 | #endif | ||
| 197 | #define SEND_STRING(string) send_string_P(PSTR(string)) | 234 | #define SEND_STRING(string) send_string_P(PSTR(string)) |
| 198 | #define SEND_STRING_DELAY(string, interval) send_string_with_delay_P(PSTR(string), interval) | 235 | #define SEND_STRING_DELAY(string, interval) send_string_with_delay_P(PSTR(string), interval) |
| 199 | 236 | ||
| @@ -201,6 +238,7 @@ extern layer_state_t layer_state; | |||
| 201 | extern const uint8_t ascii_to_keycode_lut[128]; | 238 | extern const uint8_t ascii_to_keycode_lut[128]; |
| 202 | extern const uint8_t ascii_to_shift_lut[16]; | 239 | extern const uint8_t ascii_to_shift_lut[16]; |
| 203 | extern const uint8_t ascii_to_altgr_lut[16]; | 240 | extern const uint8_t ascii_to_altgr_lut[16]; |
| 241 | extern const uint8_t ascii_to_dead_lut[16]; | ||
| 204 | // clang-format off | 242 | // clang-format off |
| 205 | #define KCLUT_ENTRY(a, b, c, d, e, f, g, h) \ | 243 | #define KCLUT_ENTRY(a, b, c, d, e, f, g, h) \ |
| 206 | ( ((a) ? 1 : 0) << 0 \ | 244 | ( ((a) ? 1 : 0) << 0 \ |
