accel13  2.0.0.0
accel13.h
Go to the documentation of this file.
1 /*
2  * MikroSDK - MikroE Software Development Kit
3  * Copyright (c) 2019, MikroElektronika - www.mikroe.com
4  * All rights reserved.
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to deal
8  * in the Software without restriction, including without limitation the rights
9  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10  * copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in
14  * all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22  * SOFTWARE.
23  */
24 
33 // ----------------------------------------------------------------------------
34 
35 #ifndef ACCEL13_H
36 #define ACCEL13_H
37 
38 #include "drv_digital_out.h"
39 #include "drv_digital_in.h"
40 #include "drv_i2c_master.h"
41 #include "drv_spi_master.h"
42 
43 // -------------------------------------------------------------- PUBLIC MACROS
54 #define ACCEL13_MAP_MIKROBUS( cfg, mikrobus ) \
55  cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
56  cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
57  cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
58  cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
59  cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
60  cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
61  cfg.int2 = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
62  cfg.int1 = MIKROBUS( mikrobus, MIKROBUS_INT );
63 
69 #define ACCEL13_MASTER_I2C 0
70 #define ACCEL13_MASTER_SPI 1
71 
77 #define ACCEL13_RETVAL uint8_t
78 
79 #define ACCEL13_OK 0x00
80 #define ACCEL13_INIT_ERROR 0xFF
81 
87 #define ACCEL13_DEVICE_SLAVE_ADDR_GND 0x18
88 #define ACCEL13_DEVICE_SLAVE_ADDR_VCC 0x19
89 
94 #define ACCEL13_REG_TEMPERATURE_DATA_LSB 0x0D
95 #define ACCEL13_REG_TEMPERATURE_DATA_MSB 0x0E
96 #define ACCEL13_REG_WHO_AM_I 0x0F
97 #define ACCEL13_REG_CTRL_1 0x20
98 #define ACCEL13_REG_CTRL_2 0x21
99 #define ACCEL13_REG_CTRL_3 0x22
100 #define ACCEL13_REG_CTRL_4_INT1 0x23
101 #define ACCEL13_REG_CTRL_5_INT2 0x24
102 #define ACCEL13_REG_CTRL_6 0x25
103 #define ACCEL13_REG_TEMPERATURE_OUTPUT 0x26
104 #define ACCEL13_REG_STATUS 0x27
105 #define ACCEL13_REG_AXIS_X_LSB 0x28
106 #define ACCEL13_REG_AXIS_X_MSB 0x29
107 #define ACCEL13_REG_AXIS_Y_LSB 0x2A
108 #define ACCEL13_REG_AXIS_Y_MSB 0x2B
109 #define ACCEL13_REG_AXIS_Z_LSB 0x2C
110 #define ACCEL13_REG_AXIS_Z_MSB 0x2D
111 #define ACCEL13_REG_FIFO_CTRL 0x2E
112 #define ACCEL13_REG_FIFO_SAMPLES 0x2F
113 #define ACCEL13_REG_TAP_AXIS_X 0x30
114 #define ACCEL13_REG_TAP_AXIS_Y 0x31
115 #define ACCEL13_REG_TAP_AXIS_Z 0x32
116 #define ACCEL13_REG_INT_DURATION 0x33
117 #define ACCEL13_REG_WAKE_UP_THRESHOLD 0x34
118 #define ACCEL13_REG_WAKE_UP_DURATION 0x35
119 #define ACCEL13_REG_FREE_FALL_CONFIG 0x36
120 #define ACCEL13_REG_STATUS_DUP 0x37
121 #define ACCEL13_REG_WAKE_UP_SOURCE 0x38
122 #define ACCEL13_REG_TAP_SOURCE 0x39
123 #define ACCEL13_REG_6D_SOURCE 0x3A
124 #define ACCEL13_REG_ALL_INT_SOURCE 0x3B
125 #define ACCEL13_REG_X_OFFSET_USER 0x3C
126 #define ACCEL13_REG_Y_OFFSET_USER 0x3D
127 #define ACCEL13_REG_Z_OFFSET_USER 0x3E
128 #define ACCEL13_REG_CTRL_7 0x3F
129 
135 #define ACCEL13_DEF_WHO_AM_I 0x44
136 
142 #define ACCEL13_CTRL1_ODR_POWER_DOWN 0x00
143 #define ACCEL13_CTRL1_ODR_LOW_POWER_MODE_12p5_1p6Hz 0x10
144 #define ACCEL13_CTRL1_ODR_LOW_POWER_MODE_12p5Hz 0x20
145 #define ACCEL13_CTRL1_ODR_LOW_POWER_MODE_25Hz 0x30
146 #define ACCEL13_CTRL1_ODR_LOW_POWER_MODE_50Hz 0x40
147 #define ACCEL13_CTRL1_ODR_LOW_POWER_MODE_100Hz 0x50
148 #define ACCEL13_CTRL1_ODR_LOW_POWER_MODE_200Hz 0x60
149 #define ACCEL13_CTRL1_ODR_LOW_POWER_MODE_400_200Hz 0x70
150 #define ACCEL13_CTRL1_ODR_LOW_POWER_MODE_800_200Hz 0x80
151 #define ACCEL13_CTRL1_ODR_LOW_POWER_MODE_1600_200Hz 0x90
152 #define ACCEL13_CTRL1_MODE_LOW_POWER_MODE_12_14bit 0x00
153 #define ACCEL13_CTRL1_MODE_HIGH_PERFORMANCE_MODE_14bit 0x04
154 #define ACCEL13_CTRL1_SINGLE_DATA_CONVERSION_12_14bit 0x08
155 #define ACCEL13_CTRL1_LP_MODE_1 0x00
156 #define ACCEL13_CTRL1_LP_MODE_2 0x01
157 #define ACCEL13_CTRL1_LP_MODE_3 0x02
158 #define ACCEL13_CTRL1_LP_MODE_4 0x03
159 
165 #define ACCEL13_CTRL2_BOOT_DISABLE 0x00
166 #define ACCEL13_CTRL2_BOOT_ENABLE 0x80
167 #define ACCEL13_CTRL2_SOFT_RESET_DISABLE 0x00
168 #define ACCEL13_CTRL2_SOFT_RESET_ENABLE 0x20
169 #define ACCEL13_CTRL2_PULLUP_CS_PIN_ENABLE 0x00
170 #define ACCEL13_CTRL2_PULLUP_CS_PIN_DISABLE 0x10
171 #define ACCEL13_CTRL2_BDU_CONTINUOUS_UPDATE 0x00
172 #define ACCEL13_CTRL2_BDU_UPDATE_REGISTER 0x08
173 #define ACCEL13_CTRL2_IF_ADD_INC_ENABLED 0x04
174 #define ACCEL13_CTRL2_IF_ADD_INC_DISABLED 0x00
175 #define ACCEL13_CTRL2_I2C_AND_SPI_ENABLE 0x00
176 #define ACCEL13_CTRL2_I2C_DISABLE 0x02
177 #define ACCEL13_CTRL2_SPI_4_WIRE 0x00
178 #define ACCEL13_CTRL2_SPI_3_WIRE 0x01
179 
185 #define ACCEL13_CTRL3_SELF_TEST_DISABLE 0x00
186 #define ACCEL13_CTRL3_SELF_TEST_POS_SIGN 0x40
187 #define ACCEL13_CTRL3_SELF_TEST_NEG_SIGN 0x80
188 #define ACCEL13_CTRL3_PUSH_PULL_INT_PAD 0x00
189 #define ACCEL13_CTRL3_OPEN_DRAIN_INT_PAD 0x20
190 #define ACCEL13_CTRL3_LATCHED_INT_ENABLE 0x20
191 #define ACCEL13_CTRL3_LATCHED_INT_DISABLE 0x10
192 #define ACCEL13_CTRL3_INT_ACTIVE_HIGH 0x00
193 #define ACCEL13_CTRL3_INT_ACTIVE_LOW 0x08
194 #define ACCEL13_CTRL3_SLP_MODE_SEL_EN_INT2 0x00
195 #define ACCEL13_CTRL3_SLP_MODE_SEL_EN_MODE1 0x02
196 
202 #define ACCEL13_CTRL4_INT1_6D_DISABLED 0x00
203 #define ACCEL13_CTRL4_INT1_6D_ENABLED 0x80
204 #define ACCEL13_CTRL4_INT1_SINGLE_TAP_DISABLED 0x00
205 #define ACCEL13_CTRL4_INT1_SINGLE_TAP_ENABLED 0x40
206 #define ACCEL13_CTRL4_INT1_WAKEUP_DISABLED 0x00
207 #define ACCEL13_CTRL4_INT1_WAKEUP_ENABLED 0x20
208 #define ACCEL13_CTRL4_INT1_FREE_FALL_DISABLED 0x00
209 #define ACCEL13_CTRL4_INT1_FREE_FALL_ENABLED 0x10
210 #define ACCEL13_CTRL4_INT1_TAP_DISABLED 0x00
211 #define ACCEL13_CTRL4_INT1_TAP_ENABLED 0x08
212 #define ACCEL13_CTRL4_INT1_DIFF5_DISABLED 0x00
213 #define ACCEL13_CTRL4_INT1_DIFF5_ENABLED 0x04
214 #define ACCEL13_CTRL4_INT1_FTH_DISABLED 0x00
215 #define ACCEL13_CTRL4_INT1_FTH_ENABLED 0x02
216 #define ACCEL13_CTRL4_INT1_DRDY_DISABLED 0x00
217 #define ACCEL13_CTRL4_INT1_DRDY_ENABLED 0x01
218 
224 #define ACCEL13_CTRL5_INT2_SLEEP_STATE_DISABLED 0x00
225 #define ACCEL13_CTRL5_INT2_SLEEP_STATE_ENABLED 0x80
226 #define ACCEL13_CTRL5_INT2_SLEEP_CHG_DISABLED 0x00
227 #define ACCEL13_CTRL5_INT2_SLEEP_CHG_ENABLED 0x40
228 #define ACCEL13_CTRL5_INT2_BOOT_DISABLED 0x00
229 #define ACCEL13_CTRL5_INT2_BOOT_ENABLED 0x20
230 #define ACCEL13_CTRL5_INT2_T_DRDY_DISABLED 0x00
231 #define ACCEL13_CTRL5_INT2_T_DRDY_ENABLED 0x10
232 #define ACCEL13_CTRL5_INT2_OVR_DISABLED 0x00
233 #define ACCEL13_CTRL5_INT2_OVR_ENABLED 0x08
234 #define ACCEL13_CTRL4_INT2_DIFF5_DISABLED 0x00
235 #define ACCEL13_CTRL4_INT2_DIFF5_ENABLED 0x04
236 #define ACCEL13_CTRL4_INT2_FTH_DISABLED 0x00
237 #define ACCEL13_CTRL4_INT2_FTH_ENABLED 0x02
238 #define ACCEL13_CTRL4_INT2_DRDY_DISABLED 0x00
239 #define ACCEL13_CTRL4_INT2_DRDY_ENABLED 0x01
240 
246 #define ACCEL13_CTRL6_BW_FILT_ODR_2 0x00
247 #define ACCEL13_CTRL6_BW_FILT_ODR_4 0x40
248 #define ACCEL13_CTRL6_BW_FILT_ODR_10 0x80
249 #define ACCEL13_CTRL6_BW_FILT_ODR_20 0xC0
250 #define ACCEL13_CTRL6_FULL_SCALE_2g 0x00
251 #define ACCEL13_CTRL6_FULL_SCALE_4g 0x10
252 #define ACCEL13_CTRL6_FULL_SCALE_8g 0x20
253 #define ACCEL13_CTRL6_FULL_SCALE_16g 0x30
254 #define ACCEL13_CTRL6_FDS_LOW_PASS 0x00
255 #define ACCEL13_CTRL6_FDS_HIGH_PASS 0x08
256 #define ACCEL13_CTRL6_LOW_NOISE_DISABLE 0x00
257 #define ACCEL13_CTRL6_LOW_NOISE_ENABLE 0x04
258 
264 #define ACCEL13_FCTRL_BYPASS_MODE 0x00
265 #define ACCEL13_FCTRL_FIFO_MODE 0x20
266 #define ACCEL13_FCTRL_CONTINUOUS_TO_FIFO 0x60
267 #define ACCEL13_FCTRL_BYPASS_TO_CONTINUOUS 0x80
268 #define ACCEL13_FCTRL_CONTINUOUS_MODE 0xC0
269 
275 #define ACCEL3_TAPTHX_4DEN_NO_POSITION_DETECTED 0x00
276 #define ACCEL3_TAPTHX_4DEN_POSITION_DETECTED 0x80
277 #define ACCEL3_TAPTHX_6DTHS_80_DEGREES 0x00
278 #define ACCEL3_TAPTHX_6DTHS_70_DEGREES 0x20
279 #define ACCEL3_TAPTHX_6DTHS_60_DEGREES 0x40
280 #define ACCEL3_TAPTHX_6DTHS_50_DEGREES 0x60
281 
287 #define ACCEL3_TAPTHY_PERIOD_X_Y_Z 0x00
288 #define ACCEL3_TAPTHY_PERIOD_Y_X_Z 0x20
289 #define ACCEL3_TAPTHY_PERIOD_X_Z_Y 0x40
290 #define ACCEL3_TAPTHY_PERIOD_Z_Y_X 0x60
291 
297 #define ACCEL13_TAPTHZ_TAP_X_DISABLE 0x00
298 #define ACCEL13_TAPTHZ_TAP_Y_DISABLE 0x00
299 #define ACCEL13_TAPTHZ_TAP_Z_DISABLE 0x00
300 #define ACCEL13_TAPTHZ_TAP_X_ENABLE 0x80
301 #define ACCEL13_TAPTHZ_TAP_Y_ENABLE 0x40
302 #define ACCEL13_TAPTHZ_TAP_Z_ENABLE 0x20
303 
309 #define ACCEL13_WUT_TAP_SINGLE_EN 0x00
310 #define ACCEL13_WUT_TAP_SINGLE_AND_DOUBLE_EN 0x80
311 #define ACCEL13_WUT_SLEEP_DISABLE 0x00
312 #define ACCEL13_WUT_SLEEP_ENABLE 0x40
313 
319 #define ACCEL13_FFTHS_DECODING_LSB_5 0x00
320 #define ACCEL13_FFTHS_DECODING_LSB_7 0x01
321 #define ACCEL13_FFTHS_DECODING_LSB_8 0x02
322 #define ACCEL13_FFTHS_DECODING_LSB_10 0x03
323 #define ACCEL13_FFTHS_DECODING_LSB_11 0x04
324 #define ACCEL13_FFTHS_DECODING_LSB_13 0x05
325 #define ACCEL13_FFTHS_DECODING_LSB_15 0x06
326 #define ACCEL13_FFTHS_DECODING_LSB_16 0x07
327 
333 #define ACCEL13_SDUR_OVR_FIFO_NOT_COMPLETELY 0x00
334 #define ACCEL13_SDUR_OVR_FIFO_COMPLETELY 0x80
335 #define ACCEL13_SDUR_T_DRDY_NO_DATA 0x00
336 #define ACCEL13_SDUR_T_DRDY_DATA_IS_AVAILABLE 0x40
337 #define ACCEL13_SDUR_SLEEP_EVENT_NO_DETECT 0x00
338 #define ACCEL13_SDUR_SLEEP_EVENT_DETECT 0x20
339 #define ACCEL13_SDUR_DOUBLE_TAP_EVENT_NO_DETECT 0x00
340 #define ACCEL13_SDUR_DOUBLE_TAP_EVENT_DETECT 0x10
341 #define ACCEL13_SDUR_SINGLE_TAP_EVENT_NO_DETECT 0x00
342 #define ACCEL13_SDUR_SINGLE_TAP_EVENT_DETECT 0x08
343 #define ACCEL13_SDUR_6D_IA_EVENT_NO_DETECT 0x00
344 #define ACCEL13_SDUR_6D_IA_EVENT_DETECT 0x04
345 #define ACCEL13_SDUR_FF_IA_EVENT_NO_DETECT 0x00
346 #define ACCEL13_SDUR_FF_IA_EVENT_DETECT 0x02
347 #define ACCEL13_SDUR_DRDY_NO_READY 0x00
348 #define ACCEL13_SDUR_DRDY_XYZ_NEW_DATA_AVAILABLE 0x01
349 
355 #define ACCEL13_WUSRC_FF_IA_EVENT_NO_DETECT 0x00
356 #define ACCEL13_WUSRC_FF_IA_EVENT_DETECT 0x20
357 #define ACCEL13_WUSRC_SLEEP_EVENT_NO_DETECT 0x00
358 #define ACCEL13_WUSRC_SLEEP_EVENT_DETECT 0x10
359 #define ACCEL13_WUSRC_WAKEUP_EVENT_NO_DETECT 0x00
360 #define ACCEL13_WUSRC_WAKEUP_EVENT_DETECT 0x08
361 #define ACCEL13_WUSRC_WAKEUP_X_EVENT_NO_DETECT 0x00
362 #define ACCEL13_WUSRC_WAKEUP_X_EVENT_DETECT 0x04
363 #define ACCEL13_WUSRC_WAKEUP_Y_EVENT_NO_DETECT 0x00
364 #define ACCEL13_WUSRC_WAKEUP_Y_EVENT_DETECT 0x02
365 #define ACCEL13_WUSRC_WAKEUP_Z_EVENT_NO_DETECT 0x00
366 #define ACCEL13_WUSRC_WAKEUP_Z_EVENT_DETECT 0x01
367 
373 #define ACCEL13_TAPSRC_TAP_IA_EVENT_NO_DETECT 0x00
374 #define ACCEL13_TAPSRC_TAP_EVENT_DETECT 0x40
375 #define ACCEL13_TAPSRC_SINGLE_TAP_EVENT_NO_DETECT 0x00
376 #define ACCEL13_TAPSRC_SINGLE_TAP_EVENT_DETECT 0x20
377 #define ACCEL13_TAPSRC_DOUBLE_TAP_EVENT_NO_DETECT 0x00
378 #define ACCEL13_TAPSRC_DOUBLE_TAP_EVENT_DETECT 0x10
379 #define ACCEL13_TAPSRC_TAP_SIGN_EVENT_NO_DETECT 0x00
380 #define ACCEL13_TAPSRC_TAP_SIGN_EVENT_DETECT 0x08
381 #define ACCEL13_TAPSRC_X_TAP_EVENT_NO_DETECT 0x00
382 #define ACCEL13_TAPSRC_X_TAP_EVENT_DETECT 0x04
383 #define ACCEL13_TAPSRC_Y_TAP_EVENT_NO_DETECT 0x00
384 #define ACCEL13_TAPSRC_Y_TAP_EVENT_DETECT 0x02
385 #define ACCEL13_TAPSRC_Z_TAP_EVENT_NO_DETECT 0x00
386 #define ACCEL13_TAPSRC_Z_TAP_EVENT_DETECT 0x01
387 
393 #define ACCEL13_SIXDSRC_6D_IA_EVENT_NO_DETECT 0x00
394 
400 #define ACCEL13_INT_PIN_INTERRUPT_1 0x00
401 #define ACCEL13_PWM_PIN_INTERRUPT_2 0x01
402  // End group macro
405 // --------------------------------------------------------------- PUBLIC TYPES
414 typedef uint8_t accel13_select_t;
415 
419 typedef void ( *accel13_master_io_t )( struct accel13_s*, uint8_t, uint8_t*, uint8_t );
420 
424 typedef struct accel13_s
425 {
426  // Input pins
427 
428  digital_in_t int2;
429  digital_in_t int1;
430 
431  // Modules
432 
433  i2c_master_t i2c;
434  spi_master_t spi;
435 
436  // ctx variable
437 
438  hal_i2c_address_t slave_address;
442 
443 } accel13_t;
444 
448 typedef struct
449 {
450  // Communication gpio pins
451 
452  pin_name_t scl;
453  pin_name_t sda;
454  pin_name_t miso;
455  pin_name_t mosi;
456  pin_name_t sck;
457  pin_name_t cs;
458 
459  // Additional gpio pins
460 
461  pin_name_t int2;
462  pin_name_t int1;
463 
464  // static variable
465 
466  hal_i2c_speed_t i2c_speed;
467  hal_i2c_address_t i2c_address;
468  hal_spi_speed_t spi_speed;
469  hal_spi_mode_t spi_mode;
470 
472 
473 } accel13_cfg_t;
474 
478 typedef struct
479 {
480  int16_t x;
481  int16_t y;
482  int16_t z;
483 
485 
490 typedef struct
491 {
492  uint8_t fifo_threshold;
493  uint8_t wakeup_event;
494  uint8_t sleep_event;
497  uint8_t event_6d;
499  uint8_t drdy_event;
500 
502 
507 typedef struct
508 {
510  uint8_t sleep_event;
511  uint8_t wakeup_event;
512  uint8_t wakeup_x;
513  uint8_t wakeup_y;
514  uint8_t wakeup_z;
515 
517 
522 typedef struct
523 {
524  uint8_t tap;
525  uint8_t single_tap;
526  uint8_t double_tap;
527  uint8_t sign_tap;
528  uint8_t tap_x;
529  uint8_t tap_y;
530  uint8_t tap_z;
531 
532 } accel13_tap_t;
533 
538 typedef struct
539 {
540  uint8_t event_6d;
541  uint8_t z_high;
542  uint8_t z_low;
543  uint8_t y_high;
544  uint8_t y_low;
545  uint8_t x_high;
546  uint8_t x_low;
547 
548 } accel13_6d_t;
549 
554 typedef struct
555 {
556  int8_t x;
557  int8_t y;
558  int8_t z;
559 
561  // End types group
563 // ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
569 #ifdef __cplusplus
570 extern "C"{
571 #endif
572 
581 void accel13_cfg_setup ( accel13_cfg_t *cfg );
582 
591 
659 void accel13_default_cfg ( accel13_t *ctx );
660 
671 void accel13_generic_write_bytes ( accel13_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len );
672 
682 void accel13_generic_write_single_byte ( accel13_t *ctx, uint8_t reg, uint8_t data_in );
683 
694 void accel13_generic_read_bytes ( accel13_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len );
695 
706 int16_t accel13_generic_read_word ( accel13_t *ctx, uint8_t reg );
707 
715 float accel13_get_temperature ( accel13_t *ctx );
716 
725 void accel13_get_axis_data ( accel13_t *ctx, accel13_axis_t *axis );
726 
735 void accel13_get_status ( accel13_t *ctx, accel13_status_t *status);
736 
746 
755 void accel13_get_tap_status ( accel13_t *ctx, accel13_tap_t *tap_status );
756 
765 void accel13_get_6d_status ( accel13_t *ctx, accel13_6d_t *sixd_status );
766 
776 
786 
797 uint8_t accel13_get_interrupt ( accel13_t *ctx, uint8_t int_num );
798 
799 #ifdef __cplusplus
800 }
801 #endif
802 #endif // _ACCEL13_H_
803  // End public_function group
806 
807 // ------------------------------------------------------------------------- END
uint8_t double_tap
Definition: accel13.h:526
struct accel13_s accel13_t
Click ctx object definition.
uint8_t accel13_get_interrupt(accel13_t *ctx, uint8_t int_num)
Interrupt functions.
uint8_t z_low
Definition: accel13.h:542
uint8_t drdy_event
Definition: accel13.h:499
pin_name_t int2
Definition: accel13.h:461
void accel13_get_user_offset(accel13_t *ctx, accel13_user_offset_t *axis)
Read function for User offset data.
Structure for collecting status data, read from the 6D SRC register.
Definition: accel13.h:538
spi_master_t spi
Definition: accel13.h:434
digital_in_t int2
Definition: accel13.h:428
Click configuration structure definition.
Definition: accel13.h:448
int8_t x
Definition: accel13.h:556
void accel13_generic_read_bytes(accel13_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic 8bit read function.
Click ctx object definition.
Definition: accel13.h:424
#define ACCEL13_RETVAL
Definition: accel13.h:77
int16_t accel13_generic_read_word(accel13_t *ctx, uint8_t reg)
16bit read function.
uint8_t wakeup_x
Definition: accel13.h:512
Structure for collecting status data, read from the STATUS registers.
Definition: accel13.h:490
uint8_t tap_y
Definition: accel13.h:529
pin_name_t mosi
Definition: accel13.h:455
void accel13_get_axis_data(accel13_t *ctx, accel13_axis_t *axis)
Read function for Accel axis data.
uint8_t z_high
Definition: accel13.h:541
uint8_t accel13_select_t
Communication type.
Definition: accel13.h:414
void accel13_set_user_offset(accel13_t *ctx, accel13_user_offset_t *axis)
Set function for User offset data.
void accel13_generic_write_bytes(accel13_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic write function.
accel13_select_t master_sel
Definition: accel13.h:441
uint8_t single_tap
Definition: accel13.h:525
accel13_select_t sel
Definition: accel13.h:471
pin_name_t sda
Definition: accel13.h:453
pin_name_t int1
Definition: accel13.h:462
Structure for collecting status data, read from the TAP SRC register.
Definition: accel13.h:522
accel13_master_io_t read_f
Definition: accel13.h:440
uint8_t sleep_event
Definition: accel13.h:494
void accel13_get_6d_status(accel13_t *ctx, accel13_6d_t *sixd_status)
Read function for 6D status data.
digital_in_t int1
Definition: accel13.h:429
uint8_t free_fall_event
Definition: accel13.h:509
void accel13_get_tap_status(accel13_t *ctx, accel13_tap_t *tap_status)
Read function for Tap status data.
pin_name_t sck
Definition: accel13.h:456
uint8_t tap_x
Definition: accel13.h:528
uint8_t wakeup_z
Definition: accel13.h:514
hal_spi_speed_t spi_speed
Definition: accel13.h:468
hal_i2c_address_t i2c_address
Definition: accel13.h:467
uint8_t sign_tap
Definition: accel13.h:527
Structure for collecting data, read from the USER OFFSET registers.
Definition: accel13.h:554
void accel13_get_status(accel13_t *ctx, accel13_status_t *status)
Read functions for Status data.
int16_t x
Definition: accel13.h:480
pin_name_t cs
Definition: accel13.h:457
int8_t z
Definition: accel13.h:558
uint8_t tap
Definition: accel13.h:524
uint8_t single_tap_event
Definition: accel13.h:496
pin_name_t scl
Definition: accel13.h:452
int16_t z
Definition: accel13.h:482
int16_t y
Definition: accel13.h:481
uint8_t y_high
Definition: accel13.h:543
uint8_t free_fall_event
Definition: accel13.h:498
float accel13_get_temperature(accel13_t *ctx)
Temperature functions.
uint8_t event_6d
Definition: accel13.h:497
hal_spi_mode_t spi_mode
Definition: accel13.h:469
pin_name_t miso
Definition: accel13.h:454
uint8_t wakeup_event
Definition: accel13.h:511
hal_i2c_speed_t i2c_speed
Definition: accel13.h:466
uint8_t sleep_event
Definition: accel13.h:510
uint8_t wakeup_event
Definition: accel13.h:493
hal_i2c_address_t slave_address
Definition: accel13.h:438
ACCEL13_RETVAL accel13_init(accel13_t *ctx, accel13_cfg_t *cfg)
Initialization function.
Accel axis data structure.
Definition: accel13.h:478
uint8_t y_low
Definition: accel13.h:544
uint8_t fifo_threshold
Definition: accel13.h:492
void(* accel13_master_io_t)(struct accel13_s *, uint8_t, uint8_t *, uint8_t)
Master Input/Output type.
Definition: accel13.h:419
void accel13_get_wake_up_status(accel13_t *ctx, accel13_wake_up_t *wu_status)
Read function for Wake-up status data.
Structure for collecting status data, read from the WAKE-UP SRC register.
Definition: accel13.h:507
void accel13_cfg_setup(accel13_cfg_t *cfg)
Config Object Initialization function.
uint8_t wakeup_y
Definition: accel13.h:513
i2c_master_t i2c
Definition: accel13.h:433
void accel13_generic_write_single_byte(accel13_t *ctx, uint8_t reg, uint8_t data_in)
Single byte write function.
uint8_t event_6d
Definition: accel13.h:540
uint8_t x_low
Definition: accel13.h:546
uint8_t tap_z
Definition: accel13.h:530
int8_t y
Definition: accel13.h:557
void accel13_default_cfg(accel13_t *ctx)
Click Default Configuration function.
uint8_t x_high
Definition: accel13.h:545
accel13_master_io_t write_f
Definition: accel13.h:439
uint8_t double_tap_event
Definition: accel13.h:495