Backport F_CPU/F_USB hack from system76 (#14286)

Co-authored-by: Ryan <fauxpark@gmail.com>
This commit is contained in:
Drashna Jaelre 2021-09-08 20:19:06 -07:00 committed by GitHub
parent cb4006c0b4
commit 6d43a5daf4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1015,8 +1015,13 @@ static void setup_mcu(void) {
MCUSR &= ~_BV(WDRF); MCUSR &= ~_BV(WDRF);
wdt_disable(); 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); clock_prescale_set(clock_div_1);
#endif
} }
/** \brief Setup USB /** \brief Setup USB