Subversion Repositories NaviCtrl

Rev

Rev 482 | Rev 487 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 482 Rev 483
Line 1... Line 1...
1
#ifndef _COMPASS_H
1
#ifndef _COMPASS_H
2
#define _COMPASS_H
2
#define _COMPASS_H
Line 3... Line -...
3
 
-
 
4
// this is the apstract interface for the magnetometer/compass sensor
-
 
5
// below this there are different special sensors that are supported
-
 
6
 
3
 
7
typedef struct
4
typedef struct
8
{
5
{
9
  s16 X;
6
  s16 X;
10
  s16 Y;
7
  s16 Y;
11
  s16 Z;
8
  s16 Z;
Line 12... Line 9...
12
} __attribute__((packed)) s16vec_t;
9
} __attribute__((packed)) s16vec_t;
13
 
-
 
14
extern volatile s16vec_t MagVector;       // current magnetic field vector
10
 
15
extern volatile s16vec_t AccVector;       // current acceleration vector of compass, not supported by any HW version
11
extern volatile s16vec_t MagVector;       // current magnetic field vector
16
extern volatile s16 Compass_Heading;  // current heading direction
12
extern volatile s16 Compass_Heading;  // current heading direction
17
extern volatile u8  Compass_CalState; // current calibration state
13
extern volatile u8  Compass_CalState; // current calibration state
18
extern s32 EarthMagneticField;
14
extern s32 EarthMagneticField;
Line 26... Line 22...
26
 
22
 
27
#define COMPASS_NONE    0
23
#define COMPASS_NONE    0
28
#define COMPASS_MK3MAG  1
24
#define COMPASS_MK3MAG  1
29
#define COMPASS_NCMAG   2
25
#define COMPASS_NCMAG   2
30
extern u8 Compass_Device;
-
 
Line 31... Line 26...
31
extern I2C_TypeDef* Compass_I2CPort;
26
extern u8 Compass_Device;
32
 
-
 
33
void Compass_Init(void);        // initialization for compass sensor
27
 
34
void Compass_Check(void);       // possible check for compass plausibility, called when FC gets calibrates
28
void Compass_Init(void);
35
void Compass_Update(void);      // updates sensor values, cyclic called
29
void Compass_Update(void);
36
void Compass_CalcHeading(void); // calculates heading from magent vector componentes
30
void Compass_CalcHeading(void);
Line 37... Line 31...
37
void Compass_SetCalState(u8 CalState);  // append to CalState queue
31
void Compass_SetCalState(u8 CalState);