Mercurial > templog
comparison main.c @ 358:71d2cc90354a
try a few more power saving measures, untested
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sun, 24 Jun 2012 14:18:35 +0800 |
parents | 99f8b97a9449 |
children | 0d3d14af55c2 |
comparison
equal
deleted
inserted
replaced
357:00e213d1f067 | 358:71d2cc90354a |
---|---|
118 // Set clock to 2mhz | 118 // Set clock to 2mhz |
119 cli(); | 119 cli(); |
120 CLKPR = _BV(CLKPCE); | 120 CLKPR = _BV(CLKPCE); |
121 // divide by 4 | 121 // divide by 4 |
122 CLKPR = _BV(CLKPS1); | 122 CLKPR = _BV(CLKPS1); |
123 sei(); | 123 |
124 // enable pullups | |
125 PORTB = 0xff; // XXX change when using SPI | |
126 PORTD = 0xff; | |
127 PORTC = 0xff; | |
124 | 128 |
125 // 3.3v power for bluetooth and SD | 129 // 3.3v power for bluetooth and SD |
126 DDR_LED |= _BV(PIN_LED); | 130 DDR_LED |= _BV(PIN_LED); |
127 DDR_SHDN |= _BV(PIN_SHDN); | 131 DDR_SHDN |= _BV(PIN_SHDN); |
128 | 132 |
129 // set pullup | 133 // set pullup |
130 PORTD |= _BV(PD2); | 134 PORTD |= _BV(PD2); |
131 // INT0 setup | 135 // INT0 setup |
136 EICRA = (1<<ISC01); // falling edge - data sheet says it won't work? | |
132 EIMSK = _BV(INT0); | 137 EIMSK = _BV(INT0); |
138 | |
139 // comparator disable | |
140 ACSR = _BV(ACD); | |
141 | |
142 // disable adc pin input buffers | |
143 DIDR0 = 0x3F; // acd0-adc5 | |
144 DIDR1 = (1<<AIN1D)|(1<<AIN0D); // ain0/ain1 | |
145 | |
146 sei(); | |
133 } | 147 } |
134 | 148 |
135 static void | 149 static void |
136 set_aux_power(uint8_t on) | 150 set_aux_power(uint8_t on) |
137 { | 151 { |