accel13  2.0.0.0
accel13.h
Go to the documentation of this file.
1 /*
2  * MikroSDK - MikroE Software Development Kit
3  * Copyright© 2020 MikroElektronika d.o.o.
4  *
5  * Permission is hereby granted, free of charge, to any person
6  * obtaining a copy of this software and associated documentation
7  * files (the "Software"), to deal in the Software without restriction,
8  * including without limitation the rights to use, copy, modify, merge,
9  * publish, distribute, sublicense, and/or sell copies of the Software,
10  * and to permit persons to whom the Software is furnished to do so,
11  * subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be
14  * included in all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
20  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
22  * OR OTHER DEALINGS IN THE 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  // Output pins
427  digital_out_t cs;
428 
429  // Input pins
430 
431  digital_in_t int2;
432  digital_in_t int1;
433 
434  // Modules
435 
436  i2c_master_t i2c;
437  spi_master_t spi;
438 
439  // ctx variable
440 
441  uint8_t slave_address;
442  pin_name_t chip_select;
446 
447 } accel13_t;
448 
452 typedef struct
453 {
454  // Communication gpio pins
455 
456  pin_name_t scl;
457  pin_name_t sda;
458  pin_name_t miso;
459  pin_name_t mosi;
460  pin_name_t sck;
461  pin_name_t cs;
462 
463  // Additional gpio pins
464 
465  pin_name_t int2;
466  pin_name_t int1;
467 
468  // static variable
469 
470  uint32_t i2c_speed;
471  uint8_t i2c_address;
472  uint32_t spi_speed;
473  uint8_t spi_mode;
474  spi_master_chip_select_polarity_t cs_polarity;
475 
477 
478 } accel13_cfg_t;
479 
483 typedef struct
484 {
485  int16_t x;
486  int16_t y;
487  int16_t z;
488 
490 
495 typedef struct
496 {
497  uint8_t fifo_threshold;
498  uint8_t wakeup_event;
499  uint8_t sleep_event;
502  uint8_t event_6d;
504  uint8_t drdy_event;
505 
507 
512 typedef struct
513 {
515  uint8_t sleep_event;
516  uint8_t wakeup_event;
517  uint8_t wakeup_x;
518  uint8_t wakeup_y;
519  uint8_t wakeup_z;
520 
522 
527 typedef struct
528 {
529  uint8_t tap;
530  uint8_t single_tap;
531  uint8_t double_tap;
532  uint8_t sign_tap;
533  uint8_t tap_x;
534  uint8_t tap_y;
535  uint8_t tap_z;
536 
537 } accel13_tap_t;
538 
543 typedef struct
544 {
545  uint8_t event_6d;
546  uint8_t z_high;
547  uint8_t z_low;
548  uint8_t y_high;
549  uint8_t y_low;
550  uint8_t x_high;
551  uint8_t x_low;
552 
553 } accel13_6d_t;
554 
559 typedef struct
560 {
561  int8_t x;
562  int8_t y;
563  int8_t z;
564 
566  // End types group
568 // ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
574 #ifdef __cplusplus
575 extern "C"{
576 #endif
577 
586 void accel13_cfg_setup ( accel13_cfg_t *cfg );
587 
596 
664 void accel13_default_cfg ( accel13_t *ctx );
665 
676 void accel13_generic_write_bytes ( accel13_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len );
677 
687 void accel13_generic_write_single_byte ( accel13_t *ctx, uint8_t reg, uint8_t data_in );
688 
699 void accel13_generic_read_bytes ( accel13_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len );
700 
711 int16_t accel13_generic_read_word ( accel13_t *ctx, uint8_t reg );
712 
720 float accel13_get_temperature ( accel13_t *ctx );
721 
730 void accel13_get_axis_data ( accel13_t *ctx, accel13_axis_t *axis );
731 
740 void accel13_get_status ( accel13_t *ctx, accel13_status_t *status);
741 
751 
760 void accel13_get_tap_status ( accel13_t *ctx, accel13_tap_t *tap_status );
761 
770 void accel13_get_6d_status ( accel13_t *ctx, accel13_6d_t *sixd_status );
771 
781 
791 
802 uint8_t accel13_get_interrupt ( accel13_t *ctx, uint8_t int_num );
803 
804 #ifdef __cplusplus
805 }
806 #endif
807 #endif // _ACCEL13_H_
808  // End public_function group
811 
812 // ------------------------------------------------------------------------- END
accel13_cfg_t::sck
pin_name_t sck
Definition: accel13.h:460
accel13_status_t::wakeup_event
uint8_t wakeup_event
Definition: accel13.h:498
accel13_tap_t::sign_tap
uint8_t sign_tap
Definition: accel13.h:532
accel13_get_axis_data
void accel13_get_axis_data(accel13_t *ctx, accel13_axis_t *axis)
Read function for Accel axis data.
accel13_s::chip_select
pin_name_t chip_select
Definition: accel13.h:442
accel13_master_io_t
void(* accel13_master_io_t)(struct accel13_s *, uint8_t, uint8_t *, uint8_t)
Master Input/Output type.
Definition: accel13.h:419
accel13_s::i2c
i2c_master_t i2c
Definition: accel13.h:436
accel13_wake_up_t::wakeup_event
uint8_t wakeup_event
Definition: accel13.h:516
accel13_cfg_setup
void accel13_cfg_setup(accel13_cfg_t *cfg)
Config Object Initialization function.
accel13_s::spi
spi_master_t spi
Definition: accel13.h:437
accel13_axis_t
Accel axis data structure.
Definition: accel13.h:483
accel13_6d_t::z_low
uint8_t z_low
Definition: accel13.h:547
accel13_tap_t::tap_z
uint8_t tap_z
Definition: accel13.h:535
accel13_tap_t::tap_x
uint8_t tap_x
Definition: accel13.h:533
accel13_user_offset_t::y
int8_t y
Definition: accel13.h:562
accel13_tap_t::tap
uint8_t tap
Definition: accel13.h:529
accel13_wake_up_t::sleep_event
uint8_t sleep_event
Definition: accel13.h:515
accel13_s::write_f
accel13_master_io_t write_f
Definition: accel13.h:443
accel13_cfg_t::mosi
pin_name_t mosi
Definition: accel13.h:459
accel13_tap_t::double_tap
uint8_t double_tap
Definition: accel13.h:531
accel13_cfg_t::sel
accel13_select_t sel
Definition: accel13.h:476
accel13_cfg_t::spi_speed
uint32_t spi_speed
Definition: accel13.h:472
accel13_cfg_t::i2c_speed
uint32_t i2c_speed
Definition: accel13.h:470
accel13_get_6d_status
void accel13_get_6d_status(accel13_t *ctx, accel13_6d_t *sixd_status)
Read function for 6D status data.
accel13_get_status
void accel13_get_status(accel13_t *ctx, accel13_status_t *status)
Read functions for Status data.
accel13_cfg_t::sda
pin_name_t sda
Definition: accel13.h:457
accel13_6d_t::x_high
uint8_t x_high
Definition: accel13.h:550
accel13_cfg_t::spi_mode
uint8_t spi_mode
Definition: accel13.h:473
accel13_s::master_sel
accel13_select_t master_sel
Definition: accel13.h:445
accel13_s::int1
digital_in_t int1
Definition: accel13.h:432
accel13_status_t::fifo_threshold
uint8_t fifo_threshold
Definition: accel13.h:497
accel13_wake_up_t::wakeup_y
uint8_t wakeup_y
Definition: accel13.h:518
accel13_wake_up_t::wakeup_z
uint8_t wakeup_z
Definition: accel13.h:519
accel13_set_user_offset
void accel13_set_user_offset(accel13_t *ctx, accel13_user_offset_t *axis)
Set function for User offset data.
accel13_user_offset_t::x
int8_t x
Definition: accel13.h:561
accel13_generic_write_single_byte
void accel13_generic_write_single_byte(accel13_t *ctx, uint8_t reg, uint8_t data_in)
Single byte write function.
accel13_status_t::drdy_event
uint8_t drdy_event
Definition: accel13.h:504
accel13_default_cfg
void accel13_default_cfg(accel13_t *ctx)
Click Default Configuration function.
accel13_tap_t
Structure for collecting status data, read from the TAP SRC register.
Definition: accel13.h:527
accel13_cfg_t::int1
pin_name_t int1
Definition: accel13.h:466
accel13_cfg_t
Click configuration structure definition.
Definition: accel13.h:452
accel13_6d_t::event_6d
uint8_t event_6d
Definition: accel13.h:545
accel13_user_offset_t
Structure for collecting data, read from the USER OFFSET registers.
Definition: accel13.h:559
accel13_init
ACCEL13_RETVAL accel13_init(accel13_t *ctx, accel13_cfg_t *cfg)
Initialization function.
accel13_s::read_f
accel13_master_io_t read_f
Definition: accel13.h:444
accel13_get_user_offset
void accel13_get_user_offset(accel13_t *ctx, accel13_user_offset_t *axis)
Read function for User offset data.
accel13_status_t::sleep_event
uint8_t sleep_event
Definition: accel13.h:499
accel13_axis_t::x
int16_t x
Definition: accel13.h:485
accel13_status_t::free_fall_event
uint8_t free_fall_event
Definition: accel13.h:503
accel13_generic_read_word
int16_t accel13_generic_read_word(accel13_t *ctx, uint8_t reg)
16bit read function.
accel13_cfg_t::cs
pin_name_t cs
Definition: accel13.h:461
accel13_axis_t::y
int16_t y
Definition: accel13.h:486
accel13_generic_write_bytes
void accel13_generic_write_bytes(accel13_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic write function.
accel13_axis_t::z
int16_t z
Definition: accel13.h:487
accel13_cfg_t::i2c_address
uint8_t i2c_address
Definition: accel13.h:471
accel13_s::cs
digital_out_t cs
Definition: accel13.h:427
accel13_cfg_t::int2
pin_name_t int2
Definition: accel13.h:465
accel13_6d_t::y_high
uint8_t y_high
Definition: accel13.h:548
accel13_6d_t::y_low
uint8_t y_low
Definition: accel13.h:549
accel13_6d_t::x_low
uint8_t x_low
Definition: accel13.h:551
ACCEL13_RETVAL
#define ACCEL13_RETVAL
Definition: accel13.h:77
accel13_get_temperature
float accel13_get_temperature(accel13_t *ctx)
Temperature functions.
accel13_s
Click ctx object definition.
Definition: accel13.h:424
accel13_tap_t::tap_y
uint8_t tap_y
Definition: accel13.h:534
accel13_get_tap_status
void accel13_get_tap_status(accel13_t *ctx, accel13_tap_t *tap_status)
Read function for Tap status data.
accel13_cfg_t::scl
pin_name_t scl
Definition: accel13.h:456
accel13_status_t
Structure for collecting status data, read from the STATUS registers.
Definition: accel13.h:495
accel13_t
struct accel13_s accel13_t
Click ctx object definition.
accel13_wake_up_t::free_fall_event
uint8_t free_fall_event
Definition: accel13.h:514
accel13_select_t
uint8_t accel13_select_t
Communication type.
Definition: accel13.h:414
accel13_user_offset_t::z
int8_t z
Definition: accel13.h:563
accel13_get_interrupt
uint8_t accel13_get_interrupt(accel13_t *ctx, uint8_t int_num)
Interrupt functions.
accel13_wake_up_t
Structure for collecting status data, read from the WAKE-UP SRC register.
Definition: accel13.h:512
accel13_status_t::double_tap_event
uint8_t double_tap_event
Definition: accel13.h:500
accel13_wake_up_t::wakeup_x
uint8_t wakeup_x
Definition: accel13.h:517
accel13_6d_t
Structure for collecting status data, read from the 6D SRC register.
Definition: accel13.h:543
accel13_status_t::single_tap_event
uint8_t single_tap_event
Definition: accel13.h:501
accel13_cfg_t::cs_polarity
spi_master_chip_select_polarity_t cs_polarity
Definition: accel13.h:474
accel13_s::slave_address
uint8_t slave_address
Definition: accel13.h:441
accel13_cfg_t::miso
pin_name_t miso
Definition: accel13.h:458
accel13_generic_read_bytes
void accel13_generic_read_bytes(accel13_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic 8bit read function.
accel13_s::int2
digital_in_t int2
Definition: accel13.h:431
accel13_get_wake_up_status
void accel13_get_wake_up_status(accel13_t *ctx, accel13_wake_up_t *wu_status)
Read function for Wake-up status data.
accel13_tap_t::single_tap
uint8_t single_tap
Definition: accel13.h:530
accel13_status_t::event_6d
uint8_t event_6d
Definition: accel13.h:502
accel13_6d_t::z_high
uint8_t z_high
Definition: accel13.h:546