version 1.0

Dependencies:   CMSIS_DSP_401 GPS MPU9150_DMP PID QuaternionMath Servo mbed

Fork of SolarOnFoils_MainModule_20150518 by Dannis Brugman

Committer:
Dannis_mbed
Date:
Tue Jun 23 13:55:28 2015 +0000
Revision:
0:81b21910454e
Child:
1:b4a0d63db637
version 1.0

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Dannis_mbed 0:81b21910454e 1 #ifndef SYSTEMVAR_H_INCLUDED
Dannis_mbed 0:81b21910454e 2 #define SYSTEMVAR_H_INCLUDED
Dannis_mbed 0:81b21910454e 3
Dannis_mbed 0:81b21910454e 4 #include "mbed.h"
Dannis_mbed 0:81b21910454e 5 #include "string.h"
Dannis_mbed 0:81b21910454e 6 #include "Quaternion.h"
Dannis_mbed 0:81b21910454e 7
Dannis_mbed 0:81b21910454e 8 //Solar on Foils display values
Dannis_mbed 0:81b21910454e 9 enum VALUE_t
Dannis_mbed 0:81b21910454e 10 {
Dannis_mbed 0:81b21910454e 11 //////////////////////////////////////////////////////////////////////////////////////
Dannis_mbed 0:81b21910454e 12 // system measured values //
Dannis_mbed 0:81b21910454e 13 //////////////////////////////////////////////////////////////////////////////////////
Dannis_mbed 0:81b21910454e 14 _ROLL = 0, // roll
Dannis_mbed 0:81b21910454e 15 _PITCH, // pitch
Dannis_mbed 0:81b21910454e 16 _PHEIGHT, // portside height
Dannis_mbed 0:81b21910454e 17 _SHEIGHT, // starboard height
Dannis_mbed 0:81b21910454e 18 _PCURRENT, // portside current
Dannis_mbed 0:81b21910454e 19 _SCURRENT, // starboard current
Dannis_mbed 0:81b21910454e 20 _SPEED, // speed
Dannis_mbed 0:81b21910454e 21 //////////////////////////////////////////////////////////////////////////////////////
Dannis_mbed 0:81b21910454e 22 // system variables //
Dannis_mbed 0:81b21910454e 23 //////////////////////////////////////////////////////////////////////////////////////
Dannis_mbed 0:81b21910454e 24 _MAXROLL, // variable max roll
Dannis_mbed 0:81b21910454e 25 _MINPITCH, // variable min pitch
Dannis_mbed 0:81b21910454e 26 _MAXPITCH, // variable max pitch
Dannis_mbed 0:81b21910454e 27 _TAKEOFFSPEED, // variable take off speed
Dannis_mbed 0:81b21910454e 28 _HEIGHTFOILBORNE, // variable flight height foilborne
Dannis_mbed 0:81b21910454e 29 _HEIGHTFOILASSIST, // variable flight height foil assist
Dannis_mbed 0:81b21910454e 30 _AOAFOILASSIST // variable AOA foil assist
Dannis_mbed 0:81b21910454e 31 };
Dannis_mbed 0:81b21910454e 32
Dannis_mbed 0:81b21910454e 33 class SystemVar
Dannis_mbed 0:81b21910454e 34 {
Dannis_mbed 0:81b21910454e 35 private:
Dannis_mbed 0:81b21910454e 36 // variable
Dannis_mbed 0:81b21910454e 37
Dannis_mbed 0:81b21910454e 38 char cValue[4];
Dannis_mbed 0:81b21910454e 39
Dannis_mbed 0:81b21910454e 40 VALUE_t value;
Dannis_mbed 0:81b21910454e 41
Dannis_mbed 0:81b21910454e 42 uint32_t uiCounter;
Dannis_mbed 0:81b21910454e 43 uint32_t uiRoll[2];
Dannis_mbed 0:81b21910454e 44 uint32_t uiPitch[2];
Dannis_mbed 0:81b21910454e 45 uint32_t uiPHeight;
Dannis_mbed 0:81b21910454e 46 uint32_t uiSHeight;
Dannis_mbed 0:81b21910454e 47 uint32_t uiPCurrent;
Dannis_mbed 0:81b21910454e 48 uint32_t uiSCurrent;
Dannis_mbed 0:81b21910454e 49 uint32_t uiSpeed;
Dannis_mbed 0:81b21910454e 50 uint32_t uiVarMaxRoll;
Dannis_mbed 0:81b21910454e 51 uint32_t uiVarMinPitch;
Dannis_mbed 0:81b21910454e 52 uint32_t uivVarMaxPitch;
Dannis_mbed 0:81b21910454e 53 uint32_t uivVarTakeOffSpeed;
Dannis_mbed 0:81b21910454e 54 uint32_t uivVarHeightFoilBorne;
Dannis_mbed 0:81b21910454e 55 uint32_t uivVarHeightFoilAssist;
Dannis_mbed 0:81b21910454e 56 uint32_t uivVarAOAFoilAssist;
Dannis_mbed 0:81b21910454e 57
Dannis_mbed 0:81b21910454e 58 bool bError;
Dannis_mbed 0:81b21910454e 59
Dannis_mbed 0:81b21910454e 60 public:
Dannis_mbed 0:81b21910454e 61 // Constructor
Dannis_mbed 0:81b21910454e 62 SystemVar();
Dannis_mbed 0:81b21910454e 63 // Destructor
Dannis_mbed 0:81b21910454e 64 ~SystemVar();
Dannis_mbed 0:81b21910454e 65
Dannis_mbed 0:81b21910454e 66 // Gets
Dannis_mbed 0:81b21910454e 67 char* getValue(void);
Dannis_mbed 0:81b21910454e 68 int iGetRollPolarity(void);
Dannis_mbed 0:81b21910454e 69 int iGetPitchPolarity(void);
Dannis_mbed 0:81b21910454e 70
Dannis_mbed 0:81b21910454e 71 // Sets
Dannis_mbed 0:81b21910454e 72 void vSetRoll(Quaternion);
Dannis_mbed 0:81b21910454e 73 void vSetPitch(Quaternion);
Dannis_mbed 0:81b21910454e 74 void vSetPHeight(uint32_t);
Dannis_mbed 0:81b21910454e 75 void vSetSHeight(uint32_t);
Dannis_mbed 0:81b21910454e 76 void vSetPCurrent(uint32_t);
Dannis_mbed 0:81b21910454e 77 void vSetSCurrent(uint32_t);
Dannis_mbed 0:81b21910454e 78 void vSetSpeed(uint32_t);
Dannis_mbed 0:81b21910454e 79 // Set variables
Dannis_mbed 0:81b21910454e 80 void vVarMaxRoll(uint32_t);
Dannis_mbed 0:81b21910454e 81 void vVarMinPitch(uint32_t);
Dannis_mbed 0:81b21910454e 82 void vVarMaxPitch(uint32_t);
Dannis_mbed 0:81b21910454e 83 void vVarTakeOffSpeed(uint32_t);
Dannis_mbed 0:81b21910454e 84 void vVarHeightFoilBorne(uint32_t);
Dannis_mbed 0:81b21910454e 85 void vVarHeightFoilAssist(uint32_t);
Dannis_mbed 0:81b21910454e 86 void vVarAOAFoilAssist(uint32_t);
Dannis_mbed 0:81b21910454e 87
Dannis_mbed 0:81b21910454e 88 // Other functions
Dannis_mbed 0:81b21910454e 89 void itoa( uint32_t , char *);
Dannis_mbed 0:81b21910454e 90 void cShowValue(VALUE_t);
Dannis_mbed 0:81b21910454e 91
Dannis_mbed 0:81b21910454e 92 };
Dannis_mbed 0:81b21910454e 93 #endif