Go to the documentation of this file.
35 #include "mikrosdk_version.h"
38 #if mikroSDK_GET_VERSION < 20800ul
39 #include "rcu_delays.h"
45 #include "drv_digital_out.h"
46 #include "drv_digital_in.h"
47 #include "drv_i2c_master.h"
69 #define MAGNETO6_REG_MAGNETIC_X_MSB 0x00
70 #define MAGNETO6_REG_MAGNETIC_Y_MSB 0x01
71 #define MAGNETO6_REG_MAGNETIC_Z_MSB 0x02
72 #define MAGNETO6_REG_TEMPERATURE_MSB 0x03
73 #define MAGNETO6_REG_MAGNETIC_XY_LSB 0x04
74 #define MAGNETO6_REG_TEMPERATURE_Z_LSB 0x05
75 #define MAGNETO6_REG_DIAG 0x06
76 #define MAGNETO6_REG_CONFIG 0x10
77 #define MAGNETO6_REG_MOD1 0x11
78 #define MAGNETO6_REG_MOD2 0x13
79 #define MAGNETO6_REG_VERSION 0x16
97 #define MAGNETO6_CONFIG_DISABLE_TEMP 0x80
98 #define MAGNETO6_CONFIG_ENABLE_ANGULAR_XY 0x40
99 #define MAGNETO6_CONFIG_TRIGGER_DISABLE 0x00
100 #define MAGNETO6_CONFIG_TRIGGER_MSB 0x10
101 #define MAGNETO6_CONFIG_TRIGGER_REG_READ 0x20
102 #define MAGNETO6_CONFIG_TRIGGER_MASK 0x30
103 #define MAGNETO6_CONFIG_SHORT_RANGE_SENS_EN 0x08
104 #define MAGNETO6_CONFIG_TL_COMP_TC0 0x00
105 #define MAGNETO6_CONFIG_TL_COMP_TC1 0x02
106 #define MAGNETO6_CONFIG_TL_COMP_TC2 0x04
107 #define MAGNETO6_CONFIG_TL_COMP_TC3 0x06
108 #define MAGNETO6_CONFIG_TL_COMP_MASK 0x06
109 #define MAGNETO6_CONFIG_PARITY_BIT 0x01
115 #define MAGNETO6_MOD1_FUSE_PARITY 0x80
116 #define MAGNETO6_MOD1_I2C_ADDR_0 0x00
117 #define MAGNETO6_MOD1_I2C_ADDR_1 0x20
118 #define MAGNETO6_MOD1_I2C_ADDR_2 0x40
119 #define MAGNETO6_MOD1_I2C_ADDR_3 0x60
120 #define MAGNETO6_MOD1_I2C_ADDR_MASK 0x60
121 #define MAGNETO6_MOD1_1BYTE_READ_EN 0x10
122 #define MAGNETO6_MOD1_COLLISION_AVOID 0x08
123 #define MAGNETO6_MOD1_INT_DISABLE 0x04
124 #define MAGNETO6_MOD1_MODE_LOW_POWER 0x00
125 #define MAGNETO6_MOD1_MODE_MASTER 0x01
126 #define MAGNETO6_MOD1_MODE_FAST 0x03
127 #define MAGNETO6_MOD1_MODE_MASK 0x03
133 #define MAGNETO6_MOD2_FUPDATE_SLOW 0x80
134 #define MAGNETO6_MOD2_FACTORY_MASK 0x7F
140 #define MAGNETO6_DIAG_BUS_PARITY 0x80
141 #define MAGNETO6_DIAG_FUSE_PARITY 0x40
142 #define MAGNETO6_DIAG_CFG_PARITY 0x20
143 #define MAGNETO6_DIAG_T_BIT 0x10
144 #define MAGNETO6_DIAG_PD3_FLAG 0x08
145 #define MAGNETO6_DIAG_PD0_FLAG 0x04
146 #define MAGNETO6_DIAG_FRAME_COUNTER_MASK 0x03
152 #define MAGNETO6_VERSION_FACTORY_MASK 0xC0
153 #define MAGNETO6_VERSION_TYPE_MASK 0x30
154 #define MAGNETO6_VERSION_HWV_MASK 0x0F
160 #define MAGNETO6_TEMP_25_DIGIT 1180
161 #define MAGNETO6_TEMP_25 25
162 #define MAGNETO6_TEMP_RES 0.24f
163 #define MAGNETO6_MAGNETIC_RES_MILLI_T 0.13f
169 #define MAGNETO6_I2C_TIMEOUT 100000ul
176 #define MAGNETO6_DEVICE_ADDRESS_0 0x35
177 #define MAGNETO6_DEVICE_ADDRESS_1 0x22
178 #define MAGNETO6_DEVICE_ADDRESS_2 0x78
179 #define MAGNETO6_DEVICE_ADDRESS_3 0x44
197 #define MAGNETO6_MAP_MIKROBUS( cfg, mikrobus ) \
198 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
199 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
200 cfg.ien = MIKROBUS( mikrobus, MIKROBUS_CS ); \
201 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
float temperature
Definition: magneto6.h:215
uint8_t slave_address
Definition: magneto6.h:238
float z_data
Definition: magneto6.h:214
pin_name_t ien
Definition: magneto6.h:251
uint8_t magneto6_get_int_pin(magneto6_t *ctx)
Magneto 6 get int pin function.
err_t magneto6_default_cfg(magneto6_t *ctx)
Magneto 6 default configuration function.
err_t magneto6_read_reg(magneto6_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
Magneto 6 read reg function.
void magneto6_cfg_setup(magneto6_cfg_t *cfg)
Magneto 6 configuration object setup function.
pin_name_t scl
Definition: magneto6.h:248
digital_out_t ien
Definition: magneto6.h:226
uint8_t i2c_address
Definition: magneto6.h:254
@ MAGNETO6_OK
Definition: magneto6.h:264
pin_name_t int_pin
Definition: magneto6.h:252
void magneto6_set_ien_pin(magneto6_t *ctx, uint8_t state)
Magneto 6 set ien pin function.
Magneto 6 Click data object.
Definition: magneto6.h:211
pin_name_t sda
Definition: magneto6.h:249
err_t magneto6_read_data(magneto6_t *ctx, magneto6_data_t *data_out)
Magneto 6 read data function.
magneto6_return_value_t
Magneto 6 Click return value data.
Definition: magneto6.h:263
@ MAGNETO6_ERROR
Definition: magneto6.h:265
float y_data
Definition: magneto6.h:213
digital_in_t int_pin
Definition: magneto6.h:229
pin_name_t scl
Definition: magneto6.h:232
uint8_t i2c_started
Definition: magneto6.h:235
Magneto 6 Click configuration object.
Definition: magneto6.h:247
Magneto 6 Click context object.
Definition: magneto6.h:224
float x_data
Definition: magneto6.h:212
err_t magneto6_init(magneto6_t *ctx, magneto6_cfg_t *cfg)
Magneto 6 initialization function.
err_t magneto6_write_reg(magneto6_t *ctx, uint8_t reg, uint8_t data_in)
Magneto 6 write reg function.
pin_name_t sda
Definition: magneto6.h:233