Patched version of the PowerControl library that handles (re)starting clocks such that (ETH) power can be brought up and down repeatedly without stalling the mbed.

Dependents:   AutonomousDAQ AutonomousDAQ

Files at this revision

API Documentation at this revision

Comitter:
uci1
Date:
Sat Oct 05 04:31:08 2013 +0000
Parent:
3:4ab735b9a69f
Commit message:
allow optional use of the rtos wait

Changed in this revision

EthernetPowerControl.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/EthernetPowerControl.cpp	Thu Sep 05 22:35:11 2013 +0000
+++ b/EthernetPowerControl.cpp	Sat Oct 05 04:31:08 2013 +0000
@@ -1,5 +1,7 @@
 #include "EthernetPowerControl.h"
 
+//#define USE_RTOS
+
 void write_PHY (unsigned int PhyReg, unsigned short Value) {
    /* Write a data 'Value' to PHY register 'PhyReg'. */
    unsigned int tout;
@@ -119,7 +121,11 @@
     LPC_GPIO1->FIOSET = 0x8000000;
     
     //wait for osc to be stable
+#ifdef USE_RTOS
+    Thread::wait(200);
+#else
     wait_ms(200);
+#endif
 
     if (!Peripheral_GetStatus(LPC1768_PCONP_PCENET))
         EMAC_Init(); //init EMAC if it is not already init'd