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 COMPASS6_REG_SELFTEST_RSP 0x0C
74#define COMPASS6_REG_INFO_VERSION 0x0D
75#define COMPASS6_REG_INFO_ALPS 0x0E
76#define COMPASS6_REG_WHO_I_AM 0x0F
77#define COMPASS6_REG_OUTPUT_X_LSB 0x10
78#define COMPASS6_REG_OUTPUT_X_MSB 0x11
79#define COMPASS6_REG_OUTPUT_Y_LSB 0x12
80#define COMPASS6_REG_OUTPUT_Y_MSB 0x13
81#define COMPASS6_REG_OUTPUT_Z_LSB 0x14
82#define COMPASS6_REG_OUTPUT_Z_MSB 0x15
83#define COMPASS6_REG_STATUS 0x18
84#define COMPASS6_REG_FIFO_PTR_STATUS 0x19
85#define COMPASS6_REG_CTRL1 0x1B
86#define COMPASS6_REG_CTRL2 0x1C
87#define COMPASS6_REG_CTRL3 0x1D
88#define COMPASS6_REG_CTRL4 0x1E
89#define COMPASS6_REG_OFFSET_X_LSB 0x20
90#define COMPASS6_REG_OFFSET_X_MSB 0x21
91#define COMPASS6_REG_OFFSET_Y_LSB 0x22
92#define COMPASS6_REG_OFFSET_Y_MSB 0x23
93#define COMPASS6_REG_OFFSET_Z_LSB 0x24
94#define COMPASS6_REG_OFFSET_Z_MSB 0x25
95#define COMPASS6_REG_THR_L 0x26
96#define COMPASS6_REG_THR_H 0x27
97#define COMPASS6_REG_TEMPERATURE_VAL 0x31
115#define COMPASS6_WHO_AM_I 0x49
116#define COMPASS6_VERSION 0x11
117#define COMPASS6_ALPS 0x15
124#define COMPASS6_SET_DEV_ADDR 0x0C
142#define COMPASS6_MAP_MIKROBUS( cfg, mikrobus ) \
143 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
144 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
145 cfg.rdy = MIKROBUS( mikrobus, MIKROBUS_INT )
compass6_return_value_t
Compass 6 Click return value data.
Definition compass6.h:188
@ COMPASS6_ERROR
Definition compass6.h:190
@ COMPASS6_OK
Definition compass6.h:189
err_t compass6_generic_write(compass6_t *ctx, uint8_t reg, uint8_t tx_data)
Compass 6 I2C writing function.
err_t compass6_get_axes_data(compass6_t *ctx, compass6_axes_t *axes_data)
Magnetic axes data reading.
err_t compass6_init(compass6_t *ctx, compass6_cfg_t *cfg)
Compass 6 initialization function.
err_t compass6_generic_read(compass6_t *ctx, uint8_t reg, uint8_t *rx_data)
Compass 6 I2C reading function.
err_t compass6_default_cfg(compass6_t *ctx)
Compass 6 default configuration function.
uint8_t compass6_data_ready(compass6_t *ctx)
Get data ready pin state.
void compass6_cfg_setup(compass6_cfg_t *cfg)
Compass 6 configuration object setup function.
Compass 6 Click axes data.
Definition compass6.h:199
int16_t z
Definition compass6.h:202
int16_t x
Definition compass6.h:200
int16_t y
Definition compass6.h:201
Compass 6 Click configuration object.
Definition compass6.h:172
uint32_t i2c_speed
Definition compass6.h:178
pin_name_t scl
Definition compass6.h:173
pin_name_t rdy
Definition compass6.h:176
pin_name_t sda
Definition compass6.h:174
uint8_t i2c_address
Definition compass6.h:179
Compass 6 Click context object.
Definition compass6.h:155
i2c_master_t i2c
Definition compass6.h:160
uint8_t slave_address
Definition compass6.h:163
digital_in_t rdy
Definition compass6.h:157