i2c working with old hk

Dependencies:   mbed-rtos mbed

Fork of BAE_vr2_1_1 by green rosh

Committer:
greenroshks
Date:
Tue Dec 16 07:44:54 2014 +0000
Revision:
10:ed6d3b8d1d56
Parent:
9:221d218f4690
Child:
12:ba2556c6b990
working

Who changed what in which revision?

UserRevisionLine numberNew contents of line
greenroshks 0:8b0d43fe6c05 1 #include "mbed.h"
greenroshks 0:8b0d43fe6c05 2 #include "rtos.h"
greenroshks 0:8b0d43fe6c05 3 #include "HK.h"
greenroshks 0:8b0d43fe6c05 4 #include "slave.h"
greenroshks 0:8b0d43fe6c05 5 #include "beacon.h"
greenroshks 0:8b0d43fe6c05 6 #include "ACS.h"
sakthipriya 2:80b8a2e999f7 7 #include "fault.h"
raizel_varun 9:221d218f4690 8 #include "slave.h"
greenroshks 0:8b0d43fe6c05 9
greenroshks 0:8b0d43fe6c05 10 Serial pc(USBTX, USBRX);
greenroshks 0:8b0d43fe6c05 11
raizel_varun 9:221d218f4690 12 InterruptIn interrupt(D9);
raizel_varun 9:221d218f4690 13 InterruptIn master_reset(D11);
greenroshks 0:8b0d43fe6c05 14
greenroshks 0:8b0d43fe6c05 15
sakthipriya 5:255b43e8e21a 16 Timer t; //To know the time of execution each thread
sakthipriya 4:8f6c24eca109 17 Timer t1;
sakthipriya 5:255b43e8e21a 18 //To know the time of entering of each thread
greenroshks 0:8b0d43fe6c05 19
greenroshks 0:8b0d43fe6c05 20 Thread *ptr_t_hk_acq;
greenroshks 0:8b0d43fe6c05 21 Thread *ptr_t_acs;
greenroshks 0:8b0d43fe6c05 22 Thread *ptr_t_acs_write2flash;
greenroshks 0:8b0d43fe6c05 23 Thread *ptr_t_bea;
greenroshks 0:8b0d43fe6c05 24 Thread *ptr_t_bea_telecommand;
greenroshks 0:8b0d43fe6c05 25 Thread *ptr_t_fault;
raizel_varun 9:221d218f4690 26 Thread *ptr_t_i2c;
greenroshks 0:8b0d43fe6c05 27
greenroshks 0:8b0d43fe6c05 28 //--------------------------------------------------------------------------------------------------------------------------------------------------
greenroshks 0:8b0d43fe6c05 29 //TASK 2 : HK
greenroshks 0:8b0d43fe6c05 30 //--------------------------------------------------------------------------------------------------------------------------------------------------
greenroshks 0:8b0d43fe6c05 31
greenroshks 0:8b0d43fe6c05 32
greenroshks 0:8b0d43fe6c05 33
greenroshks 0:8b0d43fe6c05 34 void t_hk_acq(void const *args)
greenroshks 0:8b0d43fe6c05 35 {
greenroshks 0:8b0d43fe6c05 36
greenroshks 0:8b0d43fe6c05 37 while(1)
greenroshks 0:8b0d43fe6c05 38 {
greenroshks 0:8b0d43fe6c05 39 Thread::signal_wait(0x2);
greenroshks 0:8b0d43fe6c05 40
greenroshks 0:8b0d43fe6c05 41 printf("\nTHIS IS HK %f\n",t1.read());
greenroshks 0:8b0d43fe6c05 42 t.start();
greenroshks 0:8b0d43fe6c05 43
greenroshks 0:8b0d43fe6c05 44 FUNC_HK_MAIN(); //Collecting HK data
greenroshks 0:8b0d43fe6c05 45 //thread_2.signal_set(0x4);
raizel_varun 9:221d218f4690 46 //FUNC_I2C_SLAVE_MAIN(24); //Sending to CDMS via I2C
greenroshks 0:8b0d43fe6c05 47
greenroshks 0:8b0d43fe6c05 48 t.stop();
greenroshks 0:8b0d43fe6c05 49 printf("The time to execute hk_acq is %f seconds\n",t.read());
greenroshks 0:8b0d43fe6c05 50 t.reset();
greenroshks 0:8b0d43fe6c05 51 }
greenroshks 0:8b0d43fe6c05 52 }
greenroshks 0:8b0d43fe6c05 53
greenroshks 0:8b0d43fe6c05 54 //---------------------------------------------------------------------------------------------------------------------------------------
greenroshks 0:8b0d43fe6c05 55 //TASK 1 : ACS
greenroshks 0:8b0d43fe6c05 56 //---------------------------------------------------------------------------------------------------------------------------------------
greenroshks 0:8b0d43fe6c05 57 typedef struct {
greenroshks 0:8b0d43fe6c05 58 float mag_field;
greenroshks 0:8b0d43fe6c05 59 float omega;
greenroshks 0:8b0d43fe6c05 60 } sensor_data;
greenroshks 0:8b0d43fe6c05 61
greenroshks 0:8b0d43fe6c05 62 Mail <sensor_data, 16> q_acs;
greenroshks 0:8b0d43fe6c05 63
greenroshks 0:8b0d43fe6c05 64 void func_acs_readdata(sensor_data *ptr)
greenroshks 0:8b0d43fe6c05 65 {
greenroshks 0:8b0d43fe6c05 66 printf("Reading the data\n");
greenroshks 0:8b0d43fe6c05 67 ptr -> mag_field = 10;
greenroshks 0:8b0d43fe6c05 68 ptr -> omega = 3;
greenroshks 0:8b0d43fe6c05 69 }
greenroshks 0:8b0d43fe6c05 70
greenroshks 0:8b0d43fe6c05 71 void func_acs_ctrlalgo()
greenroshks 0:8b0d43fe6c05 72 {
greenroshks 0:8b0d43fe6c05 73 printf("Executing control algo\n");
greenroshks 0:8b0d43fe6c05 74 }
greenroshks 0:8b0d43fe6c05 75
greenroshks 0:8b0d43fe6c05 76
greenroshks 0:8b0d43fe6c05 77
greenroshks 0:8b0d43fe6c05 78 void func_acs_write2flash(sensor_data *ptr2)
greenroshks 0:8b0d43fe6c05 79 {
greenroshks 0:8b0d43fe6c05 80 printf("The magnetic field is %.2f T\n\r",ptr2->mag_field);
greenroshks 0:8b0d43fe6c05 81 printf("The angular velocity is %.2f rad/s\n\r",ptr2->omega);
greenroshks 0:8b0d43fe6c05 82 }
greenroshks 0:8b0d43fe6c05 83
sakthipriya 5:255b43e8e21a 84 int acs_pflag = 1;
greenroshks 0:8b0d43fe6c05 85 void t_acs(void const *args)
greenroshks 0:8b0d43fe6c05 86 {
greenroshks 0:8b0d43fe6c05 87 while(1)
greenroshks 0:8b0d43fe6c05 88 {
greenroshks 0:8b0d43fe6c05 89 Thread::signal_wait(0x1);
greenroshks 0:8b0d43fe6c05 90 printf("\nTHIS IS ACS %f\n",t1.read());
greenroshks 0:8b0d43fe6c05 91 t.start();
greenroshks 0:8b0d43fe6c05 92 sensor_data *ptr = q_acs.alloc();
greenroshks 0:8b0d43fe6c05 93
greenroshks 0:8b0d43fe6c05 94 func_acs_readdata(ptr);
raizel_varun 7:f06840d848e3 95 //printf("\ngdhd\n");
greenroshks 0:8b0d43fe6c05 96 q_acs.put(ptr);
sakthipriya 5:255b43e8e21a 97 if(acs_pflag == 1)
sakthipriya 5:255b43e8e21a 98 {
greenroshks 0:8b0d43fe6c05 99 func_acs_ctrlalgo();
greenroshks 0:8b0d43fe6c05 100 FUNC_ACS_GENPWM(); //Generating PWM signal.
sakthipriya 5:255b43e8e21a 101 }
greenroshks 0:8b0d43fe6c05 102
greenroshks 0:8b0d43fe6c05 103 t.reset();
greenroshks 0:8b0d43fe6c05 104 }
greenroshks 0:8b0d43fe6c05 105 }
greenroshks 0:8b0d43fe6c05 106
greenroshks 0:8b0d43fe6c05 107 void t_acs_write2flash(void const *args)
greenroshks 0:8b0d43fe6c05 108 {
greenroshks 0:8b0d43fe6c05 109 while(1)
greenroshks 0:8b0d43fe6c05 110 {
greenroshks 0:8b0d43fe6c05 111 //printf("Writing in the flash\n");
greenroshks 0:8b0d43fe6c05 112 osEvent evt = q_acs.get();
greenroshks 0:8b0d43fe6c05 113 if(evt.status == osEventMail)
greenroshks 0:8b0d43fe6c05 114 {
greenroshks 0:8b0d43fe6c05 115 sensor_data *ptr = (sensor_data*)evt.value.p;
greenroshks 0:8b0d43fe6c05 116 func_acs_write2flash(ptr);
greenroshks 0:8b0d43fe6c05 117 q_acs.free(ptr);
greenroshks 0:8b0d43fe6c05 118 }
greenroshks 0:8b0d43fe6c05 119 printf("Writing acs data in the flash\n");
greenroshks 0:8b0d43fe6c05 120 }
greenroshks 0:8b0d43fe6c05 121 }
greenroshks 0:8b0d43fe6c05 122
greenroshks 0:8b0d43fe6c05 123
greenroshks 0:8b0d43fe6c05 124 //---------------------------------------------------BEACON--------------------------------------------------------------------------------------------
greenroshks 0:8b0d43fe6c05 125
greenroshks 0:8b0d43fe6c05 126 int beac_flag=0; //To receive telecommand from ground.
greenroshks 0:8b0d43fe6c05 127
greenroshks 0:8b0d43fe6c05 128
greenroshks 0:8b0d43fe6c05 129 void t_bea_telecommand(void const *args)
greenroshks 0:8b0d43fe6c05 130 {
greenroshks 0:8b0d43fe6c05 131 char c = pc.getc();
greenroshks 0:8b0d43fe6c05 132 if(c=='a')
greenroshks 0:8b0d43fe6c05 133 {
greenroshks 0:8b0d43fe6c05 134 printf("Telecommand detected\n");
greenroshks 0:8b0d43fe6c05 135 beac_flag=1;
greenroshks 0:8b0d43fe6c05 136 }
greenroshks 0:8b0d43fe6c05 137 }
greenroshks 0:8b0d43fe6c05 138
greenroshks 0:8b0d43fe6c05 139 void t_bea(void const *args)
greenroshks 0:8b0d43fe6c05 140 {
greenroshks 0:8b0d43fe6c05 141
greenroshks 0:8b0d43fe6c05 142 while(1)
greenroshks 0:8b0d43fe6c05 143 {
greenroshks 0:8b0d43fe6c05 144 Thread::signal_wait(0x3);
greenroshks 0:8b0d43fe6c05 145 printf("\nTHIS IS BEACON %f\n",t1.read());
greenroshks 0:8b0d43fe6c05 146 t.start();
greenroshks 0:8b0d43fe6c05 147
greenroshks 0:8b0d43fe6c05 148
greenroshks 0:8b0d43fe6c05 149
greenroshks 0:8b0d43fe6c05 150 FUNC_BEA();
greenroshks 0:8b0d43fe6c05 151
greenroshks 0:8b0d43fe6c05 152
greenroshks 0:8b0d43fe6c05 153 if(beac_flag==1)
greenroshks 0:8b0d43fe6c05 154 {
greenroshks 0:8b0d43fe6c05 155 Thread::wait(600000);
greenroshks 0:8b0d43fe6c05 156 beac_flag = 0;
greenroshks 0:8b0d43fe6c05 157 }
greenroshks 0:8b0d43fe6c05 158
greenroshks 0:8b0d43fe6c05 159 printf("The time to execute beacon thread is %f seconds\n",t.read());
greenroshks 0:8b0d43fe6c05 160 t.reset();
greenroshks 0:8b0d43fe6c05 161 }
greenroshks 0:8b0d43fe6c05 162 }
greenroshks 0:8b0d43fe6c05 163
greenroshks 0:8b0d43fe6c05 164 //---------------------------------------------------------------------------------------------------------------------------------------------------
greenroshks 0:8b0d43fe6c05 165 //TASK 4 : FAULT MANAGEMENT
greenroshks 0:8b0d43fe6c05 166 //---------------------------------------------------------------------------------------------------------------------------------------------------
greenroshks 0:8b0d43fe6c05 167 //Dummy fault rectifier functions
greenroshks 0:8b0d43fe6c05 168
sakthipriya 2:80b8a2e999f7 169 /*Mail<int,16> faults;
greenroshks 0:8b0d43fe6c05 170
greenroshks 0:8b0d43fe6c05 171 void FUNC_FAULT_FUNCT1()
greenroshks 0:8b0d43fe6c05 172 {
greenroshks 0:8b0d43fe6c05 173 printf("\nFault 1 detected... \n");
greenroshks 0:8b0d43fe6c05 174 }
greenroshks 0:8b0d43fe6c05 175
greenroshks 0:8b0d43fe6c05 176 void FUNC_FAULT_FUNCT2()
greenroshks 0:8b0d43fe6c05 177 {
greenroshks 0:8b0d43fe6c05 178 printf("\nFault 2 detected...\n");
greenroshks 0:8b0d43fe6c05 179 }
greenroshks 0:8b0d43fe6c05 180
greenroshks 0:8b0d43fe6c05 181 void T_FAULT(void const *args)
greenroshks 0:8b0d43fe6c05 182 {
greenroshks 0:8b0d43fe6c05 183 while(1)
greenroshks 0:8b0d43fe6c05 184 {
greenroshks 0:8b0d43fe6c05 185 osEvent evt = faults.get();
greenroshks 0:8b0d43fe6c05 186 if(evt.status==osEventMail)
greenroshks 0:8b0d43fe6c05 187 {
greenroshks 0:8b0d43fe6c05 188 int *fault_id= (int *)evt.value.p;
greenroshks 0:8b0d43fe6c05 189 switch(*fault_id)
greenroshks 0:8b0d43fe6c05 190 {
greenroshks 0:8b0d43fe6c05 191 case 1: FUNC_FAULT_FUNCT1();
greenroshks 0:8b0d43fe6c05 192 break;
greenroshks 0:8b0d43fe6c05 193 case 2: FUNC_FAULT_FUNCT2();
greenroshks 0:8b0d43fe6c05 194 break;
greenroshks 0:8b0d43fe6c05 195 }
greenroshks 0:8b0d43fe6c05 196 faults.free(fault_id);
greenroshks 0:8b0d43fe6c05 197 }
greenroshks 0:8b0d43fe6c05 198 }
sakthipriya 2:80b8a2e999f7 199 }*/
sakthipriya 5:255b43e8e21a 200
sakthipriya 5:255b43e8e21a 201 extern SensorData Sensor;
raizel_varun 6:e65b1ab79f36 202
raizel_varun 6:e65b1ab79f36 203
sakthipriya 2:80b8a2e999f7 204 void T_FAULT(void const *args)
sakthipriya 4:8f6c24eca109 205 {
sakthipriya 5:255b43e8e21a 206 Sensor.power_mode='0';
sakthipriya 2:80b8a2e999f7 207 while(1)
sakthipriya 2:80b8a2e999f7 208 {
sakthipriya 2:80b8a2e999f7 209 Thread :: signal_wait(0x2);
sakthipriya 2:80b8a2e999f7 210 FAULTS();
sakthipriya 5:255b43e8e21a 211 POWER(Sensor.power_mode);
sakthipriya 5:255b43e8e21a 212 //Sensor.power_mode++; //testing ... should be removed
sakthipriya 2:80b8a2e999f7 213 }
greenroshks 0:8b0d43fe6c05 214 }
greenroshks 0:8b0d43fe6c05 215
raizel_varun 9:221d218f4690 216 //---------------------------------------------------------------------------------------------------------------------------------------------------
raizel_varun 9:221d218f4690 217 //TASK 5 : i2c data
raizel_varun 9:221d218f4690 218 //---------------------------------------------------------------------------------------------------------------------------------------------------
raizel_varun 9:221d218f4690 219
raizel_varun 9:221d218f4690 220
raizel_varun 9:221d218f4690 221 void C_FUNC_INT()
raizel_varun 9:221d218f4690 222 {
raizel_varun 9:221d218f4690 223 FUNC_INT();
raizel_varun 9:221d218f4690 224 ptr_t_i2c->signal_set(0x4);
raizel_varun 9:221d218f4690 225
raizel_varun 9:221d218f4690 226 }
raizel_varun 9:221d218f4690 227
raizel_varun 9:221d218f4690 228 void C_FUNC_RESET()
raizel_varun 9:221d218f4690 229 {
raizel_varun 9:221d218f4690 230 FUNC_RESET();
raizel_varun 9:221d218f4690 231 }
raizel_varun 9:221d218f4690 232
raizel_varun 9:221d218f4690 233
raizel_varun 9:221d218f4690 234 void C_T_I2C_BAE(void const * args)
raizel_varun 9:221d218f4690 235 {
raizel_varun 9:221d218f4690 236 //char data_send,data_receive;
raizel_varun 9:221d218f4690 237 while(1)
raizel_varun 9:221d218f4690 238 {
raizel_varun 9:221d218f4690 239 Thread::signal_wait(0x4);
raizel_varun 9:221d218f4690 240 T_I2C_BAE();
raizel_varun 9:221d218f4690 241 //i2c_status = temp;
raizel_varun 9:221d218f4690 242 //wait(0.5);
raizel_varun 9:221d218f4690 243 /*printf("\n entered thread\n\r");
raizel_varun 9:221d218f4690 244 if(i2c_status == 0 && reset !=1)
raizel_varun 9:221d218f4690 245 {
raizel_varun 9:221d218f4690 246
raizel_varun 9:221d218f4690 247 FUNC_I2C_WRITE2CDMS(&data_receive);
raizel_varun 9:221d218f4690 248 i2c_data * i2c_data_r = i2c_data_receive.alloc();
raizel_varun 9:221d218f4690 249 i2c_data_r->data = data_receive;
raizel_varun 9:221d218f4690 250 i2c_data_r->length = 1;
raizel_varun 9:221d218f4690 251 i2c_data_receive.put(i2c_data_r);
raizel_varun 9:221d218f4690 252 printf("\n Data received from CDMS is %c\n\r",data_receive);
raizel_varun 9:221d218f4690 253 i2c_data_receive.free(i2c_data_r); // This has to be done from a differen thread
raizel_varun 9:221d218f4690 254
raizel_varun 9:221d218f4690 255 }
raizel_varun 9:221d218f4690 256 else if(i2c_status ==1 && reset !=1)
raizel_varun 9:221d218f4690 257 {
raizel_varun 9:221d218f4690 258 osEvent evt = i2c_data_send.get();
raizel_varun 9:221d218f4690 259 if (evt.status == osEventMail)
raizel_varun 9:221d218f4690 260 {
raizel_varun 9:221d218f4690 261 i2c_data *i2c_data_s = (i2c_data*)evt.value.p;
raizel_varun 9:221d218f4690 262 data_send = i2c_data_s -> data;
raizel_varun 9:221d218f4690 263 FUNC_I2C_WRITE2CDMS(&data_send);
raizel_varun 9:221d218f4690 264 printf("\nData sent to CDMS is %c\n\r",data_send);
raizel_varun 9:221d218f4690 265 i2c_data_send.free(i2c_data_s);
raizel_varun 9:221d218f4690 266 i2c_status = 0;
raizel_varun 9:221d218f4690 267 //temp = i2c_status;
raizel_varun 9:221d218f4690 268 }
raizel_varun 9:221d218f4690 269 }
raizel_varun 9:221d218f4690 270 */
raizel_varun 9:221d218f4690 271 }
raizel_varun 9:221d218f4690 272 }
raizel_varun 9:221d218f4690 273
raizel_varun 9:221d218f4690 274
raizel_varun 9:221d218f4690 275
raizel_varun 9:221d218f4690 276
raizel_varun 9:221d218f4690 277
raizel_varun 9:221d218f4690 278
greenroshks 0:8b0d43fe6c05 279 //------------------------------------------------------------------------------------------------------------------------------------------------
greenroshks 0:8b0d43fe6c05 280 //SCHEDULER
greenroshks 0:8b0d43fe6c05 281 //------------------------------------------------------------------------------------------------------------------------------------------------
sakthipriya 4:8f6c24eca109 282 int beacon_sc = 3;
greenroshks 0:8b0d43fe6c05 283 uint16_t schedcount=1;
greenroshks 0:8b0d43fe6c05 284 void t_sc(void const *args)
greenroshks 0:8b0d43fe6c05 285 {
greenroshks 0:8b0d43fe6c05 286
greenroshks 0:8b0d43fe6c05 287 printf("The value of i in scheduler is %d\n",schedcount);
greenroshks 0:8b0d43fe6c05 288 if(schedcount == 65532) //to reset the counter
greenroshks 0:8b0d43fe6c05 289 {
greenroshks 0:8b0d43fe6c05 290 schedcount = 0;
greenroshks 0:8b0d43fe6c05 291 }
greenroshks 0:8b0d43fe6c05 292
greenroshks 0:8b0d43fe6c05 293 if(schedcount%1==0)
greenroshks 0:8b0d43fe6c05 294 {
greenroshks 0:8b0d43fe6c05 295 ptr_t_acs -> signal_set(0x1);
greenroshks 0:8b0d43fe6c05 296 }
greenroshks 0:8b0d43fe6c05 297 if(schedcount%2==0)
greenroshks 0:8b0d43fe6c05 298 {
sakthipriya 3:02b45de29c0f 299 ptr_t_fault -> signal_set(0x2);
greenroshks 0:8b0d43fe6c05 300 ptr_t_hk_acq -> signal_set(0x2);
sakthipriya 2:80b8a2e999f7 301
greenroshks 0:8b0d43fe6c05 302 }
sakthipriya 4:8f6c24eca109 303 if(schedcount%beacon_sc==0)
greenroshks 0:8b0d43fe6c05 304 {
greenroshks 0:8b0d43fe6c05 305 if(beac_flag==0)
greenroshks 0:8b0d43fe6c05 306 {
greenroshks 0:8b0d43fe6c05 307
greenroshks 0:8b0d43fe6c05 308 ptr_t_bea -> signal_set(0x3);
greenroshks 0:8b0d43fe6c05 309 }
greenroshks 0:8b0d43fe6c05 310 }
greenroshks 0:8b0d43fe6c05 311 schedcount++;
greenroshks 0:8b0d43fe6c05 312 }
greenroshks 0:8b0d43fe6c05 313
greenroshks 0:8b0d43fe6c05 314 //---------------------------------------------------------------------------------------------------------------------------------------------
greenroshks 0:8b0d43fe6c05 315
greenroshks 0:8b0d43fe6c05 316 int main()
greenroshks 0:8b0d43fe6c05 317 {
greenroshks 0:8b0d43fe6c05 318 t1.start();
greenroshks 0:8b0d43fe6c05 319
greenroshks 0:8b0d43fe6c05 320 ptr_t_hk_acq = new Thread(t_hk_acq);
greenroshks 0:8b0d43fe6c05 321 ptr_t_acs = new Thread(t_acs);
greenroshks 0:8b0d43fe6c05 322 ptr_t_acs_write2flash = new Thread(t_acs_write2flash);
greenroshks 0:8b0d43fe6c05 323 ptr_t_bea = new Thread(t_bea);
greenroshks 0:8b0d43fe6c05 324 ptr_t_bea_telecommand = new Thread(t_bea_telecommand);
greenroshks 0:8b0d43fe6c05 325 ptr_t_fault = new Thread(T_FAULT);
raizel_varun 9:221d218f4690 326 ptr_t_i2c = new Thread(C_T_I2C_BAE);
greenroshks 0:8b0d43fe6c05 327 //ptr_t_sc = new Thread(t_sc);
raizel_varun 8:69475d16d23d 328
raizel_varun 8:69475d16d23d 329 interrupt_fault();
raizel_varun 8:69475d16d23d 330
greenroshks 0:8b0d43fe6c05 331 ptr_t_fault -> set_priority(osPriorityRealtime);
greenroshks 0:8b0d43fe6c05 332 ptr_t_acs->set_priority(osPriorityHigh);
raizel_varun 9:221d218f4690 333 ptr_t_i2c->set_priority(osPriorityAboveNormal);
greenroshks 0:8b0d43fe6c05 334 ptr_t_hk_acq->set_priority(osPriorityNormal);
greenroshks 0:8b0d43fe6c05 335 ptr_t_acs_write2flash->set_priority(osPriorityBelowNormal);
greenroshks 0:8b0d43fe6c05 336 ptr_t_bea->set_priority(osPriorityAboveNormal);
greenroshks 0:8b0d43fe6c05 337 ptr_t_bea_telecommand->set_priority(osPriorityIdle);
greenroshks 0:8b0d43fe6c05 338 //ptr_t_sc->set_priority(osPriorityAboveNormal);
greenroshks 0:8b0d43fe6c05 339
greenroshks 0:8b0d43fe6c05 340
greenroshks 0:8b0d43fe6c05 341 // ----------------------------------------------------------------------------------------------
greenroshks 0:8b0d43fe6c05 342 printf("\n T_FAULT priority is %d",ptr_t_fault->get_priority());
greenroshks 0:8b0d43fe6c05 343 printf("\n T_ACS priority is %d",ptr_t_acs->get_priority());
greenroshks 0:8b0d43fe6c05 344 printf("\n T_HK_ACQ priority is %d",ptr_t_hk_acq->get_priority());
greenroshks 0:8b0d43fe6c05 345 printf("\n T_ACS_WRITE2FLASH priority is %d",ptr_t_acs_write2flash->get_priority());
greenroshks 0:8b0d43fe6c05 346 printf("\n T_BEA priority is %d",ptr_t_bea->get_priority());
greenroshks 0:8b0d43fe6c05 347 RtosTimer t_sc_timer(t_sc,osTimerPeriodic);
greenroshks 0:8b0d43fe6c05 348 t_sc_timer.start(10000);
greenroshks 0:8b0d43fe6c05 349 printf("\n%f\n",t1.read());
raizel_varun 9:221d218f4690 350
raizel_varun 9:221d218f4690 351
raizel_varun 9:221d218f4690 352
raizel_varun 9:221d218f4690 353 master_reset.fall(&C_FUNC_RESET);
raizel_varun 9:221d218f4690 354 interrupt.rise(&C_FUNC_INT);
raizel_varun 9:221d218f4690 355
greenroshks 0:8b0d43fe6c05 356 while(1)
raizel_varun 7:f06840d848e3 357 {
raizel_varun 9:221d218f4690 358 //Thread::wait(10000);
raizel_varun 9:221d218f4690 359 ir2master();
greenroshks 10:ed6d3b8d1d56 360 Thread::wait(5000);
greenroshks 0:8b0d43fe6c05 361 }
greenroshks 0:8b0d43fe6c05 362
greenroshks 0:8b0d43fe6c05 363 }