sakthi priya amirtharaj
/
BAE_vr2_gingerbread2
mag n gyro included
Fork of BAE_vr2_gingerbread2 by
HK.h@0:e9c32e1df869, 2014-12-17 (annotated)
- Committer:
- sakthipriya
- Date:
- Wed Dec 17 06:52:26 2014 +0000
- Revision:
- 0:e9c32e1df869
- Child:
- 4:12fe853d8bcf
i2c working with new hk(no battery gauge)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sakthipriya | 0:e9c32e1df869 | 1 | //to be saved as HK.h |
sakthipriya | 0:e9c32e1df869 | 2 | |
sakthipriya | 0:e9c32e1df869 | 3 | #include "mbed.h" |
sakthipriya | 0:e9c32e1df869 | 4 | #define tstart -40 |
sakthipriya | 0:e9c32e1df869 | 5 | #define tstep 8 |
sakthipriya | 0:e9c32e1df869 | 6 | #define tstep_thermistor 8//verify!! |
sakthipriya | 0:e9c32e1df869 | 7 | #define tstart_thermistor -40 |
sakthipriya | 0:e9c32e1df869 | 8 | #define vstart 3.3 |
sakthipriya | 0:e9c32e1df869 | 9 | #define vstep 0.84667 |
sakthipriya | 0:e9c32e1df869 | 10 | #define cstart 0.0691 |
sakthipriya | 0:e9c32e1df869 | 11 | #define cstep 0.09133 |
sakthipriya | 0:e9c32e1df869 | 12 | #define rsens 0.095 |
sakthipriya | 0:e9c32e1df869 | 13 | #define Bnewvalue_start -100//in microTesla...max possible field is .0001 T |
sakthipriya | 0:e9c32e1df869 | 14 | #define Bnewvalue_step 13.333 |
sakthipriya | 0:e9c32e1df869 | 15 | #define AngularSpeed_start -10//max possible ang. velocity in space is 10 deg/sec |
sakthipriya | 0:e9c32e1df869 | 16 | #define AngularSpeed_step 1.3333 |
sakthipriya | 0:e9c32e1df869 | 17 | |
sakthipriya | 0:e9c32e1df869 | 18 | typedef struct SensorData |
sakthipriya | 0:e9c32e1df869 | 19 | { |
sakthipriya | 0:e9c32e1df869 | 20 | float Voltage[16]; |
sakthipriya | 0:e9c32e1df869 | 21 | float Current[8]; |
sakthipriya | 0:e9c32e1df869 | 22 | float Temperature[1]; |
sakthipriya | 0:e9c32e1df869 | 23 | float PanelTemperature[4]; |
sakthipriya | 0:e9c32e1df869 | 24 | float BatteryTemperature; //to be populated |
sakthipriya | 0:e9c32e1df869 | 25 | char faultpoll; //polled faults |
sakthipriya | 0:e9c32e1df869 | 26 | char faultir; //interrupted faults |
sakthipriya | 0:e9c32e1df869 | 27 | char power_mode; //power modes |
sakthipriya | 0:e9c32e1df869 | 28 | |
sakthipriya | 0:e9c32e1df869 | 29 | float AngularSpeed[3]; //in order x,y,z |
sakthipriya | 0:e9c32e1df869 | 30 | float Bnewvalue[3]; //in order Bx,By,Bz |
sakthipriya | 0:e9c32e1df869 | 31 | |
sakthipriya | 0:e9c32e1df869 | 32 | |
sakthipriya | 0:e9c32e1df869 | 33 | } SensorData; |
sakthipriya | 0:e9c32e1df869 | 34 | |
sakthipriya | 0:e9c32e1df869 | 35 | |
sakthipriya | 0:e9c32e1df869 | 36 | typedef struct SensorDataQuantised { |
sakthipriya | 0:e9c32e1df869 | 37 | char Voltage[8]; |
sakthipriya | 0:e9c32e1df869 | 38 | char Current[4]; |
sakthipriya | 0:e9c32e1df869 | 39 | char Temperature[1]; |
sakthipriya | 0:e9c32e1df869 | 40 | char PanelTemperature[2];//read by the 4 thermistors on solar panels |
sakthipriya | 0:e9c32e1df869 | 41 | char BatteryTemperature; //to be populated |
sakthipriya | 0:e9c32e1df869 | 42 | char faultpoll; //polled faults |
sakthipriya | 0:e9c32e1df869 | 43 | char faultir; //interrupted faults |
sakthipriya | 0:e9c32e1df869 | 44 | char power_mode; //power modes |
sakthipriya | 0:e9c32e1df869 | 45 | char AngularSpeed[2]; |
sakthipriya | 0:e9c32e1df869 | 46 | char Bnewvalue[2]; |
sakthipriya | 0:e9c32e1df869 | 47 | |
sakthipriya | 0:e9c32e1df869 | 48 | //float magnetometer,gyro=>to be addes |
sakthipriya | 0:e9c32e1df869 | 49 | } SensorDataQuantised; |
sakthipriya | 0:e9c32e1df869 | 50 | |
sakthipriya | 0:e9c32e1df869 | 51 | |
sakthipriya | 0:e9c32e1df869 | 52 | typedef struct ShortBeacon |
sakthipriya | 0:e9c32e1df869 | 53 | { |
sakthipriya | 0:e9c32e1df869 | 54 | char Voltage[1]; //battery voltage from gauge, needs to be quantised |
sakthipriya | 0:e9c32e1df869 | 55 | char AngularSpeed[2]; //all the 3 data |
sakthipriya | 0:e9c32e1df869 | 56 | char SubsystemStatus[1]; //power modes |
sakthipriya | 0:e9c32e1df869 | 57 | char Temp[2]; //temp of solar panel |
sakthipriya | 0:e9c32e1df869 | 58 | //Temp[0]'s LSB=> PanelTemperature[0], Temp[0]'s MSB=> PanelTemperature[1], Temp[1]'s LSB=> PanelTemperature[2], Temp[1]'s MSB=> PanelTemperature[3] |
sakthipriya | 0:e9c32e1df869 | 59 | char ErrorFlag[1]; //fault |
sakthipriya | 0:e9c32e1df869 | 60 | }ShortBeacy; |
sakthipriya | 0:e9c32e1df869 | 61 | |
sakthipriya | 0:e9c32e1df869 | 62 | |
sakthipriya | 0:e9c32e1df869 | 63 | |
sakthipriya | 0:e9c32e1df869 | 64 | void FUNC_HK_MAIN(); |
sakthipriya | 0:e9c32e1df869 | 65 | |
sakthipriya | 0:e9c32e1df869 | 66 | int quantiz(float start,float step,float x); |
sakthipriya | 0:e9c32e1df869 | 67 | void init_beacon(ShortBeacy* x,SensorDataQuantised y); |