Subversion Repositories NaviCtrl

Rev

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

Rev 472 Rev 473
Line 4... Line 4...
4
#include "compass.h" 
4
#include "compass.h" 
5
#include "i2c1.h"
5
#include "i2c1.h"
Line 6... Line 6...
6
 
6
 
7
extern s16vec_t ACC_Vector;
7
extern s16vec_t ACC_Vector;
-
 
8
extern volatile s16vec_t MagRawVector;
-
 
9
extern volatile s16vec_t AccRawVector;
-
 
10
 
-
 
11
#define EEPROM_ADR_MAG_CALIBRATION_INTERN       50      // two calibrtion sets for extern and intern sensor
-
 
12
#define EEPROM_ADR_MAG_CALIBRATION_EXTERN   70
-
 
13
 
-
 
14
#define CALIBRATION_VERSION                     1
-
 
15
#define MAG_CALIBRATION_COMPATIBLE              0xA2
-
 
16
 
-
 
17
#define NCMAG_MIN_RAWVALUE -2047
-
 
18
#define NCMAG_MAX_RAWVALUE  2047
-
 
19
#define NCMAG_INVALID_DATA -4096
-
 
20
 
-
 
21
typedef struct
-
 
22
{
-
 
23
        s16 Range;
-
 
24
        s16 Offset;
-
 
25
} __attribute__((packed)) Scaling_t;
-
 
26
 
-
 
27
typedef struct
-
 
28
{
-
 
29
        Scaling_t MagX;
-
 
30
        Scaling_t MagY;
-
 
31
        Scaling_t MagZ;
-
 
32
        u8 Version;
-
 
33
        u8 crc;
-
 
34
} __attribute__((packed)) Calibration_t;
-
 
35
 
Line 8... Line 36...
8
extern volatile s16vec_t MagRawVector;
36
extern Calibration_t Calibration;               // calibration data in RAM 
9
 
37
 
Line 10... Line 38...
10
#define I2C_EXTERN_0    0
38
#define I2C_EXTERN_0    0
11
#define I2C_INTERN_1    1
39
#define I2C_INTERN_1    1
12
 
40
 
13
u8 NCMAG_Init(void);
41
u8 NCMAG_Init(void);
14
void NCMAG_Update(void);
42
void NCMAG_Update(void);
-
 
43
extern u8 NCMAG_Present;
-
 
44
extern u8 NCMAG_IsCalibrated;
Line 15... Line 45...
15
extern u8 NCMAG_Present;
45
extern u8 I2C_CompassPort;
16
extern u8 NCMAG_IsCalibrated;
46
extern u8 ExtCompassOrientation;
Line 17... Line 47...
17
extern u8 I2C_CompassPort;
47