beacon_test

Dependencies:   mbed-rtos mbed

Files at this revision

API Documentation at this revision

Comitter:
gkumar
Date:
Mon May 18 07:06:12 2015 +0000
Commit message:
beacon_test

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-rtos.lib Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 01033178af60 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon May 18 07:06:12 2015 +0000
@@ -0,0 +1,44 @@
+#include "mbed.h"
+#include "rtos.h"
+Serial pc(USBTX, USBRX);
+
+int beacon_sc = 3;
+uint16_t schedcount=1;
+int beac_flag=0;
+InterruptIn sw1(PTC3);
+Timeout bea_timeout ;
+void T_SC(void const *args)
+{
+    if(beac_flag==1){
+         printf("\n\rThe value of i in scheduler is %d\n",schedcount); }
+     schedcount++;
+    
+    }
+    
+void FUNC_BEA_TIMEOUT()
+{
+  
+  beac_flag = 0;
+  
+}
+
+void sw(){
+    beac_flag = 1;
+    bea_timeout.attach(&FUNC_BEA_TIMEOUT,35.0 );}
+    
+void sw2(){
+
+    beac_flag = 0;
+   }
+    
+
+int main(void) {
+RtosTimer t_sc_timer(T_SC,osTimerPeriodic);
+t_sc_timer.start(1000);
+sw1.rise(&sw);
+sw1.fall(&sw2);
+while(1)                                                   //required to prevent main from terminating
+    {   
+        Thread::wait(10000);                        // this wait doesn't matter main is a thread of lowest priority 
+       }
+}
\ No newline at end of file
diff -r 000000000000 -r 01033178af60 mbed-rtos.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-rtos.lib	Mon May 18 07:06:12 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed-rtos/#13a25134ac60
diff -r 000000000000 -r 01033178af60 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon May 18 07:06:12 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/dbbf35b96557
\ No newline at end of file