MBED_DEMOS / Mbed 2 deprecated df-2014-rfid-case-gen-k64f-exercise

Dependencies:   BufferedSerial C12832 EndpointMain-rfid EthernetInterface Logger StatusReporter-df2014 mbed-rtos mbed

Fork of df-2014-workshop-rfid-case-generator-k64f by Doug Anson

Revision:
27:9bb430dd6c07
Parent:
25:89a505a8e61c
Child:
28:892a6668365f
diff -r efa0655eec62 -r 9bb430dd6c07 main.cpp
--- a/main.cpp	Fri Aug 29 21:39:40 2014 +0000
+++ b/main.cpp	Sun Sep 07 22:19:30 2014 +0000
@@ -44,8 +44,21 @@
  // HARD RESET
 extern "C" void HardFault_Handler() { NVIC_SystemReset(); }
 
- // Main Entry...
- int main() {
+// WEAK Function for debugging
+extern "C" void mbed_mac_address(char * mac) {
+    mac[0] = 0x44;
+    mac[1] = 0x45;
+    mac[2] = 0x56;
+    mac[3] = 0x67;
+    mac[4] = 0x78;
+    mac[5] = 0x89;
+    pc.printf("MAC " );
+    for(int i=0;i<6;++i) pc.printf(":%.2x",mac[i]);
+    pc.printf("\r\n");
+}
+
+ // Main Task...
+ void mainTask(void const *v) {
     // create our object instances 
 #if _NXP_PLATFORM || _UBLOX_PLATFORM
     ErrorHandler logger(&pc,&lcd);
@@ -100,4 +113,14 @@
      logger.log("Exiting...");
      logger.turnLEDBlue();
      exit(1);
+  }
+  
+  // main entry
+  int main() {
+  #if _K64F_PLATFORM
+    Thread workerTask(mainTask, NULL, osPriorityNormal, STACK_SIZE);
+    while (true) Thread::wait(10*WAIT_TIME_MS);
+  #else
+    mainTask(NULL);
+  #endif
   }
\ No newline at end of file