Rev 473 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
253 | killagreg | 1 | #ifndef __NCMAG_H |
2 | #define __NCMAG_H |
||
242 | killagreg | 3 | |
253 | killagreg | 4 | #include "compass.h" |
470 | killagreg | 5 | #include "i2c1.h" |
253 | killagreg | 6 | |
7 | extern s16vec_t ACC_Vector; |
||
339 | holgerb | 8 | extern volatile s16vec_t MagRawVector; |
473 | holgerb | 9 | extern volatile s16vec_t AccRawVector; |
243 | killagreg | 10 | |
473 | holgerb | 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 | |||
36 | extern Calibration_t Calibration; // calibration data in RAM |
||
37 | |||
472 | holgerb | 38 | #define I2C_EXTERN_0 0 |
39 | #define I2C_INTERN_1 1 |
||
40 | |||
480 | holgerb | 41 | extern u8 NCMAG_Init(void); |
42 | extern void NCMAG_Update(u8); |
||
426 | holgerb | 43 | extern u8 NCMAG_Present; |
44 | extern u8 NCMAG_IsCalibrated; |
||
472 | holgerb | 45 | extern u8 I2C_CompassPort; |
473 | holgerb | 46 | extern u8 ExtCompassOrientation; |
242 | killagreg | 47 | |
473 | holgerb | 48 | |
465 | ingob | 49 | extern u8 *I2C_BufferPnt; |
50 | extern u8 *I2C_ErrorPnt; |
||
51 | |||
52 | typedef u8 (*I2C_TransmissionFunc_t) (u8 SlaveAddr, u8 TxBytes, I2C_pRxHandler_t pRxHandler, u8 RxBytes); |
||
53 | typedef u8 (*I2C_LockBufferFunc_t) (u32 timeout); |
||
54 | typedef u8 (*I2C_WaitForEndOfTransmissionFunc_t) (u32 timeout); |
||
55 | |||
253 | killagreg | 56 | #endif // __NCMAG_H |
242 | killagreg | 57 |