Rev 342 | Rev 483 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 342 | Rev 482 | ||
---|---|---|---|
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 apstract 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 22... | Line 26... | ||
22 | 26 | ||
23 | #define COMPASS_NONE 0 |
27 | #define COMPASS_NONE 0 |
24 | #define COMPASS_MK3MAG 1 |
28 | #define COMPASS_MK3MAG 1 |
25 | #define COMPASS_NCMAG 2 |
29 | #define COMPASS_NCMAG 2 |
- | 30 | extern u8 Compass_Device; |
|
Line 26... | Line 31... | ||
26 | extern u8 Compass_Device; |
31 | extern I2C_TypeDef* Compass_I2CPort; |
- | 32 | ||
27 | 33 | void Compass_Init(void); // initialization for compass sensor |
|
28 | void Compass_Init(void); |
34 | void Compass_Check(void); // possible check for compass plausibility, called when FC gets calibrates |
29 | void Compass_Update(void); |
35 | void Compass_Update(void); // updates sensor values, cyclic called |
30 | void Compass_CalcHeading(void); |
36 | void Compass_CalcHeading(void); // calculates heading from magent vector componentes |
Line 31... | Line 37... | ||
31 | void Compass_SetCalState(u8 CalState); |
37 | void Compass_SetCalState(u8 CalState); // append to CalState queue |