diff main.c @ 52:c3f5e02c1c42

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 9ccd965d938a
children 0d3d14af55c2
line wrap: on
line diff
--- a/main.c	Sun Jun 24 10:38:07 2012 +0800
+++ b/main.c	Sun Jun 24 14:18:35 2012 +0800
@@ -120,7 +120,11 @@
     CLKPR = _BV(CLKPCE);
     // divide by 4
     CLKPR = _BV(CLKPS1);
-    sei();
+
+    // enable pullups
+    PORTB = 0xff; // XXX change when using SPI
+    PORTD = 0xff;
+    PORTC = 0xff;
 
     // 3.3v power for bluetooth and SD
     DDR_LED |= _BV(PIN_LED);
@@ -129,7 +133,17 @@
     // set pullup
     PORTD |= _BV(PD2);
     // INT0 setup
+    EICRA = (1<<ISC01); // falling edge - data sheet says it won't work?
     EIMSK = _BV(INT0);
+
+    // comparator disable
+    ACSR = _BV(ACD);
+
+    // disable adc pin input buffers
+    DIDR0 = 0x3F; // acd0-adc5
+    DIDR1 = (1<<AIN1D)|(1<<AIN0D); // ain0/ain1
+
+    sei();
 }
 
 static void