Thread UART

Dependencies:   fsl_phy_mcr20a fsl_smac mbed-rtos mbed

Fork of mcr20_wireless_uart by samuel belete

Revision:
24:088286081619
Parent:
23:6f13fea3cace
Child:
25:f40bc034cd8b
diff -r 6f13fea3cace -r 088286081619 main.cpp
--- a/main.cpp	Sat Apr 25 00:50:20 2015 -0500
+++ b/main.cpp	Sat Apr 25 01:10:45 2015 -0500
@@ -69,6 +69,7 @@
             MLMERXEnableRequest(gAppRxPacket, 0); 
 
             //printf("McpsDataCnf: Packet sent\r\n");
+            //fflush(stdout);
         }
         
         if(gMcps_Ind_EVENT_c == (gTaskEventFlags & gMcps_Ind_EVENT_c))
@@ -81,21 +82,25 @@
             MLMERXEnableRequest(gAppRxPacket, 0);
 
             printf("McpsDataInd: Received %d\r\n", rcvd);
+            fflush(stdout);
         }
         
         if(gMlme_TimeoutInd_EVENT_c == (gTaskEventFlags & gMlme_TimeoutInd_EVENT_c))
         {
-            //printf("MlmeTimeoutInd: \r\n");
+            printf("MlmeTimeoutInd: \r\n");
+            fflush(stdout);
         }
         
         if(gMlme_EdCnf_EVENT_c == (gTaskEventFlags & gMlme_EdCnf_EVENT_c))
         {
-            //printf("EdCnf: \r\n");
+            printf("EdCnf: \r\n");
+            fflush(stdout);
         }
         
         if(gMlme_CcaCnf_EVENT_c == (gTaskEventFlags & gMlme_CcaCnf_EVENT_c))
         {
-            //printf("CcaCnf: \r\n");
+            printf("CcaCnf: \r\n");
+            fflush(stdout);
         }
         
         if(gWUSelf_EVENT_c == (gTaskEventFlags & gWUSelf_EVENT_c))
@@ -125,10 +130,12 @@
     sw2.fall(&sw2_press);
     while (true) {
         Thread::wait(5000);
+        
         gAppTxPacket->smacPdu.smacPdu[0] = (uint8_t)button_pressed;
         gAppTxPacket->u8DataLength = 1;
         (void)MLMERXDisableRequest();
         (void)MCPSDataRequest(gAppTxPacket);
+        
         printf("SW2 was pressed (last 5 seconds): %d \r\n", button_pressed);
         fflush(stdout);
         button_pressed = 0;