32 lines
595 B
C
32 lines
595 B
C
#ifndef __MAG_HMC5883L__H__
|
|
#define __MAG_HMC5883L__H__
|
|
|
|
#include "I2CDevice.h"
|
|
#include "GPIO_EXTI.h"
|
|
|
|
// Registers
|
|
#ifndef HAL_MAG_HMC5883_I2C_ADDR
|
|
#define HAL_MAG_HMC5883_I2C_ADDR 0x1E
|
|
#endif
|
|
|
|
typedef struct Mag_HMC5883{
|
|
const char *name;
|
|
I2C_DEV_t *_dev;
|
|
int16_t magnet_xyz[3];
|
|
GPIO_EXIT_t *exti;
|
|
|
|
int cnt;
|
|
int last_cnt;
|
|
int pps;
|
|
} Mag_HMC5883_t;
|
|
|
|
|
|
|
|
extern int Mag_HMC5883_init(Mag_HMC5883_t *mag, const char *name, I2C_DEV_t *dev, GPIO_EXIT_t *exti);
|
|
|
|
extern bool Mag_HMC5883_update(Mag_HMC5883_t *mag);
|
|
|
|
extern void Mag_HMC5883_stats(Mag_HMC5883_t *mag);
|
|
|
|
#endif
|