mirror of
https://github.com/qmk/qmk_firmware.git
synced 2025-01-19 08:05:01 +00:00
Reduce AVR clock to 8MHz
This commit is contained in:
parent
ac59886d3f
commit
84a11e746f
@ -4,8 +4,10 @@ MCU = atmega32u4
|
|||||||
# Allow flashing with usbasp
|
# Allow flashing with usbasp
|
||||||
AVRDUDE_MCU = $(MCU)
|
AVRDUDE_MCU = $(MCU)
|
||||||
|
|
||||||
# Processor frequency
|
# CPU frequency divided by two since AVR is at 3.3V
|
||||||
F_CPU = 16000000
|
F_CPU = 8000000
|
||||||
|
# External oscillator is 16Mhz
|
||||||
|
F_USB = 16000000
|
||||||
|
|
||||||
# Bootloader selection
|
# Bootloader selection
|
||||||
# Teensy halfkay
|
# Teensy halfkay
|
||||||
|
@ -917,8 +917,14 @@ static void setup_mcu(void) {
|
|||||||
MCUSR &= ~_BV(WDRF);
|
MCUSR &= ~_BV(WDRF);
|
||||||
wdt_disable();
|
wdt_disable();
|
||||||
|
|
||||||
|
// HACK for System76 boards with AVR 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 */
|
/* Disable clock division */
|
||||||
clock_prescale_set(clock_div_1);
|
clock_prescale_set(clock_div_1);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \brief Setup USB
|
/** \brief Setup USB
|
||||||
|
Loading…
Reference in New Issue
Block a user