]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - tos/platforms/mulle/PlatformP.nc
mulle platfor modification, flsh storage, more lowpower, softi2c improvements
[tinyos-2.x.git] / tos / platforms / mulle / PlatformP.nc
index 733d112f452dfd66688a9972f2f37b5e11e00f08..47221400d718c071a052a58f702eb5ea2fb69163 100755 (executable)
@@ -51,6 +51,9 @@ module PlatformP
   uses interface StopModeControl;
 #ifdef ENABLE_STOP_MODE
   uses interface RV8564 as RTC;
+  uses interface HplDS2782;
+  uses interface StdControl as DS2782Control;
+  uses interface Boot;
 #endif
 }
 
@@ -59,17 +62,11 @@ implementation
   command error_t Init.init()
   {
     error_t ok = SUCCESS;
-    
+
     ok = call M16c62pControl.init();
-#ifdef ENABLE_STOP_MODE
-    call StopModeControl.allowStopMode(true);
-    // Activate the RTC and set it to output 1024 tics on the CLKOUT pin.
-    call RTC.on();
-    call RTC.enableCLKOUT();
-    call RTC.writeRegister(RV8564_CLKF, 0x81);
-#else
+
     call StopModeControl.allowStopMode(false);
-#endif
+
     // Init the M16c/62p to run at 10MHz.
     ok = ecombine (ok, call M16c62pControl.defaultSystemClock(MCU_SPEED_10MHz));
 
@@ -78,9 +75,37 @@ implementation
 
     return SUCCESS;
   }
+
+
 #ifdef ENABLE_STOP_MODE
+  task void stopDS2782()
+  {
+    call DS2782Control.stop();
+  }
+  // The Boot event is needed so we can be sure that all underlying components 
+  // have been initialized, for example the I2C resource.
+  event void Boot.booted()
+  {
+    call StopModeControl.allowStopMode(true);
+    // Activate the RTC and set it to output 1024 tics on the CLKOUT pin
+    call DS2782Control.start();
+    call HplDS2782.allowSleep(true);
+    call RTC.on();
+    call RTC.enableCLKOUT();
+    call RTC.writeRegister(RV8564_CLKF, 0x81);
+  }
+
   async event void RTC.fired() {}
   async event void RTC.readRegisterDone(uint8_t val, uint8_t reg) {}
   async event void RTC.writeRegisterDone(uint8_t reg) {}
+
+  async event void HplDS2782.setConfigDone(error_t error) {return; }
+  async event void HplDS2782.allowSleepDone( error_t error ) { post stopDS2782(); }
+  async event void HplDS2782.measureTemperatureDone( error_t error, uint16_t val ){ return; }
+  async event void HplDS2782.measureVoltageDone( error_t error, uint16_t val ){ return; }
+  async event void HplDS2782.measureCurrentDone( error_t error, uint16_t val ){ return; }
+  async event void HplDS2782.measureAccCurrentDone( error_t error, uint16_t val ){ return; }
+  async event void HplDS2782.setOffsetBiasDone( error_t error ){ return; }
+  async event void HplDS2782.setAccOffsetBiasDone(error_t error){ return; }
 #endif
 }