Pradeep Kotipalli
/
cdms_rtos_summer
hjnjnj
main.cpp
- Committer:
- pradeepvk2208
- Date:
- 2015-06-08
- Revision:
- 0:0e52cd8d26c8
File content as of revision 0:0e52cd8d26c8:
#include "mbed.h" #include "rtos.h" Serial pc(USBTX, USBRX); Thread *ptr_hk_bae; Thread *ptr_hk_cdms; Thread *ptr_hk_payload; Timer t1; void HK_BAE(void const *args) { while(1) { Thread::signal_wait(0x1); printf("Entered HK_BAE"); } } void HK_CDMS(void const *args) { while(1) { Thread::signal_wait(0x2); printf("Entered HK_CDMS"); } } void HK_PAYLOAD(void const *args) { while(1) { Thread::signal_wait(0x3); printf("Entered HK_PAYLOAD"); } } uint16_t schedcount=1; void T_SC(void const *args) { printf("The value of i in scheduler is %d\n",schedcount); if(schedcount == 65532) //to reset the counter { schedcount = 0; } if(schedcount%20==0) { ptr_hk_bae -> signal_set(0x1); ptr_hk_cdms -> signal_set(0x2); ptr_hk_payload -> signal_set(0x3); } schedcount++; } int main() { ptr_hk_bae = new Thread (HK_BAE); ptr_hk_cdms=new Thread (HK_CDMS); ptr_hk_payload=new Thread (HK_PAYLOAD); ptr_hk_bae->set_priority(osPriorityAboveNormal); ptr_hk_cdms->set_priority(osPriorityHigh); ptr_hk_payload->set_priority(osPriorityNormal); printf("\n T_HK_BAE priority is %d",ptr_hk_bae->get_priority()); printf("\n T_HK_CDMS priority is %d",ptr_hk_cdms->get_priority()); printf("\n T_HK_PAYLOAD priority is %d",ptr_hk_payload->get_priority()); RtosTimer t_sc_timer(T_SC,osTimerPeriodic); t_sc_timer.start(1000); while(1) { Thread::wait(5000); } }