Go to the documentation of this file.
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 ACCEL25_REG_INT_SRC0 0x00
74 #define ACCEL25_REG_INT_CLR0 0x00
75 #define ACCEL25_REG_INT_SRC1 0x01
76 #define ACCEL25_REG_INT_CLR1 0x01
77 #define ACCEL25_REG_STATUS 0x02
78 #define ACCEL25_REG_XOUT_MSB 0x03
79 #define ACCEL25_REG_XOUT_LSB 0x04
80 #define ACCEL25_REG_YOUT_MSB 0x05
81 #define ACCEL25_REG_YOUT_LSB 0x06
82 #define ACCEL25_REG_ZOUT_MSB 0x07
83 #define ACCEL25_REG_ZOUT_LSB 0x08
84 #define ACCEL25_REG_TOUT 0x09
85 #define ACCEL25_REG_INT_MASK0 0x0A
86 #define ACCEL25_REG_INT_MASK1 0x0B
87 #define ACCEL25_REG_DETECTION 0x0C
88 #define ACCEL25_REG_CONTROL 0x0D
89 #define ACCEL25_REG_DEVICE_ID 0x0E
90 #define ACCEL25_REG_WHO_AM_I 0x0F
112 #define ACCEL25_INT_SRC0_CHORZ 0x80
113 #define ACCEL25_INT_SRC0_CHORXY 0x40
114 #define ACCEL25_INT_SRC0_SHYM 0x08
115 #define ACCEL25_INT_SRC0_SHYP 0x04
116 #define ACCEL25_INT_SRC0_SHXM 0x02
117 #define ACCEL25_INT_SRC0_SHXP 0x01
123 #define ACCEL25_INT_CLR0_ORZC 0x80
124 #define ACCEL25_INT_CLR0_ORXYC 0x40
125 #define ACCEL25_INT_CLR0_SHYMC 0x08
126 #define ACCEL25_INT_CLR0_SHYPC 0x04
127 #define ACCEL25_INT_CLR0_SHXMC 0x02
128 #define ACCEL25_INT_CLR0_SHXPC 0x01
129 #define ACCEL25_INT_CLR0_ALL 0xCF
135 #define ACCEL25_INT_SRC1_TILT 0x80
136 #define ACCEL25_INT_SRC1_ORZ 0x40
137 #define ACCEL25_INT_SRC1_ORXY_X_PLUS 0x00
138 #define ACCEL25_INT_SRC1_ORXY_Y_PLUS 0x10
139 #define ACCEL25_INT_SRC1_ORXY_X_MINUS 0x20
140 #define ACCEL25_INT_SRC1_ORXY_Y_MINUS 0x30
141 #define ACCEL25_INT_SRC1_ORXY_MASK 0x30
142 #define ACCEL25_INT_SRC1_DRDY 0x01
148 #define ACCEL25_INT_CLR1_SW_RST 0x10
149 #define ACCEL25_INT_CLR1_DRDYC 0x01
155 #define ACCEL25_STATUS_ORD 0x10
156 #define ACCEL25_STATUS_ORIZ_MSB 0x08
157 #define ACCEL25_STATUS_ORIZ_LSB 0x04
158 #define ACCEL25_STATUS_ORIXY_MSB 0x02
159 #define ACCEL25_STATUS_ORIXY_LSB 0x01
165 #define ACCEL25_INT_MASK0_ORZE 0x80
166 #define ACCEL25_INT_MASK0_ORXYE 0x40
167 #define ACCEL25_INT_MASK0_SHYME 0x08
168 #define ACCEL25_INT_MASK0_SHYPE 0x04
169 #define ACCEL25_INT_MASK0_SHXME 0x02
170 #define ACCEL25_INT_MASK0_SHXPE 0x01
171 #define ACCEL25_INT_MASK0_NONE 0x00
172 #define ACCEL25_INT_MASK0_ALL 0xCF
178 #define ACCEL25_INT_MASK1_DRDYE 0x01
184 #define ACCEL25_DETECTION_SHM 0x80
185 #define ACCEL25_DETECTION_SHTH_0p25G 0x00
186 #define ACCEL25_DETECTION_SHTH_0p5G 0x10
187 #define ACCEL25_DETECTION_SHTH_0p75G 0x20
188 #define ACCEL25_DETECTION_SHTH_1G 0x30
189 #define ACCEL25_DETECTION_SHTH_1p25G 0x40
190 #define ACCEL25_DETECTION_SHTH_1p5G 0x50
191 #define ACCEL25_DETECTION_SHTH_1p75G 0x60
192 #define ACCEL25_DETECTION_SHTH_2G 0x70
193 #define ACCEL25_DETECTION_SHTH_MASK 0x70
194 #define ACCEL25_DETECTION_SHC_8 0x00
195 #define ACCEL25_DETECTION_SHC_16 0x04
196 #define ACCEL25_DETECTION_SHC_32 0x08
197 #define ACCEL25_DETECTION_SHC_64 0x0C
198 #define ACCEL25_DETECTION_SHC_MASK 0x0C
199 #define ACCEL25_DETECTION_ORC_16 0x00
200 #define ACCEL25_DETECTION_ORC_32 0x01
201 #define ACCEL25_DETECTION_ORC_64 0x02
202 #define ACCEL25_DETECTION_ORC_128 0x03
203 #define ACCEL25_DETECTION_ORC_MASK 0x03
204 #define ACCEL25_DETECTION_NONE 0x00
210 #define ACCEL25_CONTROL_FSR_2G 0x00
211 #define ACCEL25_CONTROL_FSR_4G 0x20
212 #define ACCEL25_CONTROL_FSR_8G 0x40
213 #define ACCEL25_CONTROL_FSR_UNDEFINED 0x60
214 #define ACCEL25_CONTROL_FSR_MASK 0x60
215 #define ACCEL25_CONTROL_PD 0x01
221 #define ACCEL25_ACCEL_RESOLUTION 2048.0f
222 #define ACCEL25_TEMP_SENSITIVITY 0.586f
223 #define ACCEL25_TEMP_NOMINAL 25.0f
229 #define ACCEL25_FSR_2G 0
230 #define ACCEL25_FSR_4G 1
231 #define ACCEL25_FSR_8G 2
237 #define ACCEL25_DEVICE_ID 0x02
243 #define ACCEL25_PIN_STATE_LOW 0x00
244 #define ACCEL25_PIN_STATE_HIGH 0x01
251 #define ACCEL25_DEVICE_ADDRESS 0x15
269 #define ACCEL25_MAP_MIKROBUS( cfg, mikrobus ) \
270 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
271 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
272 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
float y
Definition: accel25.h:319
err_t accel25_set_full_scale_range(accel25_t *ctx, uint8_t fsr)
Accel 25 set full scale range function.
uint8_t accel25_get_int_pin(accel25_t *ctx)
Accel 25 get int pin function.
err_t accel25_generic_write(accel25_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
Accel 25 I2C writing function.
err_t accel25_write_register(accel25_t *ctx, uint8_t reg, uint8_t data_in)
Accel 25 write register function.
float z
Definition: accel25.h:320
err_t accel25_check_communication(accel25_t *ctx)
Accel 25 check communication function.
pin_name_t sda
Definition: accel25.h:303
err_t accel25_read_data(accel25_t *ctx, accel25_data_t *data_out)
Accel 25 read data function.
uint8_t i2c_address
Definition: accel25.h:308
i2c_master_t i2c
Definition: accel25.h:287
digital_in_t int_pin
Definition: accel25.h:284
err_t accel25_read_register(accel25_t *ctx, uint8_t reg, uint8_t *data_out)
Accel 25 read register function.
uint8_t fsr_sens
Definition: accel25.h:292
Accel 25 Click data structure.
Definition: accel25.h:317
err_t accel25_soft_reset(accel25_t *ctx)
Accel 25 soft reset function.
Accel 25 Click configuration object.
Definition: accel25.h:301
uint32_t i2c_speed
Definition: accel25.h:307
accel25_return_value_t
Accel 25 Click return value data.
Definition: accel25.h:330
float x
Definition: accel25.h:318
@ ACCEL25_ERROR
Definition: accel25.h:332
err_t accel25_generic_read(accel25_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
Accel 25 I2C reading function.
float temperature
Definition: accel25.h:321
pin_name_t int_pin
Definition: accel25.h:305
err_t accel25_default_cfg(accel25_t *ctx)
Accel 25 default configuration function.
pin_name_t scl
Definition: accel25.h:302
err_t accel25_init(accel25_t *ctx, accel25_cfg_t *cfg)
Accel 25 initialization function.
Accel 25 Click context object.
Definition: accel25.h:282
void accel25_cfg_setup(accel25_cfg_t *cfg)
Accel 25 configuration object setup function.
@ ACCEL25_OK
Definition: accel25.h:331
uint8_t slave_address
Definition: accel25.h:290