0,0 → 1,57 |
#ifndef __NCMAG_H |
#define __NCMAG_H |
|
#include "compass.h" |
#include "i2c1.h" |
|
extern s16vec_t ACC_Vector; |
extern volatile s16vec_t MagRawVector; |
extern volatile s16vec_t AccRawVector; |
|
#define EEPROM_ADR_MAG_CALIBRATION_INTERN 50 // two calibrtion sets for extern and intern sensor |
#define EEPROM_ADR_MAG_CALIBRATION_EXTERN 70 |
|
#define CALIBRATION_VERSION 1 |
#define MAG_CALIBRATION_COMPATIBLE 0xA2 |
|
#define NCMAG_MIN_RAWVALUE -2047 |
#define NCMAG_MAX_RAWVALUE 2047 |
#define NCMAG_INVALID_DATA -4096 |
|
typedef struct |
{ |
s16 Range; |
s16 Offset; |
} __attribute__((packed)) Scaling_t; |
|
typedef struct |
{ |
Scaling_t MagX; |
Scaling_t MagY; |
Scaling_t MagZ; |
u8 Version; |
u8 crc; |
} __attribute__((packed)) Calibration_t; |
|
extern Calibration_t Calibration; // calibration data in RAM |
|
#define I2C_EXTERN_0 0 |
#define I2C_INTERN_1 1 |
|
extern u8 NCMAG_Init(void); |
extern void NCMAG_Update(u8); |
extern u8 NCMAG_Present; |
extern u8 NCMAG_IsCalibrated; |
extern u8 I2C_CompassPort; |
extern u8 ExtCompassOrientation; |
|
|
extern u8 *I2C_BufferPnt; |
extern u8 *I2C_ErrorPnt; |
|
typedef u8 (*I2C_TransmissionFunc_t) (u8 SlaveAddr, u8 TxBytes, I2C_pRxHandler_t pRxHandler, u8 RxBytes); |
typedef u8 (*I2C_LockBufferFunc_t) (u32 timeout); |
typedef u8 (*I2C_WaitForEndOfTransmissionFunc_t) (u32 timeout); |
|
#endif // __NCMAG_H |
|