Rev 483 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 483 | Rev 489 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | #ifndef __NCMAG_H |
1 | #ifndef __NCMAG_H |
2 | #define __NCMAG_H |
2 | #define __NCMAG_H |
Line 3... | Line 3... | ||
3 | 3 | ||
4 | #include "compass.h" |
4 | #include "compass.h" |
Line 5... | Line -... | ||
5 | #include "i2c1.h" |
- | |
6 | - | ||
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 | 5 | #include "i2c.h" |
|
17 | #define NCMAG_MIN_RAWVALUE -2047 |
6 | |
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; |
- | |
Line 33... | Line -... | ||
33 | u8 crc; |
- | |
34 | } __attribute__((packed)) Calibration_t; |
- | |
35 | - | ||
36 | extern Calibration_t Calibration; // calibration data in RAM |
- | |
37 | - | ||
38 | #define I2C_EXTERN_0 0 |
- | |
39 | #define I2C_INTERN_1 1 |
- | |
40 | 7 | #define NCMAG_PORT_EXTERN I2C0 |
|
41 | extern u8 NCMAG_Init(void); |
8 | #define NCMAG_PORT_INTERN I2C1 |
42 | extern void NCMAG_Update(u8); |
- | |
43 | extern u8 NCMAG_Present; |
9 | |
44 | extern u8 NCMAG_IsCalibrated; |
- | |
45 | extern u8 I2C_CompassPort; |
- | |
46 | extern u8 ExtCompassOrientation; |
- | |
47 | - | ||
Line -... | Line 10... | ||
- | 10 | extern u8 NCMAG_Present; |
|
48 | 11 | extern u8 NCMAG_IsCalibrated; |
|
49 | extern u8 *I2C_BufferPnt; |
12 | extern u8 NCMAG_Orientation; |
50 | extern u8 *I2C_ErrorPnt; |
13 | |
Line 51... | Line 14... | ||
51 | 14 | u8 NCMAG_Init(void); |