summaryrefslogtreecommitdiff
path: root/avr/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'avr/main.c')
-rw-r--r--avr/main.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/avr/main.c b/avr/main.c
index 65622cc..9d7c89f 100644
--- a/avr/main.c
+++ b/avr/main.c
@@ -77,11 +77,15 @@ void setup_avr(void)
MCUCR = _BV(JTD);
MCUCR = _BV(JTD);
- /* disable unused peripherals */
- PRR0 = _BV(PRTIM0) | _BV(PRADC);
+ /* Disable peripherals. Enable individually in respective init function. */
+ PRR0 = _BV(PRTWI) |
+ _BV(PRTIM2) | _BV(PRTIM0) | _BV(PRTIM1) |
+ _BV(PRSPI) | _BV(PRUSART0) | _BV(PRADC);
+
PRR1 = _BV(PRTIM5) | _BV(PRTIM4) | _BV(PRTIM3) |
_BV(PRUSART3) | _BV(PRUSART2) | _BV(PRUSART1);
+
/* disable analog comparator */
ACSR = _BV(ACD);
/* Ports */
@@ -91,7 +95,7 @@ void setup_avr(void)
CLKPR = 0;
/* Timer */
-
+ PRR0 &= ~_BV(PRTIM2);
OCR2A = F_CPU / 256 / 1000 - 1; /* Timer2: 1000Hz interval (OC2A) */
TCCR2A = (0b10 << WGM20); /* CTC Mode */
TCCR2B = (0b110 << CS20); /* Prescaler 256 */