Dreamforce 2014 Workshop RFID Case Generator - FRDM-K64F

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

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

Files at this revision

API Documentation at this revision

Comitter:
ansond
Date:
Sun Sep 07 22:19:30 2014 +0000
Parent:
26:efa0655eec62
Child:
28:892a6668365f
Commit message:
changed main invocation to threaded for K64F

Changed in this revision

Definitions.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/Definitions.h	Fri Aug 29 21:39:40 2014 +0000
+++ b/Definitions.h	Sun Sep 07 22:19:30 2014 +0000
@@ -57,6 +57,11 @@
  #define _UBLOX_PLATFORM           false
  #define _K64F_PLATFORM            true
  
+ // K64F needs to launch the task in a thread with a large stack size...
+ #if _K64F_PLATFORM
+    #define STACK_SIZE 20000
+ #endif
+  
  // Wait Time for iterations (ms)
  #define WAIT_TIME_MS              500
  
--- 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