QITH FLAGS
Dependencies: FreescaleIAP mbed-rtos mbed
Fork of TF_conops_BAE1_3 by
Diff: EPS.h
- Revision:
- 0:246d1b5f11ae
- Child:
- 1:7185136654ce
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/EPS.h Tue Jun 30 05:55:48 2015 +0000 @@ -0,0 +1,69 @@ +#include "mbed.h" + +#define vstart 3.3 +#define vstep 0.84667 +#define cstart 0.0691 +#define cstep 0.09133 +#define rsens 0.095 +#define Bnewvalue_start -100//in microTesla...max possible field is .0001 T +#define Bnewvalue_step 13.333 +#define AngularSpeed_start -10//max possible ang. velocity in space is 10 deg/sec +#define AngularSpeed_step 1.3333 + +/***********************************************Configuring Peripherals*******************************************************************/ + +DigitalOut SelectLinesA[] = {PIN43,PIN44,PIN45,PIN46}; //to mux1=>voltage mux , PTA 13-16 , CHNGE TO PIN43 LATER +DigitalOut SelectLinesB[] = {PIN56,PIN57,PIN58,PIN59}; //to mux2=>current mux(differential mux) , PTB 3,7,8,9 + //MSB is SelectLines[0],LSB is SelectLines[3] +AnalogIn CurrentInput(PIN53); // output from Current Mux PTB0 +AnalogIn VoltageInput(PIN54); // output from Voltage Multiplexer PTB1 + +/**************************************************Variables******************************************************************************/ +typedef struct SensorData //soc value has to be included +{ + float Voltage[16]; + float Current[8]; + float PanelTemperature[4]; // not finalised + float BatteryTemperature; + char fault_poll; //polled faults + char fault_ir; //interrupted faults + char clear_fault_poll; //to be confirmed + char clear_fault_ir; + char power_mode; //power modes + float AngularSpeed[3]; //in order x,y,z + float Bnewvalue[3]; //in order Bx,By,Bz +} SensorData; + + +typedef struct SensorDataQuantised +{ + char Voltage[8]; + char Current[4]; + char PanelTemperature[2];//read by the 4 thermistors on solar panels + char BatteryTemperature; //to be populated + char faultpoll; //polled faults + char faultir; //interrupted faults + char power_mode; //power modes + char AngularSpeed[2]; + char Bnewvalue[2]; + + //float magnetometer,gyro=>to be addes +} SensorDataQuantised; + + +typedef struct ShortBeacon +{ + char Voltage[1]; //battery voltage from gauge, needs to be quantised + char AngularSpeed[2]; //all the 3 data + char SubsystemStatus[1]; //power modes + char Temp[2]; //temp of solar panel + //Temp[0]'s LSB=> PanelTemperature[0], Temp[0]'s MSB=> PanelTemperature[1], Temp[1]'s LSB=> PanelTemperature[2], Temp[1]'s MSB=> PanelTemperature[3] + char ErrorFlag[1]; //fault +}ShortBeacy; + + +void FCTN_EPS_INIT(); +void FCTN_EPS_MAIN(); + +int FCTN_QUANTIZE(float l_start,float l_step,float l_x); +void FCTN_WRITE_BEASTRUCT(ShortBeacy* x,SensorDataQuantised y);