Rev 493 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
242 | killagreg | 1 | #ifndef _COMPASS_H |
2 | #define _COMPASS_H |
||
3 | |||
489 | killagreg | 4 | // this is the abstract interface for the magnetometer/compass sensor |
5 | // below this there are different special sensors that are supported |
||
6 | |||
242 | killagreg | 7 | typedef struct |
8 | { |
||
9 | s16 X; |
||
10 | s16 Y; |
||
11 | s16 Z; |
||
253 | killagreg | 12 | } __attribute__((packed)) s16vec_t; |
242 | killagreg | 13 | |
254 | killagreg | 14 | extern volatile s16vec_t MagVector; // current magnetic field vector |
489 | killagreg | 15 | extern volatile s16vec_t AccVector; // current acceleration vector of compass, not supported by any HW version |
493 | killagreg | 16 | extern volatile s16vec_t MagVectorHorizontal; // vector componenents in horizontal projection |
254 | killagreg | 17 | extern volatile s16 Compass_Heading; // current heading direction |
18 | extern volatile u8 Compass_CalState; // current calibration state |
||
330 | holgerb | 19 | extern s32 EarthMagneticField; |
493 | killagreg | 20 | extern s32 EarthMagneticFieldFiltered; |
330 | holgerb | 21 | extern s32 EarthMagneticInclination; |
340 | holgerb | 22 | extern s32 EarthMagneticInclinationFiltered; |
338 | holgerb | 23 | extern s32 EarthMagneticInclinationTheoretic; |
330 | holgerb | 24 | extern u8 ErrorDisturbedEarthMagnetField; |
342 | holgerb | 25 | extern s16 EarthMagneticStrengthTheoretic; |
242 | killagreg | 26 | |
254 | killagreg | 27 | #define COMPASS_NONE 0 |
28 | #define COMPASS_MK3MAG 1 |
||
29 | #define COMPASS_NCMAG 2 |
||
30 | extern u8 Compass_Device; |
||
489 | killagreg | 31 | extern I2C_TypeDef* Compass_I2CPort; |
32 | extern u32 CompassValueErrorCount; |
||
254 | killagreg | 33 | |
489 | killagreg | 34 | void Compass_Init(void); // initialization for compass sensor |
35 | void Compass_Check(void); // possible check for compass plausibility, called when FC gets calibrates |
||
36 | void Compass_Update(void); // updates sensor values, cyclic called |
||
37 | void Compass_CalcHeading(void); // calculates heading from magent vector componentes |
||
38 | void Compass_SetCalState(u8 CalState); // append to CalState queue |
||
39 | void Compass_UpdateCalState(void); // process CalState queue |
||
242 | killagreg | 40 | |
41 | #endif // _COMPASS_H |