Rev 487 | Rev 493 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 487 | Rev 489 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | #ifndef _COMPASS_H |
1 | #ifndef _COMPASS_H |
2 | #define _COMPASS_H |
2 | #define _COMPASS_H |
Line -... | Line 3... | ||
- | 3 | ||
- | 4 | // this is the abstract interface for the magnetometer/compass sensor |
|
- | 5 | // below this there are different special sensors that are supported |
|
3 | 6 | ||
4 | typedef struct |
7 | typedef struct |
5 | { |
8 | { |
6 | s16 X; |
9 | s16 X; |
7 | s16 Y; |
10 | s16 Y; |
8 | s16 Z; |
11 | s16 Z; |
Line 9... | Line 12... | ||
9 | } __attribute__((packed)) s16vec_t; |
12 | } __attribute__((packed)) s16vec_t; |
- | 13 | ||
10 | 14 | extern volatile s16vec_t MagVector; // current magnetic field vector |
|
11 | extern volatile s16vec_t MagVector; // current magnetic field vector |
15 | extern volatile s16vec_t AccVector; // current acceleration vector of compass, not supported by any HW version |
12 | extern volatile s16 Compass_Heading; // current heading direction |
16 | extern volatile s16 Compass_Heading; // current heading direction |
13 | extern volatile u8 Compass_CalState; // current calibration state |
17 | extern volatile u8 Compass_CalState; // current calibration state |
14 | extern s32 EarthMagneticField; |
18 | extern s32 EarthMagneticField; |
Line 18... | Line 22... | ||
18 | extern s32 EarthMagneticFieldFiltered; |
22 | extern s32 EarthMagneticFieldFiltered; |
19 | extern u8 ErrorDisturbedEarthMagnetField; |
23 | extern u8 ErrorDisturbedEarthMagnetField; |
20 | extern s16 EarthMagneticStrengthTheoretic; |
24 | extern s16 EarthMagneticStrengthTheoretic; |
21 | extern s16 Hx, Hy; |
25 | extern s16 Hx, Hy; |
Line 22... | Line -... | ||
22 | - | ||
23 | extern u32 CompassValueErrorCount; |
- | |
24 | 26 | ||
25 | #define COMPASS_NONE 0 |
27 | #define COMPASS_NONE 0 |
26 | #define COMPASS_MK3MAG 1 |
28 | #define COMPASS_MK3MAG 1 |
27 | #define COMPASS_NCMAG 2 |
29 | #define COMPASS_NCMAG 2 |
- | 30 | extern u8 Compass_Device; |
|
- | 31 | extern I2C_TypeDef* Compass_I2CPort; |
|
Line 28... | Line 32... | ||
28 | extern u8 Compass_Device; |
32 | extern u32 CompassValueErrorCount; |
- | 33 | ||
29 | 34 | void Compass_Init(void); // initialization for compass sensor |
|
30 | void Compass_Init(void); |
35 | void Compass_Check(void); // possible check for compass plausibility, called when FC gets calibrates |
31 | void Compass_Update(void); |
36 | void Compass_Update(void); // updates sensor values, cyclic called |
32 | void Compass_CalcHeading(void); |
37 | void Compass_CalcHeading(void); // calculates heading from magent vector componentes |
Line 33... | Line 38... | ||
33 | void Compass_SetCalState(u8 CalState); |
38 | void Compass_SetCalState(u8 CalState); // append to CalState queue |