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

Revision:
4:e5a50000fcfb
Parent:
2:143913e0e922
--- 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