summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2021-09-08 20:19:06 -0700
committerGitHub <noreply@github.com>2021-09-08 20:19:06 -0700
commit6d43a5daf4225cf677840d11b151d28f49e8f9e9 (patch)
treed05720473931056f4fecf03e83e645d3f3225369
parentcb4006c0b47e9d99c2f60b74d414b19cf4b9e333 (diff)
Backport F_CPU/F_USB hack from system76 (#14286)
Co-authored-by: Ryan <fauxpark@gmail.com>
-rw-r--r--tmk_core/protocol/lufa/lufa.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/tmk_core/protocol/lufa/lufa.c b/tmk_core/protocol/lufa/lufa.c
index 4e17834be9..5b56e8a03c 100644
--- a/tmk_core/protocol/lufa/lufa.c
+++ b/tmk_core/protocol/lufa/lufa.c
@@ -1015,8 +1015,13 @@ static void setup_mcu(void) {
MCUSR &= ~_BV(WDRF);
wdt_disable();
- /* Disable clock division */
+// For boards running at 3.3V and crystal at 16 MHz
+#if (F_CPU == 8000000 && F_USB == 16000000)
+ /* Divide clock by 2 */
+ clock_prescale_set(clock_div_2);
+#else /* Disable clock division */
clock_prescale_set(clock_div_1);
+#endif
}
/** \brief Setup USB