diff options
author | Leo C | 2014-09-17 22:23:17 +0200 |
---|---|---|
committer | Leo C | 2014-09-17 22:23:17 +0200 |
commit | 04a63b0d5660f1c0c0b7e8123e4f56d188e52a5d (patch) | |
tree | 6cecaf46786fe977dee58aa1b72948221c3fe837 /avr/main.c | |
parent | 6035a17b2becc788c0daaf440deb6cc37d364029 (diff) | |
download | z180-stamp-04a63b0d5660f1c0c0b7e8123e4f56d188e52a5d.zip |
Disable all peripheral functions globally. Enable used functions when needed.
Diffstat (limited to 'avr/main.c')
-rw-r--r-- | avr/main.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -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 */ |