45 lines
972 B
C
45 lines
972 B
C
#ifndef __COMPASS_RM3100_H__
|
|
#define __COMPASS_RM3100_H__
|
|
|
|
#include "SPIDevice.h"
|
|
#include "GPIO_EXTI.h"
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
|
|
#ifndef HAL_COMPASS_RM3100_I2C_ADDR
|
|
# define HAL_COMPASS_RM3100_I2C_ADDR1 0x20
|
|
# define HAL_COMPASS_RM3100_I2C_ADDR2 0x21
|
|
# define HAL_COMPASS_RM3100_I2C_ADDR3 0x22
|
|
# define HAL_COMPASS_RM3100_I2C_ADDR4 0x23
|
|
#endif
|
|
|
|
typedef struct {
|
|
SPI_DEV_t *dev;
|
|
GPIO_EXIT_t *drdy;
|
|
const char *name;
|
|
bool success;
|
|
float _scaler;
|
|
|
|
int good_pps;
|
|
int good_cnt;
|
|
int bad_pps;
|
|
int bad_cnt;
|
|
int nrdy_pps;
|
|
int nrdy_cnt;
|
|
|
|
float magx;
|
|
float magy;
|
|
float magz;
|
|
uint8_t seq;
|
|
} Compass_RM3100_t;
|
|
|
|
bool Compass_RM3100_init(Compass_RM3100_t *cps, const char *name, SPI_DEV_t *dev, GPIO_EXIT_t *drdy);
|
|
|
|
void Compass_RM3100_update(Compass_RM3100_t *cps);
|
|
|
|
void Compass_RM3100_monitor(Compass_RM3100_t *cps);
|
|
|
|
void Compass_RM3100_loop(Compass_RM3100_t *cps);
|
|
|
|
#endif /* __COMPASS_RM3100_H__ */
|