]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - tos/chips/atm128/McuSleepC.nc
Include I2C in sleep calculation, and base SPI off of SPE, not SPIE;
[tinyos-2.x.git] / tos / chips / atm128 / McuSleepC.nc
index 6418f739e869182a5d013d5a812a9db2b419ce29..badcfed01b1ccf739cdde9d3ce25380b057d6c6d 100644 (file)
@@ -74,14 +74,15 @@ implementation {
       return ATM128_POWER_IDLE;
     }
     // SPI (Radio stack on mica/micaZ
-    else if (bit_is_set(SPCR, SPIE)) { 
+    else if (bit_is_set(SPCR, SPE)) { 
       return ATM128_POWER_IDLE;
     }
-    // UARTs are active
-    else if (UCSR0B & (1 << TXCIE | 1 << RXCIE)) { // UART
+    // A UART is active
+    else if ((UCSR0B | UCSR1B) & (1 << TXCIE | 1 << RXCIE)) { // UART
       return ATM128_POWER_IDLE;
     }
-    else if (UCSR1B & (1 << TXCIE | 1 << RXCIE)) { // UART
+    // I2C (Two-wire) is active
+    else if (bit_is_set(TWCR, TWEN)){
       return ATM128_POWER_IDLE;
     }
     // ADC is enabled