]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
Removed the use of the Boot interface in PlatformP/C and also made them compatible...
authorr-studio <r-studio>
Thu, 22 Apr 2010 07:18:22 +0000 (07:18 +0000)
committerr-studio <r-studio>
Thu, 22 Apr 2010 07:18:22 +0000 (07:18 +0000)
tos/platforms/mulle/PlatformC.nc
tos/platforms/mulle/PlatformP.nc

index c236b9ad3ae579bd0f550bc66ff9b4f1680bce67..11285d094f3a0c4dff2ec3e8c924ae67d9776bb3 100755 (executable)
@@ -57,16 +57,16 @@ implementation
     M16c62pControlC,
     new StopModeControlC();
 
-  Init = PlatformP;
+  Init = PlatformP.Init;
   SubInit = PlatformP.SubInit;
   PlatformP.M16c62pControl -> M16c62pControlC;
 
   PlatformP.StopModeControl -> StopModeControlC;
 
 #ifdef ENABLE_STOP_MODE
-  components RV8564C, DS2782InternalC, MainC;
-  PlatformP.Boot -> MainC;
-  PlatformP.RTC -> RV8564C;
+  components HplRV8564C, DS2782InternalC, RealMainP;
+  RealMainP.SoftwareInit -> PlatformP.StopModeInit;
+  PlatformP.RTC -> HplRV8564C;
   PlatformP.HplDS2782 -> DS2782InternalC;
   PlatformP.DS2782Control -> DS2782InternalC;
 #endif
index 47221400d718c071a052a58f702eb5ea2fb69163..67daed97e2802aa5379bc68085721867e47217d5 100755 (executable)
@@ -50,10 +50,11 @@ module PlatformP
   uses interface M16c62pControl;
   uses interface StopModeControl;
 #ifdef ENABLE_STOP_MODE
-  uses interface RV8564 as RTC;
+  provides interface Init as StopModeInit;
+  
+  uses interface HplRV8564 as RTC;
   uses interface HplDS2782;
   uses interface StdControl as DS2782Control;
-  uses interface Boot;
 #endif
 }
 
@@ -78,26 +79,34 @@ implementation
 
 
 #ifdef ENABLE_STOP_MODE
-  task void stopDS2782()
+  task void enableStopMode();
+  
+  command error_t StopModeInit.init()
   {
-    call DS2782Control.stop();
+       // The task is needed so we can be sure that all underlying components 
+    // have been initialized, for example the I2C resource.
+       post enableStopMode();
   }
-  // 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()
+  
+  task void enableStopMode()
   {
     call StopModeControl.allowStopMode(true);
-    // Activate the RTC and set it to output 1024 tics on the CLKOUT pin
+    // Allow the DS2782 to enter sleep
     call DS2782Control.start();
     call HplDS2782.allowSleep(true);
-    call RTC.on();
+    // Activate the RTC and set it to output 1024 tics on the CLKOUT pin
     call RTC.enableCLKOUT();
-    call RTC.writeRegister(RV8564_CLKF, 0x81);
+    call RTC.writeRegister(RV8564_CLKF, 0x81);  
+  }
+  
+  task void stopDS2782()
+  {
+    call DS2782Control.stop();
   }
 
   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 RTC.readRegisterDone(error_t error, uint8_t val, uint8_t reg) {}
+  async event void RTC.writeRegisterDone(error_t error, uint8_t reg) {}
 
   async event void HplDS2782.setConfigDone(error_t error) {return; }
   async event void HplDS2782.allowSleepDone( error_t error ) { post stopDS2782(); }