Go to the documentation of this file.
35 #include "drv_digital_out.h"
36 #include "drv_digital_in.h"
37 #include "drv_i2c_master.h"
64 #define COMPASS5_DEVICE_ID_NUM 0X0C
65 #define COMPASS5_COMPANI_ID_NUM 0X48
66 #define COMPASS5_COMPANI_ID 0x00
67 #define COMPASS5_DEVICE_ID 0x01
73 #define COMPASS5_DATA_STATUS_1 0x10
79 #define COMPASS5_X_AXIS_DATA_L 0x11
80 #define COMPASS5_X_AXIS_DATA_H 0x12
81 #define COMPASS5_Y_AXIS_DATA_L 0x13
82 #define COMPASS5_Y_AXIS_DATA_H 0x14
83 #define COMPASS5_Z_AXIS_DATA_L 0x15
84 #define COMPASS5_Z_AXIS_DATA_H 0x16
90 #define COMPASS5_DUMMY_TMPS 0x17
91 #define COMPASS5_DATA_STATUS_2 0x18
97 #define COMPASS5_DUMMY_CNTL1 0x30
98 #define COMPASS5_CONTROL_2_SETTINGS 0x31
99 #define COMPASS5_CONTROL_3_SETTINGS 0x32
100 #define COMPASS5_TEST_TS1 0x33
101 #define COMPASS5_TEST_TS2 0x34
119 #define COMPASS5_MODE_POWER_DOWN 0x00
120 #define COMPASS5_MODE_SINGLE_MEASUREMENT 0x01
121 #define COMPASS5_MODE_CON_MEASUREMENT_10HZ 0x02
122 #define COMPASS5_MODE_CON_MEASUREMENT_20HZ 0x04
123 #define COMPASS5_MODE_CON_MEASUREMENT_50HZ 0x06
124 #define COMPASS5_MODE_CON_MEASUREMENT_100HZ 0x08
125 #define COMPASS5_MODE_SELF_TEST 0x10
131 #define COMPASS5_SRST_BIT 0x01
132 #define COMPASS5_HOFL_BIT 0x08
133 #define COMPASS5_DOR_BIT 0x02
134 #define COMPASS5_DRDY_BIT 0x01
140 #define COMPASS5_DATA_NO_READY 0x00
141 #define COMPASS5_DATA_READY 0x01
147 #define COMPASS5_BIT_MASK_BIT0 0x01
154 #define COMPASS5_SET_DEV_ADDR 0x0C
172 #define COMPASS5_MAP_MIKROBUS( cfg, mikrobus ) \
173 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
174 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
uint8_t compass5_check_data_ready(compass5_t *ctx)
Compass 5 check data ready 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.
uint8_t compass5_read_byte(compass5_t *ctx, uint8_t reg)
Compass 5 read 1 byte function.
compass5_return_value_t
Compass 5 Click return value data.
Definition: compass5.h:212
@ COMPASS5_OK
Definition: compass5.h:213
@ COMPASS5_ERROR
Definition: compass5.h:214
Compass 5 Click configuration object.
Definition: compass5.h:198
uint32_t i2c_speed
Definition: compass5.h:202
uint8_t compass5_set_operation_mode(compass5_t *ctx, uint8_t op_mode)
Compass 5 set operation mode function.
uint8_t i2c_address
Definition: compass5.h:203
pin_name_t scl
Definition: compass5.h:199
uint8_t compass5_check_data_overrun(compass5_t *ctx)
Compass 5 check data overrun function.
void compass5_get_id(compass5_t *ctx, uint8_t *company_id, uint8_t *device_id)
Compass 5 get ID function.
i2c_master_t i2c
Definition: compass5.h:186
uint8_t device_id
Definition: main.c:28
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_cfg_setup(compass5_cfg_t *cfg)
Compass 5 configuration object setup function.
uint8_t slave_address
Definition: compass5.h:189
Compass 5 Click context object.
Definition: compass5.h:184
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.
void compass5_write_byte(compass5_t *ctx, uint8_t reg, uint8_t tx_data)
Compass 5 write byte function.
uint8_t company_id
Definition: main.c:29
pin_name_t sda
Definition: compass5.h:200
err_t compass5_generic_read(compass5_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len)
Compass 5 I2C reading function.
err_t compass5_init(compass5_t *ctx, compass5_cfg_t *cfg)
Compass 5 initialization function.