QITH FLAGS
Dependencies: FreescaleIAP mbed-rtos mbed
Fork of TF_conops_BAE1_3 by
EPS.h
00001 #include "mbed.h" 00002 #include "pin_config.h" 00003 //.............Power switching.......... 00004 #define TRXY_DR_EN PIN82 //torque rod driver enable 00005 #define TRZ_DR_EN PIN88 00006 #define 3V3AENBL PIN33 00007 #define VBATT PIN20 00008 //......................HK..................... 00009 #define vstart 3.3 00010 #define vstep 0.84667 00011 #define cstart 0.0691 00012 #define cstep 0.09133 00013 #define tstart -40 00014 #define tstep 8.33 00015 #define rsens 0.025 00016 #define Bnewvalue_start -100//in microTesla...max possible field is .0001 T 00017 #define Bnewvalue_step 13.333 00018 #define AngularSpeed_start -10//max possible ang. velocity in space is 10 deg/sec 00019 #define AngularSpeed_step 1.3333 00020 //...............Battery Gauge................ 00021 #define BG_ADDR (0x6C) //slave address of battery gauge 00022 //I2C register addresses 00023 #define REG_VCELL 0x02 00024 #define REG_SOC 0x04 00025 #define REG_MODE 0x06 00026 #define REG_VERSION 0x08 00027 #define REG_HIBRT 0x0A 00028 #define REG_CONFIG 0x0C 00029 #define REG_VALRT 0x14 00030 #define REG_CRATE 0x16 00031 #define REG_VRESET_ID 0x18 00032 #define REG_STATUS 0x1A 00033 #define REG_TABLE 0x40 00034 #define REG_CMD 0xFE 00035 00036 00037 typedef struct SensorData 00038 { 00039 float SOC; //added recently 00040 float Vbatt; //added recently 00041 float Voltage[15]; 00042 float Current[7]; 00043 float Temperature[1]; // not finalised 00044 //float PanelTemperature[4]; // not finalised ///there wer 4 values here? 00045 float BatteryTemperature; 00046 char fault_poll; //polled faults 00047 char fault_ir; //interrupted faults 00048 char clear_fault_poll; //to be confirmed 00049 char clear_fault_ir; 00050 char power_mode; //power modes 00051 float AngularSpeed[3]; //in order x,y,z 00052 float Bnewvalue[3]; //in order Bx,By,Bz 00053 } SensorData; 00054 00055 00056 typedef struct SensorDataQuantised 00057 { 00058 char Voltage[8]; 00059 char Current[4]; 00060 char Temperature[2]; ///size?????? 00061 //char PanelTemperature[2];//read by the 4 thermistors on solar panels 00062 char BatteryTemperature; //to be populated 00063 char faultpoll; //polled faults 00064 char faultir; //interrupted faults 00065 char power_mode; //power modes 00066 char AngularSpeed[2]; 00067 char Bnewvalue[2]; 00068 00069 //float magnetometer,gyro=>to be addes 00070 } SensorDataQuantised; 00071 00072 00073 typedef struct ShortBeacon 00074 { 00075 char Voltage[1]; //battery voltage from gauge, needs to be quantised 00076 char AngularSpeed[2]; //all the 3 data 00077 char SubsystemStatus[1]; //power modes 00078 char Temp[2]; //temp of solar panel 00079 //Temp[0]'s LSB=> PanelTemperature[0], Temp[0]'s MSB=> PanelTemperature[1], Temp[1]'s LSB=> PanelTemperature[2], Temp[1]'s MSB=> PanelTemperature[3] 00080 char ErrorFlag[1]; //fault 00081 }ShortBeacy; 00082 00083 00084 /******************************************************function headers************************************************************************/ 00085 void FCTN_EPS_INIT(); 00086 00087 void FCTN_EPS_BTEMP_INIT(); 00088 void FCTN_EPS_BTEMP_MAIN(float*); 00089 00090 unsigned short BG_readReg(char); 00091 void BG_writeReg(char, unsigned short); 00092 void BG_reset(); //not used in code 00093 void BG_quickStart(); //not used in code 00094 void BG_disableSleep(); 00095 void BG_disableHibernate(); 00096 void BG_socChangeAlertEnabled(bool); 00097 float BG_compensation(); //not used in code 00098 void BG_compensation(char); 00099 void BG_tempCompensation(float); 00100 bool BG_alerting(); 00101 void BG_clearAlert(); 00102 void BG_emptyAlertThreshold(char); 00103 void BG_vAlertMinMaxThreshold(); 00104 void BG_vResetThresholdSet(); 00105 void BG_vResetAlertEnabled(bool); 00106 char BG_alertFlags(); 00107 void BG_clearAlertFlags(); 00108 float BG_vcell(); 00109 float BG_soc(); 00110 void FCTN_EPS_BG_INIT(); 00111 void FCTN_EPS_BG_MAIN(); 00112 00113 int FCTN_EPS_POWERMODE(float); 00114 void FCTN_EPS_CTRLPOWER(int) ; 00115 00116 int FCTN_QUANTIZE(float ,float ,float ); 00117 void FCTN_WRITE_BEASTRUCT(ShortBeacy* ,SensorDataQuantised ); 00118 void FCTN_EPS_HK_MAIN(); 00119 00120
Generated on Tue Jul 12 2022 23:01:05 by 1.7.2