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 cdms_rtos_sum by
main.cpp
00001 #include "mbed.h" 00002 #include "rtos.h" 00003 00004 Serial pc(USBTX, USBRX); 00005 00006 00007 Thread *ptr_hk_bae; 00008 Thread *ptr_hk_cdms; 00009 Thread *ptr_hk_payload; 00010 00011 InterruptIn data_ready1(PTC3); 00012 00013 00014 Timer t1; 00015 00016 00017 00018 void HK_BAE(void const *args) 00019 { 00020 while(1) 00021 { 00022 Thread::signal_wait(0x1); 00023 printf("Entered HK_BAE\n"); 00024 } 00025 } 00026 00027 void FUNC_INIT_HK_PAYLOAD() 00028 { 00029 00030 ptr_hk_payload -> signal_set(0x3); 00031 00032 } 00033 void HK_CDMS(void const *args) 00034 { 00035 while(1) 00036 { 00037 Thread::signal_wait(0x2); 00038 printf("Hi\n"); 00039 Thread::wait(5000); 00040 printf("Tamanna\n"); 00041 00042 } 00043 } 00044 void HK_PAYLOAD(void const *args) 00045 { 00046 while(1) 00047 { 00048 Thread::signal_wait(0x3); 00049 printf("Samanta\n"); 00050 } 00051 } 00052 00053 uint16_t schedcount=1; 00054 00055 void T_SC(void const *args) 00056 { 00057 00058 printf("The value of i in scheduler is %d\n",schedcount); 00059 if(schedcount == 65532) //to reset the counter 00060 { 00061 schedcount = 0; 00062 } 00063 00064 if(schedcount%20==0) 00065 { 00066 ptr_hk_bae -> signal_set(0x1); 00067 ptr_hk_cdms -> signal_set(0x2); 00068 00069 } 00070 schedcount++; 00071 } 00072 00073 00074 int main() 00075 { 00076 //ptr_hk_bae = new Thread (HK_BAE); 00077 data_ready1.rise(&FUNC_INIT_HK_PAYLOAD); 00078 00079 ptr_hk_cdms=new Thread (HK_CDMS); 00080 ptr_hk_payload=new Thread (HK_PAYLOAD); 00081 00082 // ptr_hk_bae->set_priority(osPriorityAboveNormal); 00083 ptr_hk_cdms->set_priority(osPriorityNormal); 00084 ptr_hk_payload->set_priority(osPriorityHigh); 00085 00086 //printf("\n T_HK_BAE priority is %d",ptr_hk_bae->get_priority()); 00087 printf("\n T_HK_CDMS priority is %d",ptr_hk_cdms->get_priority()); 00088 printf("\n T_HK_PAYLOAD priority is %d",ptr_hk_payload->get_priority()); 00089 00090 RtosTimer t_sc_timer(T_SC,osTimerPeriodic); 00091 t_sc_timer.start(1000); 00092 00093 00094 while(1) 00095 { 00096 Thread::wait(5000); 00097 } 00098 00099 00100 00101 } 00102 00103
Generated on Thu Jul 21 2022 20:26:28 by
1.7.2
