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 "mikrosdk_version.h"
39 
40 #ifdef __GNUC__
41 #if mikroSDK_GET_VERSION < 20800ul
42 #include "rcu_delays.h"
43 #else
44 #include "delays.h"
45 #endif
46 #endif
47 
48 #include "drv_digital_out.h"
49 #include "drv_digital_in.h"
50 #include "drv_i2c_master.h"
51 #include "drv_spi_master.h"
52 
53 // -------------------------------------------------------------- PUBLIC MACROS
64 #define ACCEL13_MAP_MIKROBUS( cfg, mikrobus ) \
65  cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
66  cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
67  cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
68  cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
69  cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
70  cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
71  cfg.int2 = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
72  cfg.int1 = MIKROBUS( mikrobus, MIKROBUS_INT );
73 
79 #define ACCEL13_MASTER_I2C 0
80 #define ACCEL13_MASTER_SPI 1
81 
87 #define ACCEL13_RETVAL uint8_t
88 
89 #define ACCEL13_OK 0x00
90 #define ACCEL13_INIT_ERROR 0xFF
91 
97 #define ACCEL13_DEVICE_SLAVE_ADDR_GND 0x18
98 #define ACCEL13_DEVICE_SLAVE_ADDR_VCC 0x19
99 
104 #define ACCEL13_REG_TEMPERATURE_DATA_LSB 0x0D
105 #define ACCEL13_REG_TEMPERATURE_DATA_MSB 0x0E
106 #define ACCEL13_REG_WHO_AM_I 0x0F
107 #define ACCEL13_REG_CTRL_1 0x20
108 #define ACCEL13_REG_CTRL_2 0x21
109 #define ACCEL13_REG_CTRL_3 0x22
110 #define ACCEL13_REG_CTRL_4_INT1 0x23
111 #define ACCEL13_REG_CTRL_5_INT2 0x24
112 #define ACCEL13_REG_CTRL_6 0x25
113 #define ACCEL13_REG_TEMPERATURE_OUTPUT 0x26
114 #define ACCEL13_REG_STATUS 0x27
115 #define ACCEL13_REG_AXIS_X_LSB 0x28
116 #define ACCEL13_REG_AXIS_X_MSB 0x29
117 #define ACCEL13_REG_AXIS_Y_LSB 0x2A
118 #define ACCEL13_REG_AXIS_Y_MSB 0x2B
119 #define ACCEL13_REG_AXIS_Z_LSB 0x2C
120 #define ACCEL13_REG_AXIS_Z_MSB 0x2D
121 #define ACCEL13_REG_FIFO_CTRL 0x2E
122 #define ACCEL13_REG_FIFO_SAMPLES 0x2F
123 #define ACCEL13_REG_TAP_AXIS_X 0x30
124 #define ACCEL13_REG_TAP_AXIS_Y 0x31
125 #define ACCEL13_REG_TAP_AXIS_Z 0x32
126 #define ACCEL13_REG_INT_DURATION 0x33
127 #define ACCEL13_REG_WAKE_UP_THRESHOLD 0x34
128 #define ACCEL13_REG_WAKE_UP_DURATION 0x35
129 #define ACCEL13_REG_FREE_FALL_CONFIG 0x36
130 #define ACCEL13_REG_STATUS_DUP 0x37
131 #define ACCEL13_REG_WAKE_UP_SOURCE 0x38
132 #define ACCEL13_REG_TAP_SOURCE 0x39
133 #define ACCEL13_REG_6D_SOURCE 0x3A
134 #define ACCEL13_REG_ALL_INT_SOURCE 0x3B
135 #define ACCEL13_REG_X_OFFSET_USER 0x3C
136 #define ACCEL13_REG_Y_OFFSET_USER 0x3D
137 #define ACCEL13_REG_Z_OFFSET_USER 0x3E
138 #define ACCEL13_REG_CTRL_7 0x3F
139 
145 #define ACCEL13_DEF_WHO_AM_I 0x44
146 
152 #define ACCEL13_CTRL1_ODR_POWER_DOWN 0x00
153 #define ACCEL13_CTRL1_ODR_LOW_POWER_MODE_12p5_1p6Hz 0x10
154 #define ACCEL13_CTRL1_ODR_LOW_POWER_MODE_12p5Hz 0x20
155 #define ACCEL13_CTRL1_ODR_LOW_POWER_MODE_25Hz 0x30
156 #define ACCEL13_CTRL1_ODR_LOW_POWER_MODE_50Hz 0x40
157 #define ACCEL13_CTRL1_ODR_LOW_POWER_MODE_100Hz 0x50
158 #define ACCEL13_CTRL1_ODR_LOW_POWER_MODE_200Hz 0x60
159 #define ACCEL13_CTRL1_ODR_LOW_POWER_MODE_400_200Hz 0x70
160 #define ACCEL13_CTRL1_ODR_LOW_POWER_MODE_800_200Hz 0x80
161 #define ACCEL13_CTRL1_ODR_LOW_POWER_MODE_1600_200Hz 0x90
162 #define ACCEL13_CTRL1_MODE_LOW_POWER_MODE_12_14bit 0x00
163 #define ACCEL13_CTRL1_MODE_HIGH_PERFORMANCE_MODE_14bit 0x04
164 #define ACCEL13_CTRL1_SINGLE_DATA_CONVERSION_12_14bit 0x08
165 #define ACCEL13_CTRL1_LP_MODE_1 0x00
166 #define ACCEL13_CTRL1_LP_MODE_2 0x01
167 #define ACCEL13_CTRL1_LP_MODE_3 0x02
168 #define ACCEL13_CTRL1_LP_MODE_4 0x03
169 
175 #define ACCEL13_CTRL2_BOOT_DISABLE 0x00
176 #define ACCEL13_CTRL2_BOOT_ENABLE 0x80
177 #define ACCEL13_CTRL2_SOFT_RESET_DISABLE 0x00
178 #define ACCEL13_CTRL2_SOFT_RESET_ENABLE 0x20
179 #define ACCEL13_CTRL2_PULLUP_CS_PIN_ENABLE 0x00
180 #define ACCEL13_CTRL2_PULLUP_CS_PIN_DISABLE 0x10
181 #define ACCEL13_CTRL2_BDU_CONTINUOUS_UPDATE 0x00
182 #define ACCEL13_CTRL2_BDU_UPDATE_REGISTER 0x08
183 #define ACCEL13_CTRL2_IF_ADD_INC_ENABLED 0x04
184 #define ACCEL13_CTRL2_IF_ADD_INC_DISABLED 0x00
185 #define ACCEL13_CTRL2_I2C_AND_SPI_ENABLE 0x00
186 #define ACCEL13_CTRL2_I2C_DISABLE 0x02
187 #define ACCEL13_CTRL2_SPI_4_WIRE 0x00
188 #define ACCEL13_CTRL2_SPI_3_WIRE 0x01
189 
195 #define ACCEL13_CTRL3_SELF_TEST_DISABLE 0x00
196 #define ACCEL13_CTRL3_SELF_TEST_POS_SIGN 0x40
197 #define ACCEL13_CTRL3_SELF_TEST_NEG_SIGN 0x80
198 #define ACCEL13_CTRL3_PUSH_PULL_INT_PAD 0x00
199 #define ACCEL13_CTRL3_OPEN_DRAIN_INT_PAD 0x20
200 #define ACCEL13_CTRL3_LATCHED_INT_ENABLE 0x20
201 #define ACCEL13_CTRL3_LATCHED_INT_DISABLE 0x10
202 #define ACCEL13_CTRL3_INT_ACTIVE_HIGH 0x00
203 #define ACCEL13_CTRL3_INT_ACTIVE_LOW 0x08
204 #define ACCEL13_CTRL3_SLP_MODE_SEL_EN_INT2 0x00
205 #define ACCEL13_CTRL3_SLP_MODE_SEL_EN_MODE1 0x02
206 
212 #define ACCEL13_CTRL4_INT1_6D_DISABLED 0x00
213 #define ACCEL13_CTRL4_INT1_6D_ENABLED 0x80
214 #define ACCEL13_CTRL4_INT1_SINGLE_TAP_DISABLED 0x00
215 #define ACCEL13_CTRL4_INT1_SINGLE_TAP_ENABLED 0x40
216 #define ACCEL13_CTRL4_INT1_WAKEUP_DISABLED 0x00
217 #define ACCEL13_CTRL4_INT1_WAKEUP_ENABLED 0x20
218 #define ACCEL13_CTRL4_INT1_FREE_FALL_DISABLED 0x00
219 #define ACCEL13_CTRL4_INT1_FREE_FALL_ENABLED 0x10
220 #define ACCEL13_CTRL4_INT1_TAP_DISABLED 0x00
221 #define ACCEL13_CTRL4_INT1_TAP_ENABLED 0x08
222 #define ACCEL13_CTRL4_INT1_DIFF5_DISABLED 0x00
223 #define ACCEL13_CTRL4_INT1_DIFF5_ENABLED 0x04
224 #define ACCEL13_CTRL4_INT1_FTH_DISABLED 0x00
225 #define ACCEL13_CTRL4_INT1_FTH_ENABLED 0x02
226 #define ACCEL13_CTRL4_INT1_DRDY_DISABLED 0x00
227 #define ACCEL13_CTRL4_INT1_DRDY_ENABLED 0x01
228 
234 #define ACCEL13_CTRL5_INT2_SLEEP_STATE_DISABLED 0x00
235 #define ACCEL13_CTRL5_INT2_SLEEP_STATE_ENABLED 0x80
236 #define ACCEL13_CTRL5_INT2_SLEEP_CHG_DISABLED 0x00
237 #define ACCEL13_CTRL5_INT2_SLEEP_CHG_ENABLED 0x40
238 #define ACCEL13_CTRL5_INT2_BOOT_DISABLED 0x00
239 #define ACCEL13_CTRL5_INT2_BOOT_ENABLED 0x20
240 #define ACCEL13_CTRL5_INT2_T_DRDY_DISABLED 0x00
241 #define ACCEL13_CTRL5_INT2_T_DRDY_ENABLED 0x10
242 #define ACCEL13_CTRL5_INT2_OVR_DISABLED 0x00
243 #define ACCEL13_CTRL5_INT2_OVR_ENABLED 0x08
244 #define ACCEL13_CTRL4_INT2_DIFF5_DISABLED 0x00
245 #define ACCEL13_CTRL4_INT2_DIFF5_ENABLED 0x04
246 #define ACCEL13_CTRL4_INT2_FTH_DISABLED 0x00
247 #define ACCEL13_CTRL4_INT2_FTH_ENABLED 0x02
248 #define ACCEL13_CTRL4_INT2_DRDY_DISABLED 0x00
249 #define ACCEL13_CTRL4_INT2_DRDY_ENABLED 0x01
250 
256 #define ACCEL13_CTRL6_BW_FILT_ODR_2 0x00
257 #define ACCEL13_CTRL6_BW_FILT_ODR_4 0x40
258 #define ACCEL13_CTRL6_BW_FILT_ODR_10 0x80
259 #define ACCEL13_CTRL6_BW_FILT_ODR_20 0xC0
260 #define ACCEL13_CTRL6_FULL_SCALE_2g 0x00
261 #define ACCEL13_CTRL6_FULL_SCALE_4g 0x10
262 #define ACCEL13_CTRL6_FULL_SCALE_8g 0x20
263 #define ACCEL13_CTRL6_FULL_SCALE_16g 0x30
264 #define ACCEL13_CTRL6_FDS_LOW_PASS 0x00
265 #define ACCEL13_CTRL6_FDS_HIGH_PASS 0x08
266 #define ACCEL13_CTRL6_LOW_NOISE_DISABLE 0x00
267 #define ACCEL13_CTRL6_LOW_NOISE_ENABLE 0x04
268 
274 #define ACCEL13_FCTRL_BYPASS_MODE 0x00
275 #define ACCEL13_FCTRL_FIFO_MODE 0x20
276 #define ACCEL13_FCTRL_CONTINUOUS_TO_FIFO 0x60
277 #define ACCEL13_FCTRL_BYPASS_TO_CONTINUOUS 0x80
278 #define ACCEL13_FCTRL_CONTINUOUS_MODE 0xC0
279 
285 #define ACCEL3_TAPTHX_4DEN_NO_POSITION_DETECTED 0x00
286 #define ACCEL3_TAPTHX_4DEN_POSITION_DETECTED 0x80
287 #define ACCEL3_TAPTHX_6DTHS_80_DEGREES 0x00
288 #define ACCEL3_TAPTHX_6DTHS_70_DEGREES 0x20
289 #define ACCEL3_TAPTHX_6DTHS_60_DEGREES 0x40
290 #define ACCEL3_TAPTHX_6DTHS_50_DEGREES 0x60
291 
297 #define ACCEL3_TAPTHY_PERIOD_X_Y_Z 0x00
298 #define ACCEL3_TAPTHY_PERIOD_Y_X_Z 0x20
299 #define ACCEL3_TAPTHY_PERIOD_X_Z_Y 0x40
300 #define ACCEL3_TAPTHY_PERIOD_Z_Y_X 0x60
301 
307 #define ACCEL13_TAPTHZ_TAP_X_DISABLE 0x00
308 #define ACCEL13_TAPTHZ_TAP_Y_DISABLE 0x00
309 #define ACCEL13_TAPTHZ_TAP_Z_DISABLE 0x00
310 #define ACCEL13_TAPTHZ_TAP_X_ENABLE 0x80
311 #define ACCEL13_TAPTHZ_TAP_Y_ENABLE 0x40
312 #define ACCEL13_TAPTHZ_TAP_Z_ENABLE 0x20
313 
319 #define ACCEL13_WUT_TAP_SINGLE_EN 0x00
320 #define ACCEL13_WUT_TAP_SINGLE_AND_DOUBLE_EN 0x80
321 #define ACCEL13_WUT_SLEEP_DISABLE 0x00
322 #define ACCEL13_WUT_SLEEP_ENABLE 0x40
323 
329 #define ACCEL13_FFTHS_DECODING_LSB_5 0x00
330 #define ACCEL13_FFTHS_DECODING_LSB_7 0x01
331 #define ACCEL13_FFTHS_DECODING_LSB_8 0x02
332 #define ACCEL13_FFTHS_DECODING_LSB_10 0x03
333 #define ACCEL13_FFTHS_DECODING_LSB_11 0x04
334 #define ACCEL13_FFTHS_DECODING_LSB_13 0x05
335 #define ACCEL13_FFTHS_DECODING_LSB_15 0x06
336 #define ACCEL13_FFTHS_DECODING_LSB_16 0x07
337 
343 #define ACCEL13_SDUR_OVR_FIFO_NOT_COMPLETELY 0x00
344 #define ACCEL13_SDUR_OVR_FIFO_COMPLETELY 0x80
345 #define ACCEL13_SDUR_T_DRDY_NO_DATA 0x00
346 #define ACCEL13_SDUR_T_DRDY_DATA_IS_AVAILABLE 0x40
347 #define ACCEL13_SDUR_SLEEP_EVENT_NO_DETECT 0x00
348 #define ACCEL13_SDUR_SLEEP_EVENT_DETECT 0x20
349 #define ACCEL13_SDUR_DOUBLE_TAP_EVENT_NO_DETECT 0x00
350 #define ACCEL13_SDUR_DOUBLE_TAP_EVENT_DETECT 0x10
351 #define ACCEL13_SDUR_SINGLE_TAP_EVENT_NO_DETECT 0x00
352 #define ACCEL13_SDUR_SINGLE_TAP_EVENT_DETECT 0x08
353 #define ACCEL13_SDUR_6D_IA_EVENT_NO_DETECT 0x00
354 #define ACCEL13_SDUR_6D_IA_EVENT_DETECT 0x04
355 #define ACCEL13_SDUR_FF_IA_EVENT_NO_DETECT 0x00
356 #define ACCEL13_SDUR_FF_IA_EVENT_DETECT 0x02
357 #define ACCEL13_SDUR_DRDY_NO_READY 0x00
358 #define ACCEL13_SDUR_DRDY_XYZ_NEW_DATA_AVAILABLE 0x01
359 
365 #define ACCEL13_WUSRC_FF_IA_EVENT_NO_DETECT 0x00
366 #define ACCEL13_WUSRC_FF_IA_EVENT_DETECT 0x20
367 #define ACCEL13_WUSRC_SLEEP_EVENT_NO_DETECT 0x00
368 #define ACCEL13_WUSRC_SLEEP_EVENT_DETECT 0x10
369 #define ACCEL13_WUSRC_WAKEUP_EVENT_NO_DETECT 0x00
370 #define ACCEL13_WUSRC_WAKEUP_EVENT_DETECT 0x08
371 #define ACCEL13_WUSRC_WAKEUP_X_EVENT_NO_DETECT 0x00
372 #define ACCEL13_WUSRC_WAKEUP_X_EVENT_DETECT 0x04
373 #define ACCEL13_WUSRC_WAKEUP_Y_EVENT_NO_DETECT 0x00
374 #define ACCEL13_WUSRC_WAKEUP_Y_EVENT_DETECT 0x02
375 #define ACCEL13_WUSRC_WAKEUP_Z_EVENT_NO_DETECT 0x00
376 #define ACCEL13_WUSRC_WAKEUP_Z_EVENT_DETECT 0x01
377 
383 #define ACCEL13_TAPSRC_TAP_IA_EVENT_NO_DETECT 0x00
384 #define ACCEL13_TAPSRC_TAP_EVENT_DETECT 0x40
385 #define ACCEL13_TAPSRC_SINGLE_TAP_EVENT_NO_DETECT 0x00
386 #define ACCEL13_TAPSRC_SINGLE_TAP_EVENT_DETECT 0x20
387 #define ACCEL13_TAPSRC_DOUBLE_TAP_EVENT_NO_DETECT 0x00
388 #define ACCEL13_TAPSRC_DOUBLE_TAP_EVENT_DETECT 0x10
389 #define ACCEL13_TAPSRC_TAP_SIGN_EVENT_NO_DETECT 0x00
390 #define ACCEL13_TAPSRC_TAP_SIGN_EVENT_DETECT 0x08
391 #define ACCEL13_TAPSRC_X_TAP_EVENT_NO_DETECT 0x00
392 #define ACCEL13_TAPSRC_X_TAP_EVENT_DETECT 0x04
393 #define ACCEL13_TAPSRC_Y_TAP_EVENT_NO_DETECT 0x00
394 #define ACCEL13_TAPSRC_Y_TAP_EVENT_DETECT 0x02
395 #define ACCEL13_TAPSRC_Z_TAP_EVENT_NO_DETECT 0x00
396 #define ACCEL13_TAPSRC_Z_TAP_EVENT_DETECT 0x01
397 
403 #define ACCEL13_SIXDSRC_6D_IA_EVENT_NO_DETECT 0x00
404 
410 #define ACCEL13_INT_PIN_INTERRUPT_1 0x00
411 #define ACCEL13_PWM_PIN_INTERRUPT_2 0x01
412  // End group macro
415 // --------------------------------------------------------------- PUBLIC TYPES
424 typedef uint8_t accel13_select_t;
425 
429 typedef void ( *accel13_master_io_t )( struct accel13_s*, uint8_t, uint8_t*, uint8_t );
430 
434 typedef struct accel13_s
435 {
436  // Output pins
437  digital_out_t cs;
438 
439  // Input pins
440 
441  digital_in_t int2;
442  digital_in_t int1;
443 
444  // Modules
445 
446  i2c_master_t i2c;
447  spi_master_t spi;
448 
449  // ctx variable
450 
451  uint8_t slave_address;
452  pin_name_t chip_select;
456 
458 
462 typedef struct
463 {
464  // Communication gpio pins
465 
466  pin_name_t scl;
467  pin_name_t sda;
468  pin_name_t miso;
469  pin_name_t mosi;
470  pin_name_t sck;
471  pin_name_t cs;
472 
473  // Additional gpio pins
474 
475  pin_name_t int2;
476  pin_name_t int1;
477 
478  // static variable
479 
480  uint32_t i2c_speed;
481  uint8_t i2c_address;
482  uint32_t spi_speed;
483  uint8_t spi_mode;
484  spi_master_chip_select_polarity_t cs_polarity;
485 
487 
488 } accel13_cfg_t;
489 
493 typedef struct
494 {
495  int16_t x;
496  int16_t y;
497  int16_t z;
498 
500 
505 typedef struct
506 {
507  uint8_t fifo_threshold;
508  uint8_t wakeup_event;
509  uint8_t sleep_event;
512  uint8_t event_6d;
514  uint8_t drdy_event;
515 
517 
522 typedef struct
523 {
525  uint8_t sleep_event;
526  uint8_t wakeup_event;
527  uint8_t wakeup_x;
528  uint8_t wakeup_y;
529  uint8_t wakeup_z;
530 
532 
537 typedef struct
538 {
539  uint8_t tap;
540  uint8_t single_tap;
541  uint8_t double_tap;
542  uint8_t sign_tap;
543  uint8_t tap_x;
544  uint8_t tap_y;
545  uint8_t tap_z;
546 
547 } accel13_tap_t;
548 
553 typedef struct
554 {
555  uint8_t event_6d;
556  uint8_t z_high;
557  uint8_t z_low;
558  uint8_t y_high;
559  uint8_t y_low;
560  uint8_t x_high;
561  uint8_t x_low;
562 
563 } accel13_6d_t;
564 
569 typedef struct
570 {
571  int8_t x;
572  int8_t y;
573  int8_t z;
574 
576  // End types group
578 // ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
584 #ifdef __cplusplus
585 extern "C"{
586 #endif
587 
597 
606 
675 
686 void accel13_generic_write_bytes ( accel13_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len );
687 
697 void accel13_generic_write_single_byte ( accel13_t *ctx, uint8_t reg, uint8_t data_in );
698 
709 void accel13_generic_read_bytes ( accel13_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len );
710 
721 int16_t accel13_generic_read_word ( accel13_t *ctx, uint8_t reg );
722 
731 
741 
751 
761 
770 void accel13_get_tap_status ( accel13_t *ctx, accel13_tap_t *tap_status );
771 
780 void accel13_get_6d_status ( accel13_t *ctx, accel13_6d_t *sixd_status );
781 
791 
801 
812 uint8_t accel13_get_interrupt ( accel13_t *ctx, uint8_t int_num );
813 
814 #ifdef __cplusplus
815 }
816 #endif
817 #endif // _ACCEL13_H_
818  // End public_function group
821 
822 // ------------------------------------------------------------------------- END
accel13_cfg_t::sck
pin_name_t sck
Definition: accel13.h:470
accel13_status_t::wakeup_event
uint8_t wakeup_event
Definition: accel13.h:508
accel13_tap_t::sign_tap
uint8_t sign_tap
Definition: accel13.h:542
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:452
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:429
accel13_s::i2c
i2c_master_t i2c
Definition: accel13.h:446
accel13_wake_up_t::wakeup_event
uint8_t wakeup_event
Definition: accel13.h:526
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:447
accel13_axis_t
Accel axis data structure.
Definition: accel13.h:494
accel13_6d_t::z_low
uint8_t z_low
Definition: accel13.h:557
accel13_tap_t::tap_z
uint8_t tap_z
Definition: accel13.h:545
accel13_tap_t::tap_x
uint8_t tap_x
Definition: accel13.h:543
accel13_user_offset_t::y
int8_t y
Definition: accel13.h:572
accel13_tap_t::tap
uint8_t tap
Definition: accel13.h:539
accel13_wake_up_t::sleep_event
uint8_t sleep_event
Definition: accel13.h:525
accel13_s::write_f
accel13_master_io_t write_f
Definition: accel13.h:453
accel13_cfg_t::mosi
pin_name_t mosi
Definition: accel13.h:469
accel13_tap_t::double_tap
uint8_t double_tap
Definition: accel13.h:541
accel13_cfg_t::sel
accel13_select_t sel
Definition: accel13.h:486
accel13_cfg_t::spi_speed
uint32_t spi_speed
Definition: accel13.h:482
accel13_cfg_t::i2c_speed
uint32_t i2c_speed
Definition: accel13.h:480
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:467
accel13_6d_t::x_high
uint8_t x_high
Definition: accel13.h:560
accel13_cfg_t::spi_mode
uint8_t spi_mode
Definition: accel13.h:483
accel13_s::master_sel
accel13_select_t master_sel
Definition: accel13.h:455
accel13_s::int1
digital_in_t int1
Definition: accel13.h:442
accel13_status_t::fifo_threshold
uint8_t fifo_threshold
Definition: accel13.h:507
accel13_wake_up_t::wakeup_y
uint8_t wakeup_y
Definition: accel13.h:528
accel13_wake_up_t::wakeup_z
uint8_t wakeup_z
Definition: accel13.h:529
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:571
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:514
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:538
accel13_cfg_t::int1
pin_name_t int1
Definition: accel13.h:476
accel13_cfg_t
Click configuration structure definition.
Definition: accel13.h:463
accel13_6d_t::event_6d
uint8_t event_6d
Definition: accel13.h:555
accel13_user_offset_t
Structure for collecting data, read from the USER OFFSET registers.
Definition: accel13.h:570
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:454
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:509
accel13_axis_t::x
int16_t x
Definition: accel13.h:495
accel13_status_t::free_fall_event
uint8_t free_fall_event
Definition: accel13.h:513
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:471
accel13_axis_t::y
int16_t y
Definition: accel13.h:496
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:497
accel13_cfg_t::i2c_address
uint8_t i2c_address
Definition: accel13.h:481
accel13_s::cs
digital_out_t cs
Definition: accel13.h:437
accel13_cfg_t::int2
pin_name_t int2
Definition: accel13.h:475
accel13_6d_t::y_high
uint8_t y_high
Definition: accel13.h:558
accel13_t
struct accel13_s accel13_t
Click ctx object definition.
accel13_6d_t::y_low
uint8_t y_low
Definition: accel13.h:559
accel13_6d_t::x_low
uint8_t x_low
Definition: accel13.h:561
ACCEL13_RETVAL
#define ACCEL13_RETVAL
Definition: accel13.h:87
accel13_get_temperature
float accel13_get_temperature(accel13_t *ctx)
Temperature functions.
accel13_s
Click ctx object definition.
Definition: accel13.h:435
accel13_tap_t::tap_y
uint8_t tap_y
Definition: accel13.h:544
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:466
accel13_status_t
Structure for collecting status data, read from the STATUS registers.
Definition: accel13.h:506
accel13_wake_up_t::free_fall_event
uint8_t free_fall_event
Definition: accel13.h:524
accel13_select_t
uint8_t accel13_select_t
Communication type.
Definition: accel13.h:424
accel13_user_offset_t::z
int8_t z
Definition: accel13.h:573
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:523
accel13_status_t::double_tap_event
uint8_t double_tap_event
Definition: accel13.h:510
accel13_wake_up_t::wakeup_x
uint8_t wakeup_x
Definition: accel13.h:527
accel13_6d_t
Structure for collecting status data, read from the 6D SRC register.
Definition: accel13.h:554
accel13_status_t::single_tap_event
uint8_t single_tap_event
Definition: accel13.h:511
accel13_cfg_t::cs_polarity
spi_master_chip_select_polarity_t cs_polarity
Definition: accel13.h:484
accel13_s::slave_address
uint8_t slave_address
Definition: accel13.h:451
accel13_cfg_t::miso
pin_name_t miso
Definition: accel13.h:468
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:441
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:540
accel13_status_t::event_6d
uint8_t event_6d
Definition: accel13.h:512
accel13_6d_t::z_high
uint8_t z_high
Definition: accel13.h:556