Rev 482 | Rev 489 | 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 __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 -... | Line 5... | ||
- | 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 |
|
5 | #include "i2c.h" |
16 | |
6 | 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; |
|
Line -... | Line 33... | ||
- | 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 |
|
7 | #define NCMAG_PORT_EXTERN I2C0 |
40 | |
8 | #define NCMAG_PORT_INTERN I2C1 |
41 | extern u8 NCMAG_Init(void); |
- | 42 | extern void NCMAG_Update(u8); |
|
9 | 43 | extern u8 NCMAG_Present; |
|
- | 44 | extern u8 NCMAG_IsCalibrated; |
|
- | 45 | extern u8 I2C_CompassPort; |
|
- | 46 | extern u8 ExtCompassOrientation; |
|
- | 47 | ||
Line 10... | Line -... | ||
10 | extern u8 NCMAG_Present; |
- | |
11 | extern u8 NCMAG_IsCalibrated; |
48 | |
12 | extern u8 NCMAG_Orientation; |
49 | extern u8 *I2C_BufferPnt; |
13 | 50 | extern u8 *I2C_ErrorPnt; |
|
Line 14... | Line 51... | ||
14 | u8 NCMAG_Init(void); |
51 |