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"
78#define COMPASS5_DEVICE_ID_NUM 0X0C
79#define COMPASS5_COMPANI_ID_NUM 0X48
80#define COMPASS5_COMPANI_ID 0x00
81#define COMPASS5_DEVICE_ID 0x01
87#define COMPASS5_DATA_STATUS_1 0x10
93#define COMPASS5_X_AXIS_DATA_L 0x11
94#define COMPASS5_X_AXIS_DATA_H 0x12
95#define COMPASS5_Y_AXIS_DATA_L 0x13
96#define COMPASS5_Y_AXIS_DATA_H 0x14
97#define COMPASS5_Z_AXIS_DATA_L 0x15
98#define COMPASS5_Z_AXIS_DATA_H 0x16
104#define COMPASS5_DUMMY_TMPS 0x17
105#define COMPASS5_DATA_STATUS_2 0x18
111#define COMPASS5_DUMMY_CNTL1 0x30
112#define COMPASS5_CONTROL_2_SETTINGS 0x31
113#define COMPASS5_CONTROL_3_SETTINGS 0x32
114#define COMPASS5_TEST_TS1 0x33
115#define COMPASS5_TEST_TS2 0x34
133#define COMPASS5_MODE_POWER_DOWN 0x00
134#define COMPASS5_MODE_SINGLE_MEASUREMENT 0x01
135#define COMPASS5_MODE_CON_MEASUREMENT_10HZ 0x02
136#define COMPASS5_MODE_CON_MEASUREMENT_20HZ 0x04
137#define COMPASS5_MODE_CON_MEASUREMENT_50HZ 0x06
138#define COMPASS5_MODE_CON_MEASUREMENT_100HZ 0x08
139#define COMPASS5_MODE_SELF_TEST 0x10
145#define COMPASS5_SRST_BIT 0x01
146#define COMPASS5_HOFL_BIT 0x08
147#define COMPASS5_DOR_BIT 0x02
148#define COMPASS5_DRDY_BIT 0x01
154#define COMPASS5_DATA_NO_READY 0x00
155#define COMPASS5_DATA_READY 0x01
161#define COMPASS5_BIT_MASK_BIT0 0x01
168#define COMPASS5_SET_DEV_ADDR 0x0C
186#define COMPASS5_MAP_MIKROBUS( cfg, mikrobus ) \
187 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
188 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
compass5_return_value_t
Compass 5 Click return value data.
Definition compass5.h:226
@ COMPASS5_ERROR
Definition compass5.h:228
@ COMPASS5_OK
Definition compass5.h:227
err_t compass5_generic_read(compass5_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len)
Compass 5 I2C reading function.
uint8_t compass5_read_byte(compass5_t *ctx, uint8_t reg)
Compass 5 read 1 byte function.
uint8_t compass5_check_data_overrun(compass5_t *ctx)
Compass 5 check data overrun function.
err_t compass5_generic_write(compass5_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len)
Compass 5 I2C writing function.
void compass5_sw_reset(compass5_t *ctx)
Compass 5 software reset function.
uint8_t compass5_get_operation_mode(compass5_t *ctx)
Compass 5 get operation mode function.
void compass5_get_id(compass5_t *ctx, uint8_t *company_id, uint8_t *device_id)
Compass 5 get ID function.
void compass5_write_byte(compass5_t *ctx, uint8_t reg, uint8_t tx_data)
Compass 5 write byte function.
void compass5_get_mag_data(compass5_t *ctx, int16_t *axis_x, int16_t *axis_y, int16_t *axis_z)
Compass 5 full measurement axis function.
void compass5_cfg_setup(compass5_cfg_t *cfg)
Compass 5 configuration object setup function.
void compass5_measurement_axis(compass5_t *ctx, int16_t *axis_x, int16_t *axis_y, int16_t *axis_z)
Compass 5 full measurement axis function.
uint8_t compass5_check_data_ready(compass5_t *ctx)
Compass 5 check data ready function.
uint8_t compass5_set_operation_mode(compass5_t *ctx, uint8_t op_mode)
Compass 5 set operation mode function.
err_t compass5_init(compass5_t *ctx, compass5_cfg_t *cfg)
Compass 5 initialization function.
uint8_t company_id
Definition main.c:29
uint8_t device_id
Definition main.c:28
Compass 5 Click configuration object.
Definition compass5.h:212
uint32_t i2c_speed
Definition compass5.h:216
pin_name_t scl
Definition compass5.h:213
pin_name_t sda
Definition compass5.h:214
uint8_t i2c_address
Definition compass5.h:217
Compass 5 Click context object.
Definition compass5.h:198
i2c_master_t i2c
Definition compass5.h:200
uint8_t slave_address
Definition compass5.h:203