Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of rtos_basic by
Diff: main.cpp
- Revision:
- 7:80c659d94cdd
- Parent:
- 3:c92e21f305d8
- Child:
- 8:cfc8daeddc29
diff -r 209f4db62daf -r 80c659d94cdd main.cpp
--- a/main.cpp Tue Jun 04 16:01:32 2013 +0100
+++ b/main.cpp Mon Oct 26 17:45:59 2015 +0000
@@ -3,19 +3,110 @@
DigitalOut led1(LED1);
DigitalOut led2(LED2);
+InterruptIn button(PTC12);
+
+Thread *ptr_thread ;
+Thread *ptr_priya ;
+Thread *ptr_t_acs;
+Thread *ptr_t_bea;
+Thread *ptr_t_i2c;
+Thread *ptr_t_wdt;
+
+Timer t ;
+Timer P,pia ;
+Serial pc(USBTX, USBRX); // tx, rx --> serial feedback for debug
+
+void flip(void);
+void T_BAE(void const *args);
+void T_ACS(void const *args);
-void led2_thread(void const *args) {
+ //Thread thread1(led3_thread);
+
+ //Thread thread(led2_thread);
+ // Thread Priya(led3_thread);
+
+
+void T_BAE(void const *args) {
while (true) {
- led2 = !led2;
- Thread::wait(1000);
+ Thread::signal_wait(0x2);
+ pia.stop();
+ led1 = !led1;
+ //Thread::wait(1000);
+
}
}
+
+
+
+
+
+
int main() {
- Thread thread(led2_thread);
+ ptr_t_acs = new Thread(T_ACS);
+ ptr_t_bea = new Thread(T_BAE);
+ ptr_t_bea->set_priority(osPriorityHigh);
+ ptr_t_acs->set_priority(osPriorityAboveNormal);
+ ptr_t_acs -> signal_set(0x1);
+ button.rise(&flip);
while (true) {
- led1 = !led1;
- Thread::wait(500);
+
+ P.start();
+ wait_us(1000);
+ led2 = !led2;
+ P.stop();
+
+
+ t.start();
+ wait_us(500);
+ t.stop();
+ //pia.start();
+ //ptr_t_bea -> signal_set(0x2);
+
+ //thread.signal_set(0x1);
+ //Priya.set_priority(osPriorityAboveNormal);
+ pc.printf("Time Taken : %d \n\r",t.read_us());
+ pc.printf("Time Taken2 : %d \n\r",P.read_us());
+ pc.printf("Time Taken3 : %d \n\r",pia.read_us());
+
+ wait (5);
+
+ //time = t.read();
+ t.reset();
+ P.reset();
+ //pia.reset();
+
+
+ pc.printf("Time Taken(reset) : %d \n\r",t.read_us());
+ pc.printf("Time Taken2(reset) : %d \n\r",P.read_us());
+
+
+
+
+
+
}
}
+
+void flip(void) {
+
+ //Thread Priya(led3_thread);
+ pia.reset();
+ pia.start();
+ ptr_t_bea -> signal_set(0x2);
+ //led2 = !led2;
+}
+
+void T_ACS (void const *args) {
+ while (true) {
+
+ Thread::signal_wait(0x1);
+
+
+ led2 = !led2;
+ //Thread::wait(1000);
+
+
+ }
+}
\ No newline at end of file
