Go to the documentation of this file.
38 #include "drv_digital_out.h"
39 #include "drv_i2c_master.h"
52 #define MAGNETO5_MAP_MIKROBUS( cfg, mikrobus ) \
53 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
54 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
61 #define MAGNETO5_RETVAL uint8_t
63 #define MAGNETO5_OK 0x00
64 #define MAGNETO5_INIT_ERROR 0xFF
71 #define MAGNETO5_REG_X_OUT_LOW 0x00
72 #define MAGNETO5_REG_X_OUT_HIGH 0x01
73 #define MAGNETO5_REG_Y_OUT_LOW 0x02
74 #define MAGNETO5_REG_Y_OUT_HIGH 0x03
75 #define MAGNETO5_REG_Z_OUT_LOW 0x04
76 #define MAGNETO5_REG_Z_OUT_HIGH 0x05
77 #define MAGNETO5_REG_STATUS 0x06
78 #define MAGNETO5_REG_INTERNAL_CONTROL_0 0x07
79 #define MAGNETO5_REG_INTERNAL_CONTROL_1 0x08
80 #define MAGNETO5_REG_PRODUCT_ID 0x20
87 #define MAGNETO_STATUS_MEASUREMENT_DONE 0x01
88 #define MAGNETO_STATUS_PUMP_ON 0x02
89 #define MAGNETO_STATUS_READ_DONE 0x04
90 #define MAGNETO_STATUS_SELFTEST_OK 0x08
91 #define MAGNETO5_ERROR 0x00
92 #define MAGNETO5_PRODUCT_ID 0x06
99 #define MAGNETO5_AXIS_X 0x00
100 #define MAGNETO5_AXIS_Y 0x02
101 #define MAGNETO5_AXIS_Z 0x04
108 #define MAGNETO5_CR0_RESET 0x40
109 #define MAGNETO5_CR0_SET 0x20
110 #define MAGNETO5_CR0_REFILL_CAP 0x80
111 #define MAGNETO5_CR0_NO_BOOST 0x10
112 #define MAGNETO5_CR0_MEASUREMENT_MODE_0 0x00
113 #define MAGNETO5_CR0_MEASUREMENT_MODE_1 0x04
114 #define MAGNETO5_CR0_MEASUREMENT_MODE_2 0x08
115 #define MAGNETO5_CR0_MEASUREMENT_MODE_3 0x0C
116 #define MAGNETO5_CR0_CONTINUOUS_MODE 0x02
117 #define MAGNETO5_CR0_TAKE_MEASUREMENT 0x01
124 #define MAGNETO5_CR1_SOFT_RESET 0x80
125 #define MAGNETO5_CR1_TEMP_TEST 0x40
126 #define MAGNETO5_CR1_SELFTEST_XYZ 0x20
127 #define MAGNETO5_CR1_FACTORY_USE_X 0x10
128 #define MAGNETO5_CR1_FACTORY_USE_Y 0x08
129 #define MAGNETO5_CR1_FACTORY_USE_Z 0x04
130 #define MAGNETO5_CH0_16bits_8ms 0x00
131 #define MAGNETO5_CH1_16bits_4ms 0x01
132 #define MAGNETO5_CH2_14bits_2ms 0x02
133 #define MAGNETO5_CH3_12bits_1ms 0x03
334 #endif // _MAGNETO5_H_
uint8_t slave_address
Definition: magneto5.h:155
Click ctx object definition.
Definition: magneto5.h:147
uint8_t magneto5_get_product_id(magneto5_t *ctx)
Functions reads product ID from register.
void magneto5_config_register_1(magneto5_t *ctx, uint8_t config_data)
Functions sets configuration register 1.
uint32_t i2c_speed
Definition: magneto5.h:174
pin_name_t sda
Definition: magneto5.h:170
i2c_master_t i2c
Definition: magneto5.h:151
void magneto5_get_axis_data(magneto5_t *ctx, int16_t *axis_buffer, uint8_t max_resolution)
Functions reads axis data.
uint8_t magneto5_set_status_reg(magneto5_t *ctx)
Functions reads status register.
void magneto5_reset(magneto5_t *ctx)
Functions for reset data.
void magneto5_generic_read(magneto5_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic read function.
pin_name_t scl
Definition: magneto5.h:169
void magneto5_default_cfg(magneto5_t *ctx)
Click Default Configuration function.
uint8_t i2c_address
Definition: magneto5.h:175
Click configuration structure definition.
Definition: magneto5.h:166
float max_resolution
Definition: magneto5.h:157
void magneto5_generic_write(magneto5_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic write function.
void magneto5_cfg_setup(magneto5_cfg_t *cfg)
Config Object Initialization function.
#define MAGNETO5_RETVAL
Definition: magneto5.h:61
uint8_t data_flag
Definition: magneto5.h:158
MAGNETO5_RETVAL magneto5_init(magneto5_t *ctx, magneto5_cfg_t *cfg)
Initialization function.
void magneto5_config_register_0(magneto5_t *ctx, uint8_t config_data)
Functions sets configuration register 0.
float magneto5_get_axis_value(magneto5_t *ctx, uint8_t axis, uint8_t max_resolution)
Functions reads axis data value.