![](/media/cache/group/nine_tails_kurama_by_zubair43-d4zyf5s.jpg.50x50_q85.jpg)
PWM and ALGO updated.. PWM getting generated
Dependencies: FreescaleIAP mbed-rtos mbed
Fork of TFR_BAE_vr1_1working_finally_PWM_update by
main.cpp@8:24f73f54e44a, 2016-03-06 (annotated)
- Committer:
- Bragadeesh153
- Date:
- Sun Mar 06 12:41:03 2016 +0000
- Revision:
- 8:24f73f54e44a
- Parent:
- 7:a46a1dee4497
- Child:
- 9:c74c43a77ae9
FOR TESTING, INTERRUPTS DISABLED
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sakthipriya | 0:7b4c00e3912f | 1 | #include "mbed.h" |
sakthipriya | 0:7b4c00e3912f | 2 | #include "rtos.h" |
sakthipriya | 0:7b4c00e3912f | 3 | #include "pin_config.h" |
sakthipriya | 0:7b4c00e3912f | 4 | #include "ACS.h" |
sakthipriya | 0:7b4c00e3912f | 5 | #include "EPS.h" |
sakthipriya | 0:7b4c00e3912f | 6 | #include "BCN.h" |
sakthipriya | 0:7b4c00e3912f | 7 | #include "TCTM.h" |
sakthipriya | 0:7b4c00e3912f | 8 | |
sakthipriya | 0:7b4c00e3912f | 9 | #define tm_len 134 |
sakthipriya | 0:7b4c00e3912f | 10 | #define tc_len 135 |
sakthipriya | 0:7b4c00e3912f | 11 | #define batt_heat_low 20 |
sakthipriya | 0:7b4c00e3912f | 12 | //***************************************************** flags *************************************************************// |
sakthipriya | 0:7b4c00e3912f | 13 | uint32_t BAE_STATUS = 0x00000000; |
sakthipriya | 0:7b4c00e3912f | 14 | uint32_t BAE_ENABLE = 0xFFFFFFFF; |
sakthipriya | 0:7b4c00e3912f | 15 | |
sakthipriya | 5:bb592f3185cc | 16 | //i2c// |
sakthipriya | 5:bb592f3185cc | 17 | char data_send_flag = 'h'; |
sakthipriya | 5:bb592f3185cc | 18 | |
sakthipriya | 0:7b4c00e3912f | 19 | //.........acs...............// |
sakthipriya | 0:7b4c00e3912f | 20 | char ACS_INIT_STATUS = 'q'; |
sakthipriya | 0:7b4c00e3912f | 21 | char ACS_DATA_ACQ_STATUS = 'q'; |
sakthipriya | 0:7b4c00e3912f | 22 | char ACS_ATS_STATUS = 'q'; |
sakthipriya | 0:7b4c00e3912f | 23 | char ACS_MAIN_STATUS = 'q'; |
sakthipriya | 0:7b4c00e3912f | 24 | char ACS_STATUS = 'q'; |
sakthipriya | 0:7b4c00e3912f | 25 | |
sakthipriya | 0:7b4c00e3912f | 26 | char ACS_ATS_ENABLE = 'q'; |
sakthipriya | 0:7b4c00e3912f | 27 | char ACS_DATA_ACQ_ENABLE = 'q'; |
sakthipriya | 0:7b4c00e3912f | 28 | char ACS_STATE = 'q'; |
sakthipriya | 0:7b4c00e3912f | 29 | |
sakthipriya | 0:7b4c00e3912f | 30 | //.....................eps...................// |
sakthipriya | 0:7b4c00e3912f | 31 | //eps init |
sakthipriya | 0:7b4c00e3912f | 32 | char EPS_INIT_STATUS = 'q'; |
sakthipriya | 0:7b4c00e3912f | 33 | char EPS_BATTERY_GAUGE_STATUS = 'q'; |
sakthipriya | 0:7b4c00e3912f | 34 | //eps main |
sakthipriya | 0:7b4c00e3912f | 35 | char EPS_MAIN_STATUS = 'q'; |
sakthipriya | 0:7b4c00e3912f | 36 | char EPS_BATTERY_TEMP_STATUS = 'q'; |
sakthipriya | 0:7b4c00e3912f | 37 | char EPS_STATUS = 'q'; |
sakthipriya | 0:7b4c00e3912f | 38 | |
sakthipriya | 0:7b4c00e3912f | 39 | char EPS_BATTERY_HEAT_ENABLE = 'q'; |
sakthipriya | 0:7b4c00e3912f | 40 | |
sakthipriya | 0:7b4c00e3912f | 41 | //.......................global variables..................................................................// new hk structure- everything has to changed based on this |
sakthipriya | 6:036d08b62785 | 42 | uint8_t BAE_data[74]; |
sakthipriya | 6:036d08b62785 | 43 | char BAE_chardata[74]; |
sakthipriya | 0:7b4c00e3912f | 44 | |
sakthipriya | 0:7b4c00e3912f | 45 | |
sakthipriya | 0:7b4c00e3912f | 46 | //*************************************Global declarations************************************************// |
sakthipriya | 0:7b4c00e3912f | 47 | const int addr = 0x20; //slave address |
sakthipriya | 0:7b4c00e3912f | 48 | |
sakthipriya | 0:7b4c00e3912f | 49 | Timer t_rfsilence; |
sakthipriya | 0:7b4c00e3912f | 50 | Timer t_start; |
sakthipriya | 7:a46a1dee4497 | 51 | Timer t_tc; |
sakthipriya | 7:a46a1dee4497 | 52 | Timer t_tm; |
sakthipriya | 0:7b4c00e3912f | 53 | Serial pc(USBTX, USBRX); |
sakthipriya | 0:7b4c00e3912f | 54 | int power_flag_dummy=2; |
sakthipriya | 0:7b4c00e3912f | 55 | float data[6]; |
sakthipriya | 0:7b4c00e3912f | 56 | |
sakthipriya | 0:7b4c00e3912f | 57 | extern float moment[3]; |
sakthipriya | 0:7b4c00e3912f | 58 | extern uint8_t BCN_FEN; |
sakthipriya | 1:446a959e36ce | 59 | extern BAE_HK_actual actual_data; |
sakthipriya | 1:446a959e36ce | 60 | extern BAE_HK_quant quant_data; |
sakthipriya | 1:446a959e36ce | 61 | extern BAE_HK_min_max bae_HK_minmax; |
sakthipriya | 1:446a959e36ce | 62 | extern BAE_HK_arch arch_data; |
sakthipriya | 0:7b4c00e3912f | 63 | |
sakthipriya | 5:bb592f3185cc | 64 | int write_ack = 1; |
sakthipriya | 5:bb592f3185cc | 65 | int read_ack = 1; |
sakthipriya | 0:7b4c00e3912f | 66 | char telecommand[tc_len]; |
sakthipriya | 3:07e15677a75c | 67 | char* telemetry; |
sakthipriya | 5:bb592f3185cc | 68 | |
sakthipriya | 5:bb592f3185cc | 69 | bool pf1check = 0; |
sakthipriya | 5:bb592f3185cc | 70 | bool pf2check = 0; |
sakthipriya | 5:bb592f3185cc | 71 | bool if1check = 0; |
Bragadeesh153 | 8:24f73f54e44a | 72 | bool if2check = 0; |
sakthipriya | 0:7b4c00e3912f | 73 | |
sakthipriya | 0:7b4c00e3912f | 74 | //*****************************************************Assigning pins******************************************************// |
sakthipriya | 0:7b4c00e3912f | 75 | DigitalOut gpo1(PTC0); // enable of att sens2 switch |
sakthipriya | 0:7b4c00e3912f | 76 | DigitalOut gpo2(PTC16); // enable of att sens switch |
sakthipriya | 0:7b4c00e3912f | 77 | InterruptIn irpt_4m_mstr(PIN38); //I2c interrupt from CDMS |
sakthipriya | 0:7b4c00e3912f | 78 | DigitalOut irpt_2_mstr(PIN4); //I2C interrupt to CDMS |
sakthipriya | 0:7b4c00e3912f | 79 | I2CSlave slave (PIN1,PIN2); |
sakthipriya | 0:7b4c00e3912f | 80 | DigitalOut batt_heat(PIN96); |
sakthipriya | 0:7b4c00e3912f | 81 | |
sakthipriya | 0:7b4c00e3912f | 82 | //gpo1 = 0; |
sakthipriya | 0:7b4c00e3912f | 83 | PwmOut PWM1(PIN93); //x //Functions used to generate PWM signal |
sakthipriya | 0:7b4c00e3912f | 84 | PwmOut PWM2(PIN94); //y |
sakthipriya | 0:7b4c00e3912f | 85 | PwmOut PWM3(PIN95); //z //PWM output comes from pins p6 |
sakthipriya | 0:7b4c00e3912f | 86 | |
sakthipriya | 5:bb592f3185cc | 87 | //........faults |
sakthipriya | 5:bb592f3185cc | 88 | //Polled Faults |
sakthipriya | 5:bb592f3185cc | 89 | DigitalIn pf1(PIN5);//Attitude Sensor 1 OC bar fault signal |
sakthipriya | 5:bb592f3185cc | 90 | DigitalIn pf2(PIN97);//Attitude Sensor 2 OC bar fault signal |
sakthipriya | 5:bb592f3185cc | 91 | DigitalIn pf3(PIN83);//Fault Bar for TRXY driver |
sakthipriya | 5:bb592f3185cc | 92 | |
sakthipriya | 5:bb592f3185cc | 93 | //Interrupt based faults |
sakthipriya | 5:bb592f3185cc | 94 | //InterruptIn ir1(PIN73);//Battery Gauge - Alert Bar Signal |
sakthipriya | 5:bb592f3185cc | 95 | InterruptIn ir2(PIN72);//TRXY Driver TR switch Fault |
sakthipriya | 5:bb592f3185cc | 96 | InterruptIn ir3(PIN89);//TRZ Driver Fault Bar |
sakthipriya | 5:bb592f3185cc | 97 | InterruptIn ir4(PIN91);//TRZ Driver TR switch Fault |
sakthipriya | 5:bb592f3185cc | 98 | InterruptIn ir5(PIN79);//CDMS - Switch Fault |
sakthipriya | 5:bb592f3185cc | 99 | InterruptIn ir6(PIN80);//Beacon- Switch OC bar |
sakthipriya | 5:bb592f3185cc | 100 | InterruptIn ir7(PIN42);//Charger IC - Fault Bar |
sakthipriya | 5:bb592f3185cc | 101 | |
sakthipriya | 5:bb592f3185cc | 102 | DigitalOut TRXY_SW(PIN71); //TR XY Switch |
Bragadeesh153 | 8:24f73f54e44a | 103 | DigitalOut DRV_Z_EN(PIN88); //Sleep pin of driver z |
sakthipriya | 5:bb592f3185cc | 104 | DigitalOut TRZ_SW(PIN40); //TR Z Switch |
sakthipriya | 5:bb592f3185cc | 105 | DigitalOut CDMS_RESET(PIN7); // CDMS RESET |
sakthipriya | 5:bb592f3185cc | 106 | DigitalOut BCN_SW(PIN14); //Beacon switch |
Bragadeesh153 | 8:24f73f54e44a | 107 | DigitalOut DRV_XY_EN(PIN82); |
sakthipriya | 5:bb592f3185cc | 108 | |
sakthipriya | 5:bb592f3185cc | 109 | |
sakthipriya | 0:7b4c00e3912f | 110 | |
sakthipriya | 0:7b4c00e3912f | 111 | /*****************************************************************Threads USed***********************************************************************************/ |
sakthipriya | 3:07e15677a75c | 112 | |
sakthipriya | 0:7b4c00e3912f | 113 | Thread *ptr_t_i2c; |
sakthipriya | 0:7b4c00e3912f | 114 | |
sakthipriya | 0:7b4c00e3912f | 115 | /*********************************************************FCTN HEADERS***********************************************************************************/ |
sakthipriya | 0:7b4c00e3912f | 116 | |
sakthipriya | 0:7b4c00e3912f | 117 | void FCTN_ISR_I2C(); |
sakthipriya | 0:7b4c00e3912f | 118 | void FCTN_TM(); |
sakthipriya | 3:07e15677a75c | 119 | void F_ACS(); |
sakthipriya | 3:07e15677a75c | 120 | void F_EPS(); |
sakthipriya | 3:07e15677a75c | 121 | void F_BCN(); |
sakthipriya | 0:7b4c00e3912f | 122 | |
sakthipriya | 0:7b4c00e3912f | 123 | //*******************************************ACS THREAD**************************************************// |
sakthipriya | 5:bb592f3185cc | 124 | uint8_t iterP1; |
sakthipriya | 5:bb592f3185cc | 125 | uint8_t iterP2; |
sakthipriya | 5:bb592f3185cc | 126 | uint8_t iterI1; |
sakthipriya | 5:bb592f3185cc | 127 | uint8_t iterI2; |
sakthipriya | 0:7b4c00e3912f | 128 | |
sakthipriya | 5:bb592f3185cc | 129 | |
sakthipriya | 3:07e15677a75c | 130 | void F_ACS() |
sakthipriya | 0:7b4c00e3912f | 131 | { |
sakthipriya | 5:bb592f3185cc | 132 | if(pf1check == 1) |
sakthipriya | 5:bb592f3185cc | 133 | { |
sakthipriya | 5:bb592f3185cc | 134 | if(iterP1 >= 3) |
sakthipriya | 5:bb592f3185cc | 135 | { |
sakthipriya | 5:bb592f3185cc | 136 | gpo1 = 1; // turn off ats1 permanently |
sakthipriya | 5:bb592f3185cc | 137 | //FCTN_SWITCH_ATS(0); // switch on ATS2 |
sakthipriya | 5:bb592f3185cc | 138 | } |
sakthipriya | 5:bb592f3185cc | 139 | else |
sakthipriya | 5:bb592f3185cc | 140 | { |
sakthipriya | 5:bb592f3185cc | 141 | gpo1 = 0; |
sakthipriya | 5:bb592f3185cc | 142 | iterP1++; |
sakthipriya | 5:bb592f3185cc | 143 | } |
sakthipriya | 5:bb592f3185cc | 144 | } |
sakthipriya | 5:bb592f3185cc | 145 | if(pf2check == 1) |
sakthipriya | 5:bb592f3185cc | 146 | { |
sakthipriya | 5:bb592f3185cc | 147 | if(iterP1 >= 3) |
sakthipriya | 5:bb592f3185cc | 148 | { |
sakthipriya | 5:bb592f3185cc | 149 | gpo2 = 1; // turn off ats2 permanently |
sakthipriya | 5:bb592f3185cc | 150 | ACS_DATA_ACQ_ENABLE == 'd'; |
sakthipriya | 5:bb592f3185cc | 151 | ACS_STATE == '2' ; // check ACS_STATE = ACS_ZAXIS_MOMENT_ONLY |
sakthipriya | 5:bb592f3185cc | 152 | } |
sakthipriya | 5:bb592f3185cc | 153 | else |
sakthipriya | 5:bb592f3185cc | 154 | { |
sakthipriya | 5:bb592f3185cc | 155 | gpo2 = 0; |
sakthipriya | 5:bb592f3185cc | 156 | iterP2++; |
sakthipriya | 5:bb592f3185cc | 157 | } |
sakthipriya | 5:bb592f3185cc | 158 | } |
sakthipriya | 5:bb592f3185cc | 159 | if(if1check == 1) |
sakthipriya | 5:bb592f3185cc | 160 | { |
sakthipriya | 5:bb592f3185cc | 161 | if(iterI1 >= 3) |
sakthipriya | 5:bb592f3185cc | 162 | { |
sakthipriya | 5:bb592f3185cc | 163 | TRXY_SW = 0; // turn off TRXY permanently |
sakthipriya | 5:bb592f3185cc | 164 | } |
sakthipriya | 5:bb592f3185cc | 165 | else |
sakthipriya | 5:bb592f3185cc | 166 | { |
sakthipriya | 5:bb592f3185cc | 167 | TRXY_SW = 1; //switch on TRXY |
sakthipriya | 5:bb592f3185cc | 168 | iterI1++; |
sakthipriya | 5:bb592f3185cc | 169 | } |
sakthipriya | 5:bb592f3185cc | 170 | } |
sakthipriya | 5:bb592f3185cc | 171 | if(if2check == 1) |
sakthipriya | 5:bb592f3185cc | 172 | { |
sakthipriya | 5:bb592f3185cc | 173 | if(iterI2 >= 3) |
sakthipriya | 5:bb592f3185cc | 174 | { |
sakthipriya | 5:bb592f3185cc | 175 | TRZ_SW = 0; // turn off TRZ permanently |
sakthipriya | 5:bb592f3185cc | 176 | ACS_STATE == '2' ; // check ACS_STATE = ACS_ZAXIS_MOMENT_ONLY |
sakthipriya | 5:bb592f3185cc | 177 | } |
sakthipriya | 5:bb592f3185cc | 178 | else |
sakthipriya | 5:bb592f3185cc | 179 | { |
sakthipriya | 5:bb592f3185cc | 180 | TRZ_SW = 1; //switch on Z |
sakthipriya | 5:bb592f3185cc | 181 | iterI2++; |
sakthipriya | 5:bb592f3185cc | 182 | } |
sakthipriya | 5:bb592f3185cc | 183 | } |
sakthipriya | 5:bb592f3185cc | 184 | |
sakthipriya | 6:036d08b62785 | 185 | //float b1[3]={-23.376,-37.56,14.739}, omega1[3]={-1.52,2.746,0.7629}, moment1[3]= {1.0498,-1.0535,1.3246}; |
sakthipriya | 0:7b4c00e3912f | 186 | //b1[3] = {22, 22,10}; |
sakthipriya | 0:7b4c00e3912f | 187 | //omega1[3] = {2.1,3.0,1.5}; |
sakthipriya | 0:7b4c00e3912f | 188 | // gpo1 = 0; // att sens2 switch is disabled |
sakthipriya | 0:7b4c00e3912f | 189 | // gpo2 = 0; // att sens switch is disabled |
sakthipriya | 0:7b4c00e3912f | 190 | |
sakthipriya | 3:07e15677a75c | 191 | |
sakthipriya | 0:7b4c00e3912f | 192 | |
sakthipriya | 3:07e15677a75c | 193 | //Thread::signal_wait(0x1); |
sakthipriya | 0:7b4c00e3912f | 194 | ACS_MAIN_STATUS = 's'; //set ACS_MAIN_STATUS flag |
sakthipriya | 0:7b4c00e3912f | 195 | PWM1 = 0; //clear pwm pins |
sakthipriya | 0:7b4c00e3912f | 196 | PWM2 = 0; //clear pwm pins |
sakthipriya | 0:7b4c00e3912f | 197 | PWM3 = 0; //clear pwm pins |
sakthipriya | 0:7b4c00e3912f | 198 | pc.printf("\n\rEntered ACS %f\n",t_start.read()); |
sakthipriya | 0:7b4c00e3912f | 199 | |
sakthipriya | 0:7b4c00e3912f | 200 | if(ACS_DATA_ACQ_ENABLE == 'e')// check if ACS_DATA_ACQ_ENABLE = 1? |
sakthipriya | 0:7b4c00e3912f | 201 | { |
sakthipriya | 0:7b4c00e3912f | 202 | FLAG(); |
sakthipriya | 0:7b4c00e3912f | 203 | FCTN_ATS_DATA_ACQ(); //the angular velocity is stored in the first 3 values and magnetic field values in next 3 |
sakthipriya | 0:7b4c00e3912f | 204 | pc.printf("gyro values\n\r"); //printing the angular velocity and magnetic field values |
sakthipriya | 0:7b4c00e3912f | 205 | for(int i=0; i<3; i++) |
sakthipriya | 0:7b4c00e3912f | 206 | { |
sakthipriya | 6:036d08b62785 | 207 | pc.printf("%f\n\r",actual_data.AngularSpeed_actual[i]); |
sakthipriya | 0:7b4c00e3912f | 208 | } |
sakthipriya | 0:7b4c00e3912f | 209 | pc.printf("mag values\n\r"); |
sakthipriya | 6:036d08b62785 | 210 | for(int i=0; i<3; i++) |
sakthipriya | 0:7b4c00e3912f | 211 | { |
sakthipriya | 6:036d08b62785 | 212 | pc.printf("%f\n\r",actual_data.Bvalue_actual[i]); |
sakthipriya | 5:bb592f3185cc | 213 | } |
sakthipriya | 6:036d08b62785 | 214 | // for(int i=0;i<3;i++) |
sakthipriya | 6:036d08b62785 | 215 | // { |
sakthipriya | 6:036d08b62785 | 216 | // omega1[i]= data[i]; |
sakthipriya | 6:036d08b62785 | 217 | // b1[i] = data[i+3]; |
sakthipriya | 6:036d08b62785 | 218 | // } |
sakthipriya | 0:7b4c00e3912f | 219 | }//if ACS_DATA_ACQ_ENABLE = 1 |
sakthipriya | 0:7b4c00e3912f | 220 | else |
sakthipriya | 0:7b4c00e3912f | 221 | { |
sakthipriya | 0:7b4c00e3912f | 222 | // Z axis actuation is the only final solution, |
sakthipriya | 0:7b4c00e3912f | 223 | } |
sakthipriya | 0:7b4c00e3912f | 224 | if(ACS_STATE == '0') // check ACS_STATE = ACS_CONTROL_OFF? |
sakthipriya | 0:7b4c00e3912f | 225 | { |
sakthipriya | 0:7b4c00e3912f | 226 | printf("\n\r acs control off\n"); |
sakthipriya | 0:7b4c00e3912f | 227 | FLAG(); |
sakthipriya | 0:7b4c00e3912f | 228 | ACS_STATUS = '0'; // set ACS_STATUS = ACS_CONTROL_OFF |
sakthipriya | 0:7b4c00e3912f | 229 | PWM1 = 0; //clear pwm pins |
sakthipriya | 0:7b4c00e3912f | 230 | PWM2 = 0; //clear pwm pins |
sakthipriya | 0:7b4c00e3912f | 231 | PWM3 = 0; //clear pwm pins |
sakthipriya | 0:7b4c00e3912f | 232 | } |
sakthipriya | 0:7b4c00e3912f | 233 | else |
sakthipriya | 0:7b4c00e3912f | 234 | { |
sakthipriya | 1:446a959e36ce | 235 | if(actual_data.power_mode>1) |
sakthipriya | 0:7b4c00e3912f | 236 | |
sakthipriya | 0:7b4c00e3912f | 237 | { |
sakthipriya | 0:7b4c00e3912f | 238 | if(ACS_STATE == '2') // check ACS_STATE = ACS_ZAXIS_MOMENT_ONLY |
sakthipriya | 0:7b4c00e3912f | 239 | { |
sakthipriya | 0:7b4c00e3912f | 240 | FLAG(); |
sakthipriya | 0:7b4c00e3912f | 241 | printf("\n\r z axis moment only\n"); |
sakthipriya | 0:7b4c00e3912f | 242 | ACS_STATUS = '2'; // set ACS_STATUS = ACS_ZAXIS_MOMENT_ONLY |
sakthipriya | 0:7b4c00e3912f | 243 | // FCTN_ACS_CNTRLALGO(b1, omega1); |
sakthipriya | 0:7b4c00e3912f | 244 | moment[0] = 0; |
sakthipriya | 0:7b4c00e3912f | 245 | moment[1] = 0; |
sakthipriya | 0:7b4c00e3912f | 246 | moment[2] =1.3;// is a dummy value |
sakthipriya | 0:7b4c00e3912f | 247 | FCTN_ACS_GENPWM_MAIN(moment) ; |
sakthipriya | 0:7b4c00e3912f | 248 | } |
sakthipriya | 0:7b4c00e3912f | 249 | else |
sakthipriya | 0:7b4c00e3912f | 250 | { |
sakthipriya | 0:7b4c00e3912f | 251 | if(ACS_STATE == '3') // check ACS_STATE = ACS_DATA_ACQ_FAILURE |
sakthipriya | 0:7b4c00e3912f | 252 | { |
sakthipriya | 0:7b4c00e3912f | 253 | FLAG(); |
sakthipriya | 0:7b4c00e3912f | 254 | printf("\n\r acs data failure "); |
sakthipriya | 0:7b4c00e3912f | 255 | ACS_STATUS = '3'; // set ACS_STATUS = ACS_DATA_ACQ_FAILURE |
sakthipriya | 0:7b4c00e3912f | 256 | PWM1 = 0; //clear pwm pins |
sakthipriya | 0:7b4c00e3912f | 257 | PWM2 = 0; //clear pwm pins |
sakthipriya | 0:7b4c00e3912f | 258 | PWM3 = 0; //clear pwm pins |
sakthipriya | 0:7b4c00e3912f | 259 | } |
sakthipriya | 0:7b4c00e3912f | 260 | else |
sakthipriya | 0:7b4c00e3912f | 261 | { |
sakthipriya | 0:7b4c00e3912f | 262 | if(ACS_STATE == '4') // check ACS_STATE = ACS_NOMINAL_ONLY |
sakthipriya | 0:7b4c00e3912f | 263 | { |
sakthipriya | 0:7b4c00e3912f | 264 | FLAG(); |
sakthipriya | 0:7b4c00e3912f | 265 | printf("\n\r nominal"); |
sakthipriya | 0:7b4c00e3912f | 266 | ACS_STATUS = '4'; // set ACS_STATUS = ACS_NOMINAL_ONLY |
sakthipriya | 6:036d08b62785 | 267 | FCTN_ACS_CNTRLALGO(actual_data.Bvalue_actual,actual_data.AngularSpeed_actual); |
sakthipriya | 0:7b4c00e3912f | 268 | printf("\n\r moment values returned by control algo \n"); |
sakthipriya | 0:7b4c00e3912f | 269 | for(int i=0; i<3; i++) |
sakthipriya | 0:7b4c00e3912f | 270 | { |
sakthipriya | 0:7b4c00e3912f | 271 | printf("%f\t",moment[i]); |
sakthipriya | 0:7b4c00e3912f | 272 | } |
Bragadeesh153 | 8:24f73f54e44a | 273 | |
Bragadeesh153 | 8:24f73f54e44a | 274 | |
Bragadeesh153 | 8:24f73f54e44a | 275 | FCTN_ACS_GENPWM_MAIN(moment) ; |
Bragadeesh153 | 8:24f73f54e44a | 276 | |
Bragadeesh153 | 8:24f73f54e44a | 277 | //PWM1 = 0.5; |
Bragadeesh153 | 8:24f73f54e44a | 278 | //PWM2 = 0.5; |
Bragadeesh153 | 8:24f73f54e44a | 279 | //PWM3 = 0.5; |
sakthipriya | 0:7b4c00e3912f | 280 | } |
sakthipriya | 0:7b4c00e3912f | 281 | else |
sakthipriya | 0:7b4c00e3912f | 282 | { |
sakthipriya | 0:7b4c00e3912f | 283 | if(ACS_STATE == '5') // check ACS_STATE = ACS_AUTO_CONTROL |
sakthipriya | 0:7b4c00e3912f | 284 | { |
sakthipriya | 0:7b4c00e3912f | 285 | FLAG(); |
sakthipriya | 0:7b4c00e3912f | 286 | printf("\n\r auto control"); |
sakthipriya | 0:7b4c00e3912f | 287 | ACS_STATUS = '5'; // set ACS_STATUS = ACS_AUTO_CONTROL |
sakthipriya | 0:7b4c00e3912f | 288 | //FCTN_ACS_AUTOCTRL_LOGIC // gotta include this code |
sakthipriya | 0:7b4c00e3912f | 289 | } |
sakthipriya | 0:7b4c00e3912f | 290 | else |
sakthipriya | 0:7b4c00e3912f | 291 | { |
sakthipriya | 0:7b4c00e3912f | 292 | if(ACS_STATE == '6') // check ACS_STATE = ACS_DETUMBLING_ONLY |
sakthipriya | 0:7b4c00e3912f | 293 | { |
sakthipriya | 0:7b4c00e3912f | 294 | FLAG(); |
sakthipriya | 0:7b4c00e3912f | 295 | printf("\n\r Entered detumbling \n"); |
sakthipriya | 0:7b4c00e3912f | 296 | ACS_STATUS = '6'; // set ACS_STATUS = ACS_DETUMBLING_ONLY |
sakthipriya | 6:036d08b62785 | 297 | FCTN_ACS_CNTRLALGO(actual_data.Bvalue_actual,actual_data.AngularSpeed_actual); // detumbling code has to be included |
sakthipriya | 0:7b4c00e3912f | 298 | FCTN_ACS_GENPWM_MAIN(moment) ; |
sakthipriya | 0:7b4c00e3912f | 299 | } |
sakthipriya | 0:7b4c00e3912f | 300 | else |
sakthipriya | 0:7b4c00e3912f | 301 | { |
sakthipriya | 0:7b4c00e3912f | 302 | FLAG(); |
sakthipriya | 0:7b4c00e3912f | 303 | printf("\n\r invalid state"); |
sakthipriya | 0:7b4c00e3912f | 304 | ACS_STATUS = '7' ; // set ACS_STATUS = INVALID STATE |
sakthipriya | 0:7b4c00e3912f | 305 | PWM1 = 0; //clear pwm pins |
sakthipriya | 0:7b4c00e3912f | 306 | PWM2 = 0; //clear pwm pins |
sakthipriya | 0:7b4c00e3912f | 307 | PWM3 = 0; //clear pwm pins |
sakthipriya | 0:7b4c00e3912f | 308 | }//else of invalid |
sakthipriya | 0:7b4c00e3912f | 309 | }//else of autocontrol |
sakthipriya | 0:7b4c00e3912f | 310 | }//else of nominal |
sakthipriya | 0:7b4c00e3912f | 311 | }//else of data acg failure |
sakthipriya | 0:7b4c00e3912f | 312 | |
sakthipriya | 0:7b4c00e3912f | 313 | }//else fo z axis moment only |
sakthipriya | 0:7b4c00e3912f | 314 | }//if power >2 |
sakthipriya | 0:7b4c00e3912f | 315 | else |
sakthipriya | 0:7b4c00e3912f | 316 | { |
sakthipriya | 0:7b4c00e3912f | 317 | FLAG(); |
sakthipriya | 0:7b4c00e3912f | 318 | printf("\n\r low power"); |
sakthipriya | 0:7b4c00e3912f | 319 | ACS_STATUS = '1'; // set ACS_STATUS = ACS_LOW_POWER |
sakthipriya | 0:7b4c00e3912f | 320 | PWM1 = 0; //clear pwm pins |
sakthipriya | 0:7b4c00e3912f | 321 | PWM2 = 0; //clear pwm pins |
sakthipriya | 0:7b4c00e3912f | 322 | PWM3 = 0; //clear pwm pins |
sakthipriya | 0:7b4c00e3912f | 323 | } |
sakthipriya | 0:7b4c00e3912f | 324 | } //else for acs control off |
sakthipriya | 0:7b4c00e3912f | 325 | ACS_MAIN_STATUS = 'c'; //clear ACS_MAIN_STATUS flag |
sakthipriya | 3:07e15677a75c | 326 | |
sakthipriya | 0:7b4c00e3912f | 327 | } |
sakthipriya | 0:7b4c00e3912f | 328 | //***************************************************EPS THREAD***********************************************// |
sakthipriya | 0:7b4c00e3912f | 329 | |
sakthipriya | 3:07e15677a75c | 330 | void F_EPS() |
sakthipriya | 0:7b4c00e3912f | 331 | { |
sakthipriya | 3:07e15677a75c | 332 | |
sakthipriya | 0:7b4c00e3912f | 333 | pc.printf("\n\rEntered EPS %f\n",t_start.read()); |
sakthipriya | 0:7b4c00e3912f | 334 | EPS_MAIN_STATUS = 's'; // Set EPS main status |
sakthipriya | 3:07e15677a75c | 335 | FCTN_BATT_TEMP_SENSOR_MAIN(actual_data.Batt_temp_actual); |
sakthipriya | 3:07e15677a75c | 336 | pc.printf("\n\r Battery temperature %f %f" ,actual_data.Batt_temp_actual[0], actual_data.Batt_temp_actual[1]); |
sakthipriya | 3:07e15677a75c | 337 | EPS_BATTERY_TEMP_STATUS = 's'; //set EPS_BATTERY_TEMP_STATUS |
sakthipriya | 3:07e15677a75c | 338 | if(EPS_BATTERY_HEAT_ENABLE == 'e') |
sakthipriya | 3:07e15677a75c | 339 | { |
sakthipriya | 5:bb592f3185cc | 340 | if((actual_data.Batt_temp_actual[0] < batt_heat_low) && (actual_data.Batt_temp_actual[1] < batt_heat_low)) // to confirm |
sakthipriya | 3:07e15677a75c | 341 | { |
sakthipriya | 3:07e15677a75c | 342 | batt_heat = 1; //turn on battery heater |
sakthipriya | 3:07e15677a75c | 343 | } |
sakthipriya | 3:07e15677a75c | 344 | else |
sakthipriya | 3:07e15677a75c | 345 | { |
sakthipriya | 3:07e15677a75c | 346 | batt_heat = 0; //turn off battery heater |
sakthipriya | 3:07e15677a75c | 347 | } |
sakthipriya | 3:07e15677a75c | 348 | |
sakthipriya | 3:07e15677a75c | 349 | } |
sakthipriya | 3:07e15677a75c | 350 | else if(EPS_BATTERY_HEAT_ENABLE == 'd') |
sakthipriya | 3:07e15677a75c | 351 | { |
sakthipriya | 3:07e15677a75c | 352 | EPS_STATUS = 1;//EPS_STATUS = EPS_BATTERY_HEATER_DISABLED |
sakthipriya | 3:07e15677a75c | 353 | } |
sakthipriya | 0:7b4c00e3912f | 354 | FCTN_BATTERYGAUGE_MAIN(actual_data.Batt_gauge_actual); |
sakthipriya | 1:446a959e36ce | 355 | if (actual_data.Batt_gauge_actual[1] == 200) //data not received |
sakthipriya | 0:7b4c00e3912f | 356 | { |
sakthipriya | 0:7b4c00e3912f | 357 | actual_data.power_mode = 1; |
sakthipriya | 0:7b4c00e3912f | 358 | EPS_BATTERY_GAUGE_STATUS = 'c'; //clear EPS_BATTERY_GAUGE_STATUS |
sakthipriya | 0:7b4c00e3912f | 359 | |
sakthipriya | 0:7b4c00e3912f | 360 | } |
sakthipriya | 0:7b4c00e3912f | 361 | else |
sakthipriya | 0:7b4c00e3912f | 362 | { |
sakthipriya | 1:446a959e36ce | 363 | FCTN_EPS_POWERMODE(actual_data.Batt_gauge_actual[1]); //updating power level |
sakthipriya | 0:7b4c00e3912f | 364 | EPS_BATTERY_GAUGE_STATUS = 's'; //set EPS_BATTERY_GAUGE_STATUS |
sakthipriya | 0:7b4c00e3912f | 365 | } |
sakthipriya | 3:07e15677a75c | 366 | // if( Temperature data received) |
sakthipriya | 3:07e15677a75c | 367 | //{ |
sakthipriya | 3:07e15677a75c | 368 | |
sakthipriya | 0:7b4c00e3912f | 369 | |
sakthipriya | 3:07e15677a75c | 370 | // } |
sakthipriya | 3:07e15677a75c | 371 | // else |
sakthipriya | 3:07e15677a75c | 372 | // { |
sakthipriya | 3:07e15677a75c | 373 | // Set battery temp to XX |
sakthipriya | 3:07e15677a75c | 374 | // EPS_BATTERY_TEMP_STATUS = 'c'; //clear EPS_BATTERY_TEMP_STATUS |
sakthipriya | 3:07e15677a75c | 375 | // EPS_STATUS = EPS_ERR_BATTERY_TEMP; |
sakthipriya | 3:07e15677a75c | 376 | // } |
sakthipriya | 3:07e15677a75c | 377 | FCTN_HK_MAIN(); |
sakthipriya | 6:036d08b62785 | 378 | // printf("\n\r here"); |
sakthipriya | 5:bb592f3185cc | 379 | FCTN_APPEND_HKDATA(); |
sakthipriya | 5:bb592f3185cc | 380 | minMaxHkData(); |
sakthipriya | 6:036d08b62785 | 381 | //printf("\n\r here"); |
sakthipriya | 3:07e15677a75c | 382 | EPS_MAIN_STATUS = 'c'; // clear EPS main status |
sakthipriya | 3:07e15677a75c | 383 | |
sakthipriya | 0:7b4c00e3912f | 384 | } |
sakthipriya | 0:7b4c00e3912f | 385 | |
sakthipriya | 0:7b4c00e3912f | 386 | //**************************************************BCN THREAD*******************************************************************// |
sakthipriya | 0:7b4c00e3912f | 387 | |
sakthipriya | 3:07e15677a75c | 388 | void F_BCN() |
sakthipriya | 0:7b4c00e3912f | 389 | { |
sakthipriya | 3:07e15677a75c | 390 | |
sakthipriya | 0:7b4c00e3912f | 391 | pc.printf("\n\rEntered BCN %f\n",t_start.read()); |
sakthipriya | 0:7b4c00e3912f | 392 | |
sakthipriya | 0:7b4c00e3912f | 393 | P_BCN_TX_MAIN(); |
sakthipriya | 0:7b4c00e3912f | 394 | |
sakthipriya | 0:7b4c00e3912f | 395 | } |
sakthipriya | 0:7b4c00e3912f | 396 | |
sakthipriya | 0:7b4c00e3912f | 397 | //**************************************************TCTM THREAD*******************************************************************// |
sakthipriya | 0:7b4c00e3912f | 398 | |
sakthipriya | 0:7b4c00e3912f | 399 | void T_TC(void const * args) |
sakthipriya | 0:7b4c00e3912f | 400 | { |
sakthipriya | 0:7b4c00e3912f | 401 | while(1) |
sakthipriya | 0:7b4c00e3912f | 402 | { |
sakthipriya | 0:7b4c00e3912f | 403 | Thread::signal_wait(0x4); |
sakthipriya | 0:7b4c00e3912f | 404 | wait_us(200); // can be between 38 to 15700 |
sakthipriya | 0:7b4c00e3912f | 405 | if( slave.receive() == 0) |
sakthipriya | 0:7b4c00e3912f | 406 | slave.stop(); |
sakthipriya | 0:7b4c00e3912f | 407 | else if( slave.receive() == 1) // slave writes to master |
sakthipriya | 0:7b4c00e3912f | 408 | { |
sakthipriya | 5:bb592f3185cc | 409 | if(data_send_flag == 'h') |
sakthipriya | 6:036d08b62785 | 410 | { |
sakthipriya | 6:036d08b62785 | 411 | //FCTN_APPEND_HKDATA(); |
sakthipriya | 6:036d08b62785 | 412 | // pc.printf("\n\r here"); |
sakthipriya | 6:036d08b62785 | 413 | write_ack=slave.write(BAE_chardata,74); |
sakthipriya | 6:036d08b62785 | 414 | } |
sakthipriya | 5:bb592f3185cc | 415 | else if(data_send_flag == 't') |
sakthipriya | 5:bb592f3185cc | 416 | { |
sakthipriya | 5:bb592f3185cc | 417 | write_ack=slave.write(telemetry,tm_len); |
sakthipriya | 5:bb592f3185cc | 418 | data_send_flag = 'h'; |
sakthipriya | 5:bb592f3185cc | 419 | irpt_2_mstr = 0; |
sakthipriya | 5:bb592f3185cc | 420 | } |
sakthipriya | 0:7b4c00e3912f | 421 | } |
sakthipriya | 0:7b4c00e3912f | 422 | else if( slave.receive()==3 || slave.receive()==2) // slave read |
sakthipriya | 0:7b4c00e3912f | 423 | { |
sakthipriya | 5:bb592f3185cc | 424 | read_ack=slave.read(telecommand,tc_len); |
sakthipriya | 7:a46a1dee4497 | 425 | t_tc.start(); |
sakthipriya | 6:036d08b62785 | 426 | //pc.printf("\n\rTELECOMMAND received from CDMS is %s \n",telecommand); |
sakthipriya | 7:a46a1dee4497 | 427 | pc.printf("\n\r Executing Telecommand \n"); |
sakthipriya | 3:07e15677a75c | 428 | // FCTN_TC_DECODE((uint8_t*) telecommand); |
sakthipriya | 7:a46a1dee4497 | 429 | |
sakthipriya | 3:07e15677a75c | 430 | uint8_t* temp = FCTN_BAE_TM_TC((uint8_t*) telecommand); |
sakthipriya | 3:07e15677a75c | 431 | telemetry = (char*)temp; |
sakthipriya | 7:a46a1dee4497 | 432 | |
sakthipriya | 5:bb592f3185cc | 433 | FCTN_TM(); |
sakthipriya | 7:a46a1dee4497 | 434 | t_tc.stop(); |
sakthipriya | 7:a46a1dee4497 | 435 | printf("\n\r time taken %d",t_tc.read_us()); |
sakthipriya | 7:a46a1dee4497 | 436 | t_tc.reset(); |
sakthipriya | 3:07e15677a75c | 437 | // for(int i = 0; i<134; i++) |
sakthipriya | 3:07e15677a75c | 438 | //pc.printf("%c", telemetry[i]); |
sakthipriya | 0:7b4c00e3912f | 439 | } |
sakthipriya | 0:7b4c00e3912f | 440 | |
sakthipriya | 6:036d08b62785 | 441 | |
sakthipriya | 0:7b4c00e3912f | 442 | } |
sakthipriya | 0:7b4c00e3912f | 443 | } |
sakthipriya | 0:7b4c00e3912f | 444 | |
sakthipriya | 0:7b4c00e3912f | 445 | void FCTN_TM() |
sakthipriya | 0:7b4c00e3912f | 446 | { |
sakthipriya | 4:39a4ae8c7ecd | 447 | //irpt_2_mstr = 0; |
sakthipriya | 5:bb592f3185cc | 448 | data_send_flag = 't'; |
sakthipriya | 0:7b4c00e3912f | 449 | pc.printf("\n\r Telemetry Generation \n"); |
sakthipriya | 0:7b4c00e3912f | 450 | irpt_2_mstr = 1; |
sakthipriya | 0:7b4c00e3912f | 451 | } |
sakthipriya | 0:7b4c00e3912f | 452 | |
sakthipriya | 0:7b4c00e3912f | 453 | |
sakthipriya | 0:7b4c00e3912f | 454 | //******************************************************* I2C *******************************************************************// |
sakthipriya | 0:7b4c00e3912f | 455 | |
sakthipriya | 0:7b4c00e3912f | 456 | void FCTN_I2C_ISR() |
sakthipriya | 0:7b4c00e3912f | 457 | { |
sakthipriya | 0:7b4c00e3912f | 458 | ptr_t_i2c->signal_set(0x4); |
sakthipriya | 0:7b4c00e3912f | 459 | } |
sakthipriya | 0:7b4c00e3912f | 460 | |
sakthipriya | 0:7b4c00e3912f | 461 | |
sakthipriya | 5:bb592f3185cc | 462 | //***********************************************************FAULTS***************************************************************// |
sakthipriya | 5:bb592f3185cc | 463 | /*void ir1clear() |
sakthipriya | 5:bb592f3185cc | 464 | { |
sakthipriya | 5:bb592f3185cc | 465 | actual_data.faultIr_status |= 0x01; // alert |
sakthipriya | 5:bb592f3185cc | 466 | |
sakthipriya | 5:bb592f3185cc | 467 | }*/ |
sakthipriya | 5:bb592f3185cc | 468 | |
sakthipriya | 5:bb592f3185cc | 469 | |
sakthipriya | 5:bb592f3185cc | 470 | |
sakthipriya | 5:bb592f3185cc | 471 | void ir2clear() |
sakthipriya | 5:bb592f3185cc | 472 | { |
sakthipriya | 5:bb592f3185cc | 473 | actual_data.faultIr_status |= 0x02; |
sakthipriya | 5:bb592f3185cc | 474 | TRXY_SW = 0; // Switch off TR XY |
sakthipriya | 5:bb592f3185cc | 475 | if1check = 1; |
sakthipriya | 5:bb592f3185cc | 476 | } |
sakthipriya | 5:bb592f3185cc | 477 | |
sakthipriya | 5:bb592f3185cc | 478 | void ir3clear() |
sakthipriya | 5:bb592f3185cc | 479 | { |
sakthipriya | 5:bb592f3185cc | 480 | actual_data.faultIr_status |= 0x04; |
Bragadeesh153 | 8:24f73f54e44a | 481 | DRV_Z_EN = 0; |
sakthipriya | 5:bb592f3185cc | 482 | wait_us(1); |
Bragadeesh153 | 8:24f73f54e44a | 483 | DRV_Z_EN = 1; |
sakthipriya | 5:bb592f3185cc | 484 | |
sakthipriya | 5:bb592f3185cc | 485 | } |
sakthipriya | 5:bb592f3185cc | 486 | |
sakthipriya | 5:bb592f3185cc | 487 | void ir4clear() |
sakthipriya | 5:bb592f3185cc | 488 | { |
sakthipriya | 5:bb592f3185cc | 489 | if2check = 1; |
sakthipriya | 5:bb592f3185cc | 490 | actual_data.faultIr_status |= 0x08; |
sakthipriya | 5:bb592f3185cc | 491 | TRZ_SW = 0; |
sakthipriya | 5:bb592f3185cc | 492 | } |
sakthipriya | 5:bb592f3185cc | 493 | |
sakthipriya | 5:bb592f3185cc | 494 | void ir5clear() |
sakthipriya | 5:bb592f3185cc | 495 | { |
sakthipriya | 5:bb592f3185cc | 496 | actual_data.faultIr_status |= 0x10; |
sakthipriya | 5:bb592f3185cc | 497 | CDMS_RESET = 0; |
sakthipriya | 5:bb592f3185cc | 498 | wait_us(1); |
sakthipriya | 5:bb592f3185cc | 499 | CDMS_RESET = 1; |
sakthipriya | 5:bb592f3185cc | 500 | } |
sakthipriya | 5:bb592f3185cc | 501 | |
sakthipriya | 5:bb592f3185cc | 502 | void ir6clear() |
sakthipriya | 5:bb592f3185cc | 503 | { |
sakthipriya | 5:bb592f3185cc | 504 | actual_data.faultIr_status |= 0x20; |
sakthipriya | 5:bb592f3185cc | 505 | BCN_SW = 0; |
sakthipriya | 5:bb592f3185cc | 506 | wait_us(1); |
sakthipriya | 5:bb592f3185cc | 507 | BCN_SW = 1; |
sakthipriya | 5:bb592f3185cc | 508 | } |
sakthipriya | 5:bb592f3185cc | 509 | |
sakthipriya | 5:bb592f3185cc | 510 | void ir7clear() |
sakthipriya | 5:bb592f3185cc | 511 | { |
sakthipriya | 5:bb592f3185cc | 512 | actual_data.faultIr_status |= 0x40; |
sakthipriya | 5:bb592f3185cc | 513 | } |
sakthipriya | 5:bb592f3185cc | 514 | uint8_t iter2=0,iter4 = 0; |
sakthipriya | 5:bb592f3185cc | 515 | |
sakthipriya | 5:bb592f3185cc | 516 | |
sakthipriya | 5:bb592f3185cc | 517 | |
sakthipriya | 5:bb592f3185cc | 518 | void pollfault() |
sakthipriya | 5:bb592f3185cc | 519 | { |
sakthipriya | 5:bb592f3185cc | 520 | |
sakthipriya | 5:bb592f3185cc | 521 | |
sakthipriya | 5:bb592f3185cc | 522 | |
sakthipriya | 5:bb592f3185cc | 523 | if (pf1==0) // OC_ATS1 |
sakthipriya | 5:bb592f3185cc | 524 | { |
sakthipriya | 5:bb592f3185cc | 525 | pf1check=1; |
sakthipriya | 5:bb592f3185cc | 526 | actual_data.faultPoll_status |=0x01 ; |
sakthipriya | 5:bb592f3185cc | 527 | gpo1 = 1; // turn off ats1 // to be turned on next cycle in ACS |
sakthipriya | 5:bb592f3185cc | 528 | } |
sakthipriya | 5:bb592f3185cc | 529 | else actual_data.faultPoll_status &= 0xFE; |
sakthipriya | 5:bb592f3185cc | 530 | |
sakthipriya | 5:bb592f3185cc | 531 | if (pf2==0) |
sakthipriya | 5:bb592f3185cc | 532 | { |
sakthipriya | 5:bb592f3185cc | 533 | pf2check=1; |
sakthipriya | 5:bb592f3185cc | 534 | actual_data.faultPoll_status |=0x02 ; |
sakthipriya | 5:bb592f3185cc | 535 | gpo2 = 1; // turn off ats2 // turn on in ACS |
sakthipriya | 5:bb592f3185cc | 536 | } |
sakthipriya | 5:bb592f3185cc | 537 | else actual_data.faultPoll_status &= 0xFD; |
sakthipriya | 5:bb592f3185cc | 538 | |
sakthipriya | 5:bb592f3185cc | 539 | if (pf3==0) |
sakthipriya | 5:bb592f3185cc | 540 | { actual_data.faultPoll_status |=0x04 ; |
Bragadeesh153 | 8:24f73f54e44a | 541 | DRV_XY_EN = 0; |
sakthipriya | 5:bb592f3185cc | 542 | wait_us(1); |
Bragadeesh153 | 8:24f73f54e44a | 543 | DRV_XY_EN = 1; |
sakthipriya | 5:bb592f3185cc | 544 | } |
sakthipriya | 5:bb592f3185cc | 545 | else actual_data.faultPoll_status &= 0xFB; |
sakthipriya | 5:bb592f3185cc | 546 | |
sakthipriya | 5:bb592f3185cc | 547 | |
sakthipriya | 5:bb592f3185cc | 548 | |
sakthipriya | 5:bb592f3185cc | 549 | |
sakthipriya | 5:bb592f3185cc | 550 | /*if (ir1==1) |
sakthipriya | 5:bb592f3185cc | 551 | { |
sakthipriya | 5:bb592f3185cc | 552 | actual_data.faultIr_status &=0xFE; |
sakthipriya | 5:bb592f3185cc | 553 | }*/ |
sakthipriya | 5:bb592f3185cc | 554 | if (ir2==1) |
sakthipriya | 5:bb592f3185cc | 555 | { |
sakthipriya | 5:bb592f3185cc | 556 | actual_data.faultIr_status &=0xFD; |
sakthipriya | 5:bb592f3185cc | 557 | } |
sakthipriya | 5:bb592f3185cc | 558 | if (ir3==1) |
sakthipriya | 5:bb592f3185cc | 559 | { |
sakthipriya | 5:bb592f3185cc | 560 | actual_data.faultIr_status &=0xFB; |
sakthipriya | 5:bb592f3185cc | 561 | } |
sakthipriya | 5:bb592f3185cc | 562 | if (ir4==1) |
sakthipriya | 5:bb592f3185cc | 563 | { |
sakthipriya | 5:bb592f3185cc | 564 | actual_data.faultIr_status &=0xF7; |
sakthipriya | 5:bb592f3185cc | 565 | } |
sakthipriya | 5:bb592f3185cc | 566 | if (ir5==1) |
sakthipriya | 5:bb592f3185cc | 567 | { |
sakthipriya | 5:bb592f3185cc | 568 | actual_data.faultIr_status &=0xEF; |
sakthipriya | 5:bb592f3185cc | 569 | } |
sakthipriya | 5:bb592f3185cc | 570 | if (ir6==1) |
sakthipriya | 5:bb592f3185cc | 571 | { |
sakthipriya | 5:bb592f3185cc | 572 | actual_data.faultIr_status &=0xDF; |
sakthipriya | 5:bb592f3185cc | 573 | }if (ir7==1) |
sakthipriya | 5:bb592f3185cc | 574 | { |
sakthipriya | 5:bb592f3185cc | 575 | actual_data.faultIr_status &=0xBF; |
sakthipriya | 5:bb592f3185cc | 576 | } |
sakthipriya | 5:bb592f3185cc | 577 | |
sakthipriya | 5:bb592f3185cc | 578 | } |
sakthipriya | 5:bb592f3185cc | 579 | |
sakthipriya | 5:bb592f3185cc | 580 | |
sakthipriya | 0:7b4c00e3912f | 581 | //------------------------------------------------------------------------------------------------------------------------------------------------ |
sakthipriya | 0:7b4c00e3912f | 582 | //SCHEDULER |
sakthipriya | 0:7b4c00e3912f | 583 | //------------------------------------------------------------------------------------------------------------------------------------------------ |
sakthipriya | 0:7b4c00e3912f | 584 | uint8_t schedcount=1; |
sakthipriya | 0:7b4c00e3912f | 585 | void T_SC(void const *args) |
sakthipriya | 0:7b4c00e3912f | 586 | { |
sakthipriya | 0:7b4c00e3912f | 587 | printf("\n\r in scheduler"); |
sakthipriya | 0:7b4c00e3912f | 588 | |
sakthipriya | 0:7b4c00e3912f | 589 | if(schedcount == 7) //to reset the counter |
sakthipriya | 0:7b4c00e3912f | 590 | { |
sakthipriya | 0:7b4c00e3912f | 591 | schedcount = 1; |
sakthipriya | 0:7b4c00e3912f | 592 | } |
sakthipriya | 0:7b4c00e3912f | 593 | if(schedcount%1==0) |
sakthipriya | 0:7b4c00e3912f | 594 | { |
sakthipriya | 3:07e15677a75c | 595 | F_ACS(); |
sakthipriya | 0:7b4c00e3912f | 596 | } |
sakthipriya | 0:7b4c00e3912f | 597 | |
sakthipriya | 0:7b4c00e3912f | 598 | if(schedcount%2==0) |
sakthipriya | 0:7b4c00e3912f | 599 | { |
Bragadeesh153 | 8:24f73f54e44a | 600 | //F_EPS(); |
sakthipriya | 0:7b4c00e3912f | 601 | } |
sakthipriya | 0:7b4c00e3912f | 602 | if(schedcount%3==0) |
sakthipriya | 0:7b4c00e3912f | 603 | { |
sakthipriya | 3:07e15677a75c | 604 | // F_BCN(); |
sakthipriya | 0:7b4c00e3912f | 605 | } |
sakthipriya | 0:7b4c00e3912f | 606 | schedcount++; |
sakthipriya | 0:7b4c00e3912f | 607 | printf("\n\r exited scheduler"); |
sakthipriya | 0:7b4c00e3912f | 608 | } |
sakthipriya | 0:7b4c00e3912f | 609 | |
sakthipriya | 0:7b4c00e3912f | 610 | Timer t_flag; |
sakthipriya | 0:7b4c00e3912f | 611 | void FLAG() |
sakthipriya | 0:7b4c00e3912f | 612 | { |
sakthipriya | 0:7b4c00e3912f | 613 | |
sakthipriya | 0:7b4c00e3912f | 614 | //.............acs..................// |
sakthipriya | 0:7b4c00e3912f | 615 | if(ACS_INIT_STATUS == 's') |
sakthipriya | 0:7b4c00e3912f | 616 | BAE_STATUS = BAE_STATUS | 0x00000080; //set ACS_INIT_STATUS flag |
sakthipriya | 0:7b4c00e3912f | 617 | else if(ACS_INIT_STATUS == 'c') |
sakthipriya | 0:7b4c00e3912f | 618 | BAE_STATUS &= 0xFFFFFF7F; //clear ACS_INIT_STATUS flag |
sakthipriya | 0:7b4c00e3912f | 619 | |
sakthipriya | 0:7b4c00e3912f | 620 | if(ACS_DATA_ACQ_STATUS == 's') |
sakthipriya | 0:7b4c00e3912f | 621 | BAE_STATUS =BAE_STATUS | 0x00000100; //set ACS_DATA_ACQ_STATUS flag |
sakthipriya | 0:7b4c00e3912f | 622 | else if(ACS_DATA_ACQ_STATUS == 'c') |
sakthipriya | 0:7b4c00e3912f | 623 | BAE_STATUS &= 0xFFFFFEFF; //clear ACS_DATA_ACQ_STATUS flag |
sakthipriya | 0:7b4c00e3912f | 624 | |
sakthipriya | 0:7b4c00e3912f | 625 | if(ACS_ATS_ENABLE == 'e') |
sakthipriya | 0:7b4c00e3912f | 626 | BAE_ENABLE |= 0x00000004; |
sakthipriya | 0:7b4c00e3912f | 627 | else if(ACS_ATS_ENABLE == 'd') |
sakthipriya | 0:7b4c00e3912f | 628 | BAE_ENABLE = BAE_ENABLE &0xFFFFFFFB | 0x00000004; |
sakthipriya | 0:7b4c00e3912f | 629 | |
sakthipriya | 0:7b4c00e3912f | 630 | if(ACS_DATA_ACQ_STATUS == 'f') |
sakthipriya | 0:7b4c00e3912f | 631 | BAE_STATUS |= 0x00000200; |
sakthipriya | 0:7b4c00e3912f | 632 | |
sakthipriya | 0:7b4c00e3912f | 633 | if(ACS_MAIN_STATUS == 's') |
sakthipriya | 0:7b4c00e3912f | 634 | BAE_STATUS = (BAE_STATUS | 0x00001000); //set ACS_MAIN_STATUS flag |
sakthipriya | 0:7b4c00e3912f | 635 | else if(ACS_MAIN_STATUS == 'c') |
sakthipriya | 0:7b4c00e3912f | 636 | BAE_STATUS &= 0xFFFFEFFF; //clear ACS_MAIN_STATUS flag |
sakthipriya | 0:7b4c00e3912f | 637 | |
sakthipriya | 0:7b4c00e3912f | 638 | if(ACS_STATUS == '0') |
sakthipriya | 0:7b4c00e3912f | 639 | BAE_STATUS = (BAE_STATUS & 0xFFFF1FFF); // set ACS_STATUS = ACS_CONTROL_OFF |
sakthipriya | 0:7b4c00e3912f | 640 | else if(ACS_STATUS == '1') |
sakthipriya | 0:7b4c00e3912f | 641 | BAE_STATUS =(BAE_STATUS & 0xFFFF1FFF) | 0x00002000; // set ACS_STATUS = ACS_LOW_POWER |
sakthipriya | 0:7b4c00e3912f | 642 | else if(ACS_STATUS == '2') |
sakthipriya | 0:7b4c00e3912f | 643 | BAE_STATUS = (BAE_STATUS & 0xFFFF1FFF)| 0x00004000; // set ACS_STATUS = ACS_ZAXIS_MOMENT_ONLY |
sakthipriya | 0:7b4c00e3912f | 644 | else if(ACS_STATUS == '3') |
sakthipriya | 0:7b4c00e3912f | 645 | BAE_STATUS = (BAE_STATUS & 0xFFFF1FFF) | 0x00006000; // set ACS_STATUS = ACS_DATA_ACQ_FAILURE |
sakthipriya | 0:7b4c00e3912f | 646 | else if(ACS_STATUS == '4') |
sakthipriya | 0:7b4c00e3912f | 647 | BAE_STATUS = (BAE_STATUS & 0xFFFF1FFF) | 0x00008000; // set ACS_STATUS = ACS_NOMINAL_ONLY |
sakthipriya | 0:7b4c00e3912f | 648 | else if(ACS_STATUS == '5') |
sakthipriya | 0:7b4c00e3912f | 649 | BAE_STATUS =(BAE_STATUS & 0xFFFF1FFF) | 0x0000A000; // set ACS_STATUS = ACS_AUTO_CONTROL |
sakthipriya | 0:7b4c00e3912f | 650 | else if(ACS_STATUS == '6') |
sakthipriya | 0:7b4c00e3912f | 651 | BAE_STATUS =(BAE_STATUS & 0xFFFF1FFF) | 0x0000C000; // set ACS_STATUS = ACS_DETUMBLING_ONLY |
sakthipriya | 0:7b4c00e3912f | 652 | else |
sakthipriya | 0:7b4c00e3912f | 653 | BAE_STATUS =(BAE_STATUS & 0xFFFF1FFF) | 0x0000E000; // set ACS_STATUS = INVALID STATE |
sakthipriya | 0:7b4c00e3912f | 654 | |
sakthipriya | 0:7b4c00e3912f | 655 | if(ACS_STATE == '0') |
sakthipriya | 0:7b4c00e3912f | 656 | BAE_ENABLE = (BAE_ENABLE & 0xFFFFFF8F); //ACS_STATE = ACS_CONTROL_OFF |
sakthipriya | 0:7b4c00e3912f | 657 | else if(ACS_STATE == '2') |
sakthipriya | 0:7b4c00e3912f | 658 | BAE_ENABLE = ((BAE_ENABLE & 0xFFFFFF8F)| 0x00000020); // ACS_STATE = ACS_ZAXIS_MOMENT_ONLY |
sakthipriya | 0:7b4c00e3912f | 659 | else if(ACS_STATE == '3') |
sakthipriya | 0:7b4c00e3912f | 660 | BAE_ENABLE = ((BAE_ENABLE & 0xFFFFFF8F)| 0x00000030); // set ACS_STATUS = ACS_DATA_ACQ_FAILURE |
sakthipriya | 0:7b4c00e3912f | 661 | else if(ACS_STATE == '4') |
sakthipriya | 0:7b4c00e3912f | 662 | BAE_ENABLE = ((BAE_ENABLE & 0xFFFFFF8F)| 0x00000040); // ACS_STATE = ACS_NOMINAL_ONLY |
sakthipriya | 0:7b4c00e3912f | 663 | else if(ACS_STATE == '5') |
sakthipriya | 0:7b4c00e3912f | 664 | BAE_ENABLE = ((BAE_ENABLE & 0xFFFFFF8F)| 0x00000050); // ACS_STATE = ACS_AUTO_CONTROL |
sakthipriya | 0:7b4c00e3912f | 665 | else if(ACS_STATE == '6') |
sakthipriya | 0:7b4c00e3912f | 666 | BAE_ENABLE = ((BAE_ENABLE & 0xFFFFFF8F)| 0x00000060); //ACS_STATE = ACS_DETUMBLING_CONTROL |
sakthipriya | 0:7b4c00e3912f | 667 | |
sakthipriya | 0:7b4c00e3912f | 668 | //...............eps......................// |
sakthipriya | 5:bb592f3185cc | 669 | |
sakthipriya | 5:bb592f3185cc | 670 | |
sakthipriya | 5:bb592f3185cc | 671 | if (EPS_INIT_STATUS=='s') // Set EPS_INIT_STATUS |
sakthipriya | 5:bb592f3185cc | 672 | BAE_STATUS |= 0x00010000; |
sakthipriya | 5:bb592f3185cc | 673 | else if(EPS_INIT_STATUS=='c') // Clear |
sakthipriya | 5:bb592f3185cc | 674 | BAE_STATUS &= 0xFFFEFFFF; |
sakthipriya | 5:bb592f3185cc | 675 | |
sakthipriya | 5:bb592f3185cc | 676 | |
sakthipriya | 5:bb592f3185cc | 677 | if (EPS_MAIN_STATUS=='s') // Set EPS_MAIIN_STATUS |
sakthipriya | 5:bb592f3185cc | 678 | BAE_STATUS |= 0x00040000; |
sakthipriya | 5:bb592f3185cc | 679 | else if(EPS_MAIN_STATUS=='c') // Clear |
sakthipriya | 5:bb592f3185cc | 680 | BAE_STATUS &= 0xFFFBFFFF; |
sakthipriya | 5:bb592f3185cc | 681 | |
sakthipriya | 5:bb592f3185cc | 682 | |
sakthipriya | 5:bb592f3185cc | 683 | if (EPS_BATTERY_GAUGE_STATUS=='s') // Set EPS_BATTERY_GAUGE_STATUS |
sakthipriya | 5:bb592f3185cc | 684 | BAE_STATUS |= 0x00020000; |
sakthipriya | 5:bb592f3185cc | 685 | else if(EPS_BATTERY_GAUGE_STATUS=='c') // Clear |
sakthipriya | 5:bb592f3185cc | 686 | BAE_STATUS &= 0xFFFDFFFF; |
sakthipriya | 5:bb592f3185cc | 687 | |
sakthipriya | 5:bb592f3185cc | 688 | |
sakthipriya | 5:bb592f3185cc | 689 | if (EPS_BATTERY_TEMP_STATUS=='s') // Set EPS_BATTERY_TEMP_STATUS |
sakthipriya | 5:bb592f3185cc | 690 | BAE_STATUS |= 0x00080000; |
sakthipriya | 5:bb592f3185cc | 691 | else if(EPS_BATTERY_TEMP_STATUS=='c') // Clear |
sakthipriya | 5:bb592f3185cc | 692 | BAE_STATUS &= 0xFFF7FFFF; |
sakthipriya | 5:bb592f3185cc | 693 | |
sakthipriya | 5:bb592f3185cc | 694 | if (EPS_STATUS==0) |
sakthipriya | 5:bb592f3185cc | 695 | BAE_STATUS = (BAE_STATUS & 0xFF8FFFFF); // Set EPS_ERR_BATTERY_TEMP |
sakthipriya | 5:bb592f3185cc | 696 | else if (EPS_STATUS==1) |
sakthipriya | 5:bb592f3185cc | 697 | BAE_STATUS = (BAE_STATUS & 0xFF8FFFFF)|0x00010000; // Set EPS_BATTERY_HEATER_DISABLED |
sakthipriya | 5:bb592f3185cc | 698 | else if (EPS_STATUS==2) |
sakthipriya | 5:bb592f3185cc | 699 | BAE_STATUS = (BAE_STATUS & 0xFF8FFFFF)|0x00020000; // Set EPS_ERR_HEATER_SWITCH_OFF |
sakthipriya | 5:bb592f3185cc | 700 | else if (EPS_STATUS==3) |
sakthipriya | 5:bb592f3185cc | 701 | BAE_STATUS = (BAE_STATUS & 0xFF8FFFFF)|0x00030000; // Set EPS_ERR_HEATER_SWITCH_ON |
sakthipriya | 5:bb592f3185cc | 702 | else if (EPS_STATUS==4) |
sakthipriya | 5:bb592f3185cc | 703 | BAE_STATUS = (BAE_STATUS & 0xFF8FFFFF)|0x00040000; // Set EPS_BATTERY_HEATER_OFF |
sakthipriya | 5:bb592f3185cc | 704 | else if (EPS_STATUS==5) |
sakthipriya | 5:bb592f3185cc | 705 | BAE_STATUS = (BAE_STATUS & 0xFF8FFFFF)|0x00050000; // Set EPS_BATTERY_HEATER_ON |
sakthipriya | 5:bb592f3185cc | 706 | |
sakthipriya | 5:bb592f3185cc | 707 | |
sakthipriya | 5:bb592f3185cc | 708 | if(EPS_BATTERY_HEAT_ENABLE == 'e') |
sakthipriya | 5:bb592f3185cc | 709 | BAE_ENABLE |= 0x00000080; |
sakthipriya | 5:bb592f3185cc | 710 | else if(EPS_BATTERY_HEAT_ENABLE == 'd') |
sakthipriya | 5:bb592f3185cc | 711 | BAE_ENABLE = BAE_ENABLE &0xFFFFFF7; |
sakthipriya | 3:07e15677a75c | 712 | |
sakthipriya | 0:7b4c00e3912f | 713 | |
sakthipriya | 0:7b4c00e3912f | 714 | |
sakthipriya | 0:7b4c00e3912f | 715 | pc.printf("\n\r BAE status %x BAE ENABLE %x ",BAE_STATUS,BAE_ENABLE); |
sakthipriya | 0:7b4c00e3912f | 716 | } |
sakthipriya | 0:7b4c00e3912f | 717 | |
sakthipriya | 0:7b4c00e3912f | 718 | void FCTN_BAE_INIT() |
sakthipriya | 0:7b4c00e3912f | 719 | { |
sakthipriya | 0:7b4c00e3912f | 720 | printf("\n\r Initialising BAE "); |
sakthipriya | 3:07e15677a75c | 721 | //..........intial status....// |
sakthipriya | 3:07e15677a75c | 722 | ACS_STATE = '4'; |
sakthipriya | 3:07e15677a75c | 723 | ACS_ATS_ENABLE = 'e'; |
sakthipriya | 3:07e15677a75c | 724 | ACS_DATA_ACQ_ENABLE = 'e'; |
sakthipriya | 3:07e15677a75c | 725 | EPS_BATTERY_HEAT_ENABLE = 'e'; |
Bragadeesh153 | 8:24f73f54e44a | 726 | DRV_XY_EN = 1; |
Bragadeesh153 | 8:24f73f54e44a | 727 | DRV_Z_EN = 1; |
Bragadeesh153 | 8:24f73f54e44a | 728 | TRZ_SW = 1; |
Bragadeesh153 | 8:24f73f54e44a | 729 | TRXY_SW = 1; |
sakthipriya | 3:07e15677a75c | 730 | //............................// |
sakthipriya | 3:07e15677a75c | 731 | FCTN_ACS_INIT(); |
Bragadeesh153 | 8:24f73f54e44a | 732 | //FCTN_EPS_INIT(); |
sakthipriya | 0:7b4c00e3912f | 733 | //P_BCN_INIT(); |
sakthipriya | 3:07e15677a75c | 734 | |
sakthipriya | 3:07e15677a75c | 735 | |
sakthipriya | 0:7b4c00e3912f | 736 | FLAG(); |
sakthipriya | 0:7b4c00e3912f | 737 | } |
sakthipriya | 0:7b4c00e3912f | 738 | |
sakthipriya | 0:7b4c00e3912f | 739 | int main() |
sakthipriya | 0:7b4c00e3912f | 740 | { |
Bragadeesh153 | 8:24f73f54e44a | 741 | |
Bragadeesh153 | 8:24f73f54e44a | 742 | |
sakthipriya | 0:7b4c00e3912f | 743 | pc.printf("\n\r BAE Activated. Testing Version 1.1 \n"); |
Bragadeesh153 | 8:24f73f54e44a | 744 | actual_data.power_mode=3; |
sakthipriya | 0:7b4c00e3912f | 745 | |
sakthipriya | 0:7b4c00e3912f | 746 | /* if (BCN_FEN == 0) //dummy implementation |
sakthipriya | 0:7b4c00e3912f | 747 | { |
sakthipriya | 0:7b4c00e3912f | 748 | pc.printf("\n\r RF silence "); |
sakthipriya | 0:7b4c00e3912f | 749 | P_BCN_FEN(); |
sakthipriya | 0:7b4c00e3912f | 750 | t_rfsilence.start();//Start the timer for RF_Silence |
sakthipriya | 0:7b4c00e3912f | 751 | while(t_rfsilence.read() < RF_SILENCE_TIME); |
sakthipriya | 0:7b4c00e3912f | 752 | } |
sakthipriya | 0:7b4c00e3912f | 753 | */ |
sakthipriya | 3:07e15677a75c | 754 | |
sakthipriya | 0:7b4c00e3912f | 755 | //ACS_INIT_STATUS = 'c'; |
sakthipriya | 0:7b4c00e3912f | 756 | //ACS_DATA_ACQ_STATUS = 'c'; |
sakthipriya | 0:7b4c00e3912f | 757 | gpo1 = 0; |
sakthipriya | 0:7b4c00e3912f | 758 | FLAG(); |
sakthipriya | 0:7b4c00e3912f | 759 | FCTN_BAE_INIT(); |
sakthipriya | 3:07e15677a75c | 760 | |
sakthipriya | 0:7b4c00e3912f | 761 | |
sakthipriya | 0:7b4c00e3912f | 762 | //...i2c.. |
sakthipriya | 3:07e15677a75c | 763 | //strcpy(telemetry,"This is telemetry THis is sample telemetry. ffffffffffffffffffffffffffffff end"); |
sakthipriya | 0:7b4c00e3912f | 764 | slave.address(addr); |
sakthipriya | 0:7b4c00e3912f | 765 | irpt_2_mstr = 0; |
sakthipriya | 0:7b4c00e3912f | 766 | |
sakthipriya | 0:7b4c00e3912f | 767 | ptr_t_i2c = new Thread(T_TC); |
sakthipriya | 0:7b4c00e3912f | 768 | ptr_t_i2c->set_priority(osPriorityHigh); |
sakthipriya | 5:bb592f3185cc | 769 | |
sakthipriya | 0:7b4c00e3912f | 770 | irpt_4m_mstr.enable_irq(); |
sakthipriya | 0:7b4c00e3912f | 771 | irpt_4m_mstr.rise(&FCTN_I2C_ISR); |
sakthipriya | 5:bb592f3185cc | 772 | // ir1.fall(&ir1clear); //Battery Gauge - Alert Bar Signal |
Bragadeesh153 | 8:24f73f54e44a | 773 | |
Bragadeesh153 | 8:24f73f54e44a | 774 | |
Bragadeesh153 | 8:24f73f54e44a | 775 | /*ir2.fall(&ir2clear); //TRXY Driver TR switch Fault |
sakthipriya | 5:bb592f3185cc | 776 | ir3.fall(&ir3clear); //TRZ Driver Fault Bar |
sakthipriya | 5:bb592f3185cc | 777 | ir4.fall(&ir4clear); //TRZ Driver TR switch Fault |
sakthipriya | 5:bb592f3185cc | 778 | ir5.fall(&ir5clear); //CDMS - Switch Fault |
sakthipriya | 5:bb592f3185cc | 779 | ir6.fall(&ir6clear); //Beacon- Switch OC bar |
sakthipriya | 5:bb592f3185cc | 780 | ir7.fall(&ir7clear); //Charger IC - Fault Bar |
Bragadeesh153 | 8:24f73f54e44a | 781 | |
Bragadeesh153 | 8:24f73f54e44a | 782 | */ |
Bragadeesh153 | 8:24f73f54e44a | 783 | |
sakthipriya | 0:7b4c00e3912f | 784 | RtosTimer t_sc_timer(T_SC,osTimerPeriodic); // Initiating the scheduler thread |
sakthipriya | 0:7b4c00e3912f | 785 | t_sc_timer.start(10000); |
sakthipriya | 0:7b4c00e3912f | 786 | t_start.start(); |
sakthipriya | 0:7b4c00e3912f | 787 | pc.printf("\n\rStarted scheduler %f\n\r",t_start.read()); |
sakthipriya | 0:7b4c00e3912f | 788 | |
sakthipriya | 0:7b4c00e3912f | 789 | gpo1 = 0; // att sens2 switch is enabled |
sakthipriya | 0:7b4c00e3912f | 790 | //FCTN_BAE_INIT(); |
sakthipriya | 0:7b4c00e3912f | 791 | while(1); //required to prevent main from terminating |
sakthipriya | 3:07e15677a75c | 792 | } |
sakthipriya | 3:07e15677a75c | 793 |