39#ifdef PREINIT_SUPPORTED
43#ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
49#include "drv_digital_out.h"
50#include "drv_digital_in.h"
51#include "drv_i2c_master.h"
73#define MAGNETO11_REG_DATA_LSB 0x00
74#define MAGNETO11_REG_DATA_MSB 0x01
75#define MAGNETO11_REG_CONFIG 0x02
76#define MAGNETO11_REG_OFFSET_LSB 0x03
77#define MAGNETO11_REG_OFFSET_MSB 0x04
78#define MAGNETO11_REG_SENSITIVITY 0x0B
96#define MAGNETO11_DATA_RESOLUTION 0x03FF
97#define MAGNETO11_DATA_OCF_MASK 0x0800
98#define MAGNETO11_DATA_PARITY_MASK 0x0400
104#define MAGNETO11_SENSITIVITY_RES_50mT 0x00
105#define MAGNETO11_SENSITIVITY_RES_25mT 0x01
106#define MAGNETO11_SENSITIVITY_RES_12p5mT 0x02
107#define MAGNETO11_SENSITIVITY_RES_18p75mT 0x03
108#define MAGNETO11_SENSITIVITY_RES_MASK 0x03
109#define MAGNETO11_SENSITIVITY_LSB_50mT 0.09766
110#define MAGNETO11_SENSITIVITY_LSB_25mT 0.04883
111#define MAGNETO11_SENSITIVITY_LSB_12p5mT 0.02441
112#define MAGNETO11_SENSITIVITY_LSB_18p75mT 0.03662
118#define MAGNETO11_CONFIG_SPEED_FAST 0x00
119#define MAGNETO11_CONFIG_SPEED_SLOW 0x04
120#define MAGNETO11_CONFIG_POLARITY_NORMAL 0x00
121#define MAGNETO11_CONFIG_POLARITY_REVERSED 0x02
122#define MAGNETO11_CONFIG_OP_NORMAL 0x00
123#define MAGNETO11_CONFIG_OP_POWER_DOWN 0x01
130#define MAGNETO11_DEV_ADDR_GND 0x56
131#define MAGNETO11_DEV_ADDR_VCC 0x57
149#define MAGNETO11_MAP_MIKROBUS( cfg, mikrobus ) \
150 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
151 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA );
err_t magneto11_set_config(magneto11_t *ctx, uint8_t config)
Magneto 11 set config function.
err_t magneto11_init(magneto11_t *ctx, magneto11_cfg_t *cfg)
Magneto 11 initialization function.
err_t magneto11_default_cfg(magneto11_t *ctx)
Magneto 11 default configuration function.
err_t magneto11_generic_read(magneto11_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len)
Magneto 11 I2C reading function.
void magneto11_cfg_setup(magneto11_cfg_t *cfg)
Magneto 11 configuration object setup function.
err_t magneto11_get_offset(magneto11_t *ctx, uint16_t *offset)
Magneto 11 get offset function.
err_t magneto11_get_magnetic_field(magneto11_t *ctx, float *mag_field)
Magneto 11 get magnetic field function.
err_t magneto11_generic_write(magneto11_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len)
Magneto 11 I2C writing function.
err_t magneto11_set_sensitivity(magneto11_t *ctx, uint8_t sensitivity)
Magneto 11 set sensitivity function.
magneto11_return_value_t
Magneto 11 Click return value data.
Definition magneto11.h:189
@ MAGNETO11_OK
Definition magneto11.h:190
@ MAGNETO11_ERROR
Definition magneto11.h:191
Magneto 11 Click configuration object.
Definition magneto11.h:175
uint32_t i2c_speed
Definition magneto11.h:179
pin_name_t scl
Definition magneto11.h:176
pin_name_t sda
Definition magneto11.h:177
uint8_t i2c_address
Definition magneto11.h:180
Magneto 11 Click context object.
Definition magneto11.h:161
i2c_master_t i2c
Definition magneto11.h:163
uint8_t slave_address
Definition magneto11.h:166