38#include "drv_digital_in.h"
39#include "drv_i2c_master.h"
51#define MAGNETO7_MAP_MIKROBUS( cfg, mikrobus ) \
52 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
53 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
54 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT );
61#define MAGNETO7_RETVAL uint8_t
63#define MAGNETO7_OK 0x00
64#define MAGNETO7_INIT_ERROR 0xFF
71#define MAGNETO7_DEV_ADDR_L 0x0E
72#define MAGNETO7_DEV_ADDR_H 0x0F
79#define MAGNETO7_INFO_L 0x0D
80#define MAGNETO7_INFO_H 0x0E
81#define MAGNETO7_WIA 0x0F
82#define MAGNETO7_DATA_X_L 0x10
83#define MAGNETO7_DATA_X_H 0x11
84#define MAGNETO7_DATA_Y_L 0x12
85#define MAGNETO7_DATA_Y_H 0x13
86#define MAGNETO7_DATA_Z_L 0x14
87#define MAGNETO7_DATA_Z_H 0x15
88#define MAGNETO7_STA1 0x18
89#define MAGNETO7_CNTL_1 0x1B
90#define MAGNETO7_CNTL_2 0x1C
91#define MAGNETO7_CNTL_3 0x1D
92#define MAGNETO7_AVE_A 0x40
93#define MAGNETO7_CNTL_4_L 0x5C
94#define MAGNETO7_CNTL_4_H 0x5D
95#define MAGNETO7_TEMP_L 0x60
96#define MAGNETO7_TEMP_H 0x61
97#define MAGNETO7_OFF_X_L 0x6C
98#define MAGNETO7_OFF_X_H 0x6D
99#define MAGNETO7_OFF_Y_L 0x72
100#define MAGNETO7_OFF_Y_H 0x73
101#define MAGNETO7_OFF_Z_L 0x78
102#define MAGNETO7_OFF_Z_H 0x79
103#define MAGNETO7_FINEOUTPUTX_L 0x90
104#define MAGNETO7_FINEOUTPUTX_H 0x91
105#define MAGNETO7_FINEOUTPUTY_L 0x92
106#define MAGNETO7_FINEOUTPUTY_H 0x93
107#define MAGNETO7_FINEOUTPUTZ_L 0x94
108#define MAGNETO7_FINEOUTPUTZ_H 0x95
109#define MAGNETO7_GAIN_PARA_X_L 0x9C
110#define MAGNETO7_GAIN_PARA_X_H 0x9D
111#define MAGNETO7_GAIN_PARA_Y_L 0x9E
112#define MAGNETO7_GAIN_PARA_Y_H 0x9F
113#define MAGNETO7_GAIN_PARA_Z_L 0xA0
114#define MAGNETO7_GAIN_PARA_Z_H 0xA1
121#define MAGNETO7_X_AXIS 0x00
122#define MAGNETO7_Y_AXIS 0x01
123#define MAGNETO7_Z_AXIS 0x02
130#define MAGNETO7_SENSOR_RES_12_BIT 0x00
131#define MAGNETO7_SENSOR_RES_14_BIT 0x01
#define MAGNETO7_RETVAL
Definition: magneto7.h:61
uint8_t magneto7_int_get(magneto7_t *ctx)
Getting INT pin state function.
float magneto7_convert_to_ut(magneto7_t *ctx, int16_t raw_data, uint8_t sensor_resolution)
Getting fine data function.
uint8_t magneto7_set_register(magneto7_t *ctx, uint8_t register_address, uint8_t *data_buffer, uint8_t n_data)
Setting register value(s) function.
MAGNETO7_RETVAL magneto7_init(magneto7_t *ctx, magneto7_cfg_t *cfg)
Initialization function.
void magneto7_get_data(magneto7_t *ctx, int16_t *x_axis, int16_t *y_axis, int16_t *z_axis)
Getting data function.
void magneto7_get_gain_para(magneto7_t *ctx, uint16_t *x_axis, uint16_t *y_axis, uint16_t *z_axis)
Getting gain data function.
void magneto7_generic_write(magneto7_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic write function.
uint8_t magneto7_set_offset(magneto7_t *ctx, uint8_t offset_axis, uint8_t offset_value)
Setting offset values function.
void magneto7_cfg_setup(magneto7_cfg_t *cfg)
Config Object Initialization function.
void magneto7_get_temperature(magneto7_t *ctx, uint16_t *device_temperature)
Getting raw device temperature value function.
void magneto7_get_fine_data(magneto7_t *ctx, uint16_t *x_axis, uint16_t *y_axis, uint16_t *z_axis)
Getting fine data function.
void magneto7_generic_read(magneto7_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic read function.
uint8_t magneto7_get_register(magneto7_t *ctx, uint8_t register_address, uint8_t *data_buffer, uint8_t n_data)
Getting register value(s) function.
uint8_t magneto7_default_cfg(magneto7_t *ctx)
Click Default Configuration function.
Click configuration structure definition.
Definition: magneto7.h:166
uint32_t i2c_speed
Definition: magneto7.h:178
pin_name_t scl
Definition: magneto7.h:169
pin_name_t int_pin
Definition: magneto7.h:174
pin_name_t sda
Definition: magneto7.h:170
uint8_t i2c_address
Definition: magneto7.h:179
Click ctx object definition.
Definition: magneto7.h:145
float sensor_res
Definition: magneto7.h:158
digital_in_t int_pin
Definition: magneto7.h:148
i2c_master_t i2c
Definition: magneto7.h:152
uint8_t slave_address
Definition: magneto7.h:156