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 
42 #ifdef PREINIT_SUPPORTED
43 #include "preinit.h"
44 #endif
45 
46 #ifdef MikroCCoreVersion
47  #if MikroCCoreVersion >= 1
48  #include "delays.h"
49  #endif
50 #endif
51 
52 #include "drv_digital_out.h"
53 #include "drv_digital_in.h"
54 #include "drv_i2c_master.h"
55 #include "drv_spi_master.h"
56 
57 // -------------------------------------------------------------- PUBLIC MACROS
68 #define ACCEL13_MAP_MIKROBUS( cfg, mikrobus ) \
69  cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
70  cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
71  cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
72  cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
73  cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
74  cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
75  cfg.int2 = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
76  cfg.int1 = MIKROBUS( mikrobus, MIKROBUS_INT );
77 
83 #define ACCEL13_MASTER_I2C 0
84 #define ACCEL13_MASTER_SPI 1
85 
91 #define ACCEL13_RETVAL uint8_t
92 
93 #define ACCEL13_OK 0x00
94 #define ACCEL13_INIT_ERROR 0xFF
95 
101 #define ACCEL13_DEVICE_SLAVE_ADDR_GND 0x18
102 #define ACCEL13_DEVICE_SLAVE_ADDR_VCC 0x19
103 
108 #define ACCEL13_REG_TEMPERATURE_DATA_LSB 0x0D
109 #define ACCEL13_REG_TEMPERATURE_DATA_MSB 0x0E
110 #define ACCEL13_REG_WHO_AM_I 0x0F
111 #define ACCEL13_REG_CTRL_1 0x20
112 #define ACCEL13_REG_CTRL_2 0x21
113 #define ACCEL13_REG_CTRL_3 0x22
114 #define ACCEL13_REG_CTRL_4_INT1 0x23
115 #define ACCEL13_REG_CTRL_5_INT2 0x24
116 #define ACCEL13_REG_CTRL_6 0x25
117 #define ACCEL13_REG_TEMPERATURE_OUTPUT 0x26
118 #define ACCEL13_REG_STATUS 0x27
119 #define ACCEL13_REG_AXIS_X_LSB 0x28
120 #define ACCEL13_REG_AXIS_X_MSB 0x29
121 #define ACCEL13_REG_AXIS_Y_LSB 0x2A
122 #define ACCEL13_REG_AXIS_Y_MSB 0x2B
123 #define ACCEL13_REG_AXIS_Z_LSB 0x2C
124 #define ACCEL13_REG_AXIS_Z_MSB 0x2D
125 #define ACCEL13_REG_FIFO_CTRL 0x2E
126 #define ACCEL13_REG_FIFO_SAMPLES 0x2F
127 #define ACCEL13_REG_TAP_AXIS_X 0x30
128 #define ACCEL13_REG_TAP_AXIS_Y 0x31
129 #define ACCEL13_REG_TAP_AXIS_Z 0x32
130 #define ACCEL13_REG_INT_DURATION 0x33
131 #define ACCEL13_REG_WAKE_UP_THRESHOLD 0x34
132 #define ACCEL13_REG_WAKE_UP_DURATION 0x35
133 #define ACCEL13_REG_FREE_FALL_CONFIG 0x36
134 #define ACCEL13_REG_STATUS_DUP 0x37
135 #define ACCEL13_REG_WAKE_UP_SOURCE 0x38
136 #define ACCEL13_REG_TAP_SOURCE 0x39
137 #define ACCEL13_REG_6D_SOURCE 0x3A
138 #define ACCEL13_REG_ALL_INT_SOURCE 0x3B
139 #define ACCEL13_REG_X_OFFSET_USER 0x3C
140 #define ACCEL13_REG_Y_OFFSET_USER 0x3D
141 #define ACCEL13_REG_Z_OFFSET_USER 0x3E
142 #define ACCEL13_REG_CTRL_7 0x3F
143 
149 #define ACCEL13_DEF_WHO_AM_I 0x44
150 
156 #define ACCEL13_CTRL1_ODR_POWER_DOWN 0x00
157 #define ACCEL13_CTRL1_ODR_LOW_POWER_MODE_12p5_1p6Hz 0x10
158 #define ACCEL13_CTRL1_ODR_LOW_POWER_MODE_12p5Hz 0x20
159 #define ACCEL13_CTRL1_ODR_LOW_POWER_MODE_25Hz 0x30
160 #define ACCEL13_CTRL1_ODR_LOW_POWER_MODE_50Hz 0x40
161 #define ACCEL13_CTRL1_ODR_LOW_POWER_MODE_100Hz 0x50
162 #define ACCEL13_CTRL1_ODR_LOW_POWER_MODE_200Hz 0x60
163 #define ACCEL13_CTRL1_ODR_LOW_POWER_MODE_400_200Hz 0x70
164 #define ACCEL13_CTRL1_ODR_LOW_POWER_MODE_800_200Hz 0x80
165 #define ACCEL13_CTRL1_ODR_LOW_POWER_MODE_1600_200Hz 0x90
166 #define ACCEL13_CTRL1_MODE_LOW_POWER_MODE_12_14bit 0x00
167 #define ACCEL13_CTRL1_MODE_HIGH_PERFORMANCE_MODE_14bit 0x04
168 #define ACCEL13_CTRL1_SINGLE_DATA_CONVERSION_12_14bit 0x08
169 #define ACCEL13_CTRL1_LP_MODE_1 0x00
170 #define ACCEL13_CTRL1_LP_MODE_2 0x01
171 #define ACCEL13_CTRL1_LP_MODE_3 0x02
172 #define ACCEL13_CTRL1_LP_MODE_4 0x03
173 
179 #define ACCEL13_CTRL2_BOOT_DISABLE 0x00
180 #define ACCEL13_CTRL2_BOOT_ENABLE 0x80
181 #define ACCEL13_CTRL2_SOFT_RESET_DISABLE 0x00
182 #define ACCEL13_CTRL2_SOFT_RESET_ENABLE 0x20
183 #define ACCEL13_CTRL2_PULLUP_CS_PIN_ENABLE 0x00
184 #define ACCEL13_CTRL2_PULLUP_CS_PIN_DISABLE 0x10
185 #define ACCEL13_CTRL2_BDU_CONTINUOUS_UPDATE 0x00
186 #define ACCEL13_CTRL2_BDU_UPDATE_REGISTER 0x08
187 #define ACCEL13_CTRL2_IF_ADD_INC_ENABLED 0x04
188 #define ACCEL13_CTRL2_IF_ADD_INC_DISABLED 0x00
189 #define ACCEL13_CTRL2_I2C_AND_SPI_ENABLE 0x00
190 #define ACCEL13_CTRL2_I2C_DISABLE 0x02
191 #define ACCEL13_CTRL2_SPI_4_WIRE 0x00
192 #define ACCEL13_CTRL2_SPI_3_WIRE 0x01
193 
199 #define ACCEL13_CTRL3_SELF_TEST_DISABLE 0x00
200 #define ACCEL13_CTRL3_SELF_TEST_POS_SIGN 0x40
201 #define ACCEL13_CTRL3_SELF_TEST_NEG_SIGN 0x80
202 #define ACCEL13_CTRL3_PUSH_PULL_INT_PAD 0x00
203 #define ACCEL13_CTRL3_OPEN_DRAIN_INT_PAD 0x20
204 #define ACCEL13_CTRL3_LATCHED_INT_ENABLE 0x20
205 #define ACCEL13_CTRL3_LATCHED_INT_DISABLE 0x10
206 #define ACCEL13_CTRL3_INT_ACTIVE_HIGH 0x00
207 #define ACCEL13_CTRL3_INT_ACTIVE_LOW 0x08
208 #define ACCEL13_CTRL3_SLP_MODE_SEL_EN_INT2 0x00
209 #define ACCEL13_CTRL3_SLP_MODE_SEL_EN_MODE1 0x02
210 
216 #define ACCEL13_CTRL4_INT1_6D_DISABLED 0x00
217 #define ACCEL13_CTRL4_INT1_6D_ENABLED 0x80
218 #define ACCEL13_CTRL4_INT1_SINGLE_TAP_DISABLED 0x00
219 #define ACCEL13_CTRL4_INT1_SINGLE_TAP_ENABLED 0x40
220 #define ACCEL13_CTRL4_INT1_WAKEUP_DISABLED 0x00
221 #define ACCEL13_CTRL4_INT1_WAKEUP_ENABLED 0x20
222 #define ACCEL13_CTRL4_INT1_FREE_FALL_DISABLED 0x00
223 #define ACCEL13_CTRL4_INT1_FREE_FALL_ENABLED 0x10
224 #define ACCEL13_CTRL4_INT1_TAP_DISABLED 0x00
225 #define ACCEL13_CTRL4_INT1_TAP_ENABLED 0x08
226 #define ACCEL13_CTRL4_INT1_DIFF5_DISABLED 0x00
227 #define ACCEL13_CTRL4_INT1_DIFF5_ENABLED 0x04
228 #define ACCEL13_CTRL4_INT1_FTH_DISABLED 0x00
229 #define ACCEL13_CTRL4_INT1_FTH_ENABLED 0x02
230 #define ACCEL13_CTRL4_INT1_DRDY_DISABLED 0x00
231 #define ACCEL13_CTRL4_INT1_DRDY_ENABLED 0x01
232 
238 #define ACCEL13_CTRL5_INT2_SLEEP_STATE_DISABLED 0x00
239 #define ACCEL13_CTRL5_INT2_SLEEP_STATE_ENABLED 0x80
240 #define ACCEL13_CTRL5_INT2_SLEEP_CHG_DISABLED 0x00
241 #define ACCEL13_CTRL5_INT2_SLEEP_CHG_ENABLED 0x40
242 #define ACCEL13_CTRL5_INT2_BOOT_DISABLED 0x00
243 #define ACCEL13_CTRL5_INT2_BOOT_ENABLED 0x20
244 #define ACCEL13_CTRL5_INT2_T_DRDY_DISABLED 0x00
245 #define ACCEL13_CTRL5_INT2_T_DRDY_ENABLED 0x10
246 #define ACCEL13_CTRL5_INT2_OVR_DISABLED 0x00
247 #define ACCEL13_CTRL5_INT2_OVR_ENABLED 0x08
248 #define ACCEL13_CTRL4_INT2_DIFF5_DISABLED 0x00
249 #define ACCEL13_CTRL4_INT2_DIFF5_ENABLED 0x04
250 #define ACCEL13_CTRL4_INT2_FTH_DISABLED 0x00
251 #define ACCEL13_CTRL4_INT2_FTH_ENABLED 0x02
252 #define ACCEL13_CTRL4_INT2_DRDY_DISABLED 0x00
253 #define ACCEL13_CTRL4_INT2_DRDY_ENABLED 0x01
254 
260 #define ACCEL13_CTRL6_BW_FILT_ODR_2 0x00
261 #define ACCEL13_CTRL6_BW_FILT_ODR_4 0x40
262 #define ACCEL13_CTRL6_BW_FILT_ODR_10 0x80
263 #define ACCEL13_CTRL6_BW_FILT_ODR_20 0xC0
264 #define ACCEL13_CTRL6_FULL_SCALE_2g 0x00
265 #define ACCEL13_CTRL6_FULL_SCALE_4g 0x10
266 #define ACCEL13_CTRL6_FULL_SCALE_8g 0x20
267 #define ACCEL13_CTRL6_FULL_SCALE_16g 0x30
268 #define ACCEL13_CTRL6_FDS_LOW_PASS 0x00
269 #define ACCEL13_CTRL6_FDS_HIGH_PASS 0x08
270 #define ACCEL13_CTRL6_LOW_NOISE_DISABLE 0x00
271 #define ACCEL13_CTRL6_LOW_NOISE_ENABLE 0x04
272 
278 #define ACCEL13_FCTRL_BYPASS_MODE 0x00
279 #define ACCEL13_FCTRL_FIFO_MODE 0x20
280 #define ACCEL13_FCTRL_CONTINUOUS_TO_FIFO 0x60
281 #define ACCEL13_FCTRL_BYPASS_TO_CONTINUOUS 0x80
282 #define ACCEL13_FCTRL_CONTINUOUS_MODE 0xC0
283 
289 #define ACCEL3_TAPTHX_4DEN_NO_POSITION_DETECTED 0x00
290 #define ACCEL3_TAPTHX_4DEN_POSITION_DETECTED 0x80
291 #define ACCEL3_TAPTHX_6DTHS_80_DEGREES 0x00
292 #define ACCEL3_TAPTHX_6DTHS_70_DEGREES 0x20
293 #define ACCEL3_TAPTHX_6DTHS_60_DEGREES 0x40
294 #define ACCEL3_TAPTHX_6DTHS_50_DEGREES 0x60
295 
301 #define ACCEL3_TAPTHY_PERIOD_X_Y_Z 0x00
302 #define ACCEL3_TAPTHY_PERIOD_Y_X_Z 0x20
303 #define ACCEL3_TAPTHY_PERIOD_X_Z_Y 0x40
304 #define ACCEL3_TAPTHY_PERIOD_Z_Y_X 0x60
305 
311 #define ACCEL13_TAPTHZ_TAP_X_DISABLE 0x00
312 #define ACCEL13_TAPTHZ_TAP_Y_DISABLE 0x00
313 #define ACCEL13_TAPTHZ_TAP_Z_DISABLE 0x00
314 #define ACCEL13_TAPTHZ_TAP_X_ENABLE 0x80
315 #define ACCEL13_TAPTHZ_TAP_Y_ENABLE 0x40
316 #define ACCEL13_TAPTHZ_TAP_Z_ENABLE 0x20
317 
323 #define ACCEL13_WUT_TAP_SINGLE_EN 0x00
324 #define ACCEL13_WUT_TAP_SINGLE_AND_DOUBLE_EN 0x80
325 #define ACCEL13_WUT_SLEEP_DISABLE 0x00
326 #define ACCEL13_WUT_SLEEP_ENABLE 0x40
327 
333 #define ACCEL13_FFTHS_DECODING_LSB_5 0x00
334 #define ACCEL13_FFTHS_DECODING_LSB_7 0x01
335 #define ACCEL13_FFTHS_DECODING_LSB_8 0x02
336 #define ACCEL13_FFTHS_DECODING_LSB_10 0x03
337 #define ACCEL13_FFTHS_DECODING_LSB_11 0x04
338 #define ACCEL13_FFTHS_DECODING_LSB_13 0x05
339 #define ACCEL13_FFTHS_DECODING_LSB_15 0x06
340 #define ACCEL13_FFTHS_DECODING_LSB_16 0x07
341 
347 #define ACCEL13_SDUR_OVR_FIFO_NOT_COMPLETELY 0x00
348 #define ACCEL13_SDUR_OVR_FIFO_COMPLETELY 0x80
349 #define ACCEL13_SDUR_T_DRDY_NO_DATA 0x00
350 #define ACCEL13_SDUR_T_DRDY_DATA_IS_AVAILABLE 0x40
351 #define ACCEL13_SDUR_SLEEP_EVENT_NO_DETECT 0x00
352 #define ACCEL13_SDUR_SLEEP_EVENT_DETECT 0x20
353 #define ACCEL13_SDUR_DOUBLE_TAP_EVENT_NO_DETECT 0x00
354 #define ACCEL13_SDUR_DOUBLE_TAP_EVENT_DETECT 0x10
355 #define ACCEL13_SDUR_SINGLE_TAP_EVENT_NO_DETECT 0x00
356 #define ACCEL13_SDUR_SINGLE_TAP_EVENT_DETECT 0x08
357 #define ACCEL13_SDUR_6D_IA_EVENT_NO_DETECT 0x00
358 #define ACCEL13_SDUR_6D_IA_EVENT_DETECT 0x04
359 #define ACCEL13_SDUR_FF_IA_EVENT_NO_DETECT 0x00
360 #define ACCEL13_SDUR_FF_IA_EVENT_DETECT 0x02
361 #define ACCEL13_SDUR_DRDY_NO_READY 0x00
362 #define ACCEL13_SDUR_DRDY_XYZ_NEW_DATA_AVAILABLE 0x01
363 
369 #define ACCEL13_WUSRC_FF_IA_EVENT_NO_DETECT 0x00
370 #define ACCEL13_WUSRC_FF_IA_EVENT_DETECT 0x20
371 #define ACCEL13_WUSRC_SLEEP_EVENT_NO_DETECT 0x00
372 #define ACCEL13_WUSRC_SLEEP_EVENT_DETECT 0x10
373 #define ACCEL13_WUSRC_WAKEUP_EVENT_NO_DETECT 0x00
374 #define ACCEL13_WUSRC_WAKEUP_EVENT_DETECT 0x08
375 #define ACCEL13_WUSRC_WAKEUP_X_EVENT_NO_DETECT 0x00
376 #define ACCEL13_WUSRC_WAKEUP_X_EVENT_DETECT 0x04
377 #define ACCEL13_WUSRC_WAKEUP_Y_EVENT_NO_DETECT 0x00
378 #define ACCEL13_WUSRC_WAKEUP_Y_EVENT_DETECT 0x02
379 #define ACCEL13_WUSRC_WAKEUP_Z_EVENT_NO_DETECT 0x00
380 #define ACCEL13_WUSRC_WAKEUP_Z_EVENT_DETECT 0x01
381 
387 #define ACCEL13_TAPSRC_TAP_IA_EVENT_NO_DETECT 0x00
388 #define ACCEL13_TAPSRC_TAP_EVENT_DETECT 0x40
389 #define ACCEL13_TAPSRC_SINGLE_TAP_EVENT_NO_DETECT 0x00
390 #define ACCEL13_TAPSRC_SINGLE_TAP_EVENT_DETECT 0x20
391 #define ACCEL13_TAPSRC_DOUBLE_TAP_EVENT_NO_DETECT 0x00
392 #define ACCEL13_TAPSRC_DOUBLE_TAP_EVENT_DETECT 0x10
393 #define ACCEL13_TAPSRC_TAP_SIGN_EVENT_NO_DETECT 0x00
394 #define ACCEL13_TAPSRC_TAP_SIGN_EVENT_DETECT 0x08
395 #define ACCEL13_TAPSRC_X_TAP_EVENT_NO_DETECT 0x00
396 #define ACCEL13_TAPSRC_X_TAP_EVENT_DETECT 0x04
397 #define ACCEL13_TAPSRC_Y_TAP_EVENT_NO_DETECT 0x00
398 #define ACCEL13_TAPSRC_Y_TAP_EVENT_DETECT 0x02
399 #define ACCEL13_TAPSRC_Z_TAP_EVENT_NO_DETECT 0x00
400 #define ACCEL13_TAPSRC_Z_TAP_EVENT_DETECT 0x01
401 
407 #define ACCEL13_SIXDSRC_6D_IA_EVENT_NO_DETECT 0x00
408 
414 #define ACCEL13_INT_PIN_INTERRUPT_1 0x00
415 #define ACCEL13_PWM_PIN_INTERRUPT_2 0x01
416  // End group macro
419 // --------------------------------------------------------------- PUBLIC TYPES
428 typedef uint8_t accel13_select_t;
429 
433 typedef void ( *accel13_master_io_t )( struct accel13_s*, uint8_t, uint8_t*, uint8_t );
434 
438 typedef struct accel13_s
439 {
440  // Output pins
441  digital_out_t cs;
442 
443  // Input pins
444 
445  digital_in_t int2;
446  digital_in_t int1;
447 
448  // Modules
449 
450  i2c_master_t i2c;
451  spi_master_t spi;
452 
453  // ctx variable
454 
455  uint8_t slave_address;
456  pin_name_t chip_select;
460 
462 
466 typedef struct
467 {
468  // Communication gpio pins
469 
470  pin_name_t scl;
471  pin_name_t sda;
472  pin_name_t miso;
473  pin_name_t mosi;
474  pin_name_t sck;
475  pin_name_t cs;
476 
477  // Additional gpio pins
478 
479  pin_name_t int2;
480  pin_name_t int1;
481 
482  // static variable
483 
484  uint32_t i2c_speed;
485  uint8_t i2c_address;
486  uint32_t spi_speed;
487  uint8_t spi_mode;
488  spi_master_chip_select_polarity_t cs_polarity;
489 
491 
492 } accel13_cfg_t;
493 
497 typedef struct
498 {
499  int16_t x;
500  int16_t y;
501  int16_t z;
502 
504 
509 typedef struct
510 {
511  uint8_t fifo_threshold;
512  uint8_t wakeup_event;
513  uint8_t sleep_event;
516  uint8_t event_6d;
518  uint8_t drdy_event;
519 
521 
526 typedef struct
527 {
529  uint8_t sleep_event;
530  uint8_t wakeup_event;
531  uint8_t wakeup_x;
532  uint8_t wakeup_y;
533  uint8_t wakeup_z;
534 
536 
541 typedef struct
542 {
543  uint8_t tap;
544  uint8_t single_tap;
545  uint8_t double_tap;
546  uint8_t sign_tap;
547  uint8_t tap_x;
548  uint8_t tap_y;
549  uint8_t tap_z;
550 
551 } accel13_tap_t;
552 
557 typedef struct
558 {
559  uint8_t event_6d;
560  uint8_t z_high;
561  uint8_t z_low;
562  uint8_t y_high;
563  uint8_t y_low;
564  uint8_t x_high;
565  uint8_t x_low;
566 
567 } accel13_6d_t;
568 
573 typedef struct
574 {
575  int8_t x;
576  int8_t y;
577  int8_t z;
578 
580  // End types group
582 // ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
588 #ifdef __cplusplus
589 extern "C"{
590 #endif
591 
601 
610 
679 
690 void accel13_generic_write_bytes ( accel13_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len );
691 
701 void accel13_generic_write_single_byte ( accel13_t *ctx, uint8_t reg, uint8_t data_in );
702 
713 void accel13_generic_read_bytes ( accel13_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len );
714 
725 int16_t accel13_generic_read_word ( accel13_t *ctx, uint8_t reg );
726 
735 
745 
755 
765 
774 void accel13_get_tap_status ( accel13_t *ctx, accel13_tap_t *tap_status );
775 
784 void accel13_get_6d_status ( accel13_t *ctx, accel13_6d_t *sixd_status );
785 
795 
805 
816 uint8_t accel13_get_interrupt ( accel13_t *ctx, uint8_t int_num );
817 
818 #ifdef __cplusplus
819 }
820 #endif
821 #endif // _ACCEL13_H_
822  // End public_function group
825 
826 // ------------------------------------------------------------------------- END
accel13_cfg_t::sck
pin_name_t sck
Definition: accel13.h:474
accel13_status_t::wakeup_event
uint8_t wakeup_event
Definition: accel13.h:512
accel13_tap_t::sign_tap
uint8_t sign_tap
Definition: accel13.h:546
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:456
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:433
accel13_s::i2c
i2c_master_t i2c
Definition: accel13.h:450
accel13_wake_up_t::wakeup_event
uint8_t wakeup_event
Definition: accel13.h:530
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:451
accel13_axis_t
Accel axis data structure.
Definition: accel13.h:498
accel13_6d_t::z_low
uint8_t z_low
Definition: accel13.h:561
accel13_tap_t::tap_z
uint8_t tap_z
Definition: accel13.h:549
accel13_tap_t::tap_x
uint8_t tap_x
Definition: accel13.h:547
accel13_user_offset_t::y
int8_t y
Definition: accel13.h:576
accel13_tap_t::tap
uint8_t tap
Definition: accel13.h:543
accel13_wake_up_t::sleep_event
uint8_t sleep_event
Definition: accel13.h:529
accel13_s::write_f
accel13_master_io_t write_f
Definition: accel13.h:457
accel13_cfg_t::mosi
pin_name_t mosi
Definition: accel13.h:473
accel13_tap_t::double_tap
uint8_t double_tap
Definition: accel13.h:545
accel13_cfg_t::sel
accel13_select_t sel
Definition: accel13.h:490
accel13_cfg_t::spi_speed
uint32_t spi_speed
Definition: accel13.h:486
accel13_cfg_t::i2c_speed
uint32_t i2c_speed
Definition: accel13.h:484
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:471
accel13_6d_t::x_high
uint8_t x_high
Definition: accel13.h:564
accel13_cfg_t::spi_mode
uint8_t spi_mode
Definition: accel13.h:487
accel13_s::master_sel
accel13_select_t master_sel
Definition: accel13.h:459
accel13_s::int1
digital_in_t int1
Definition: accel13.h:446
accel13_status_t::fifo_threshold
uint8_t fifo_threshold
Definition: accel13.h:511
accel13_wake_up_t::wakeup_y
uint8_t wakeup_y
Definition: accel13.h:532
accel13_wake_up_t::wakeup_z
uint8_t wakeup_z
Definition: accel13.h:533
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:575
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:518
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:542
accel13_cfg_t::int1
pin_name_t int1
Definition: accel13.h:480
accel13_cfg_t
Click configuration structure definition.
Definition: accel13.h:467
accel13_6d_t::event_6d
uint8_t event_6d
Definition: accel13.h:559
accel13_user_offset_t
Structure for collecting data, read from the USER OFFSET registers.
Definition: accel13.h:574
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:458
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:513
accel13_axis_t::x
int16_t x
Definition: accel13.h:499
accel13_status_t::free_fall_event
uint8_t free_fall_event
Definition: accel13.h:517
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:475
accel13_axis_t::y
int16_t y
Definition: accel13.h:500
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:501
accel13_cfg_t::i2c_address
uint8_t i2c_address
Definition: accel13.h:485
accel13_s::cs
digital_out_t cs
Definition: accel13.h:441
accel13_cfg_t::int2
pin_name_t int2
Definition: accel13.h:479
accel13_6d_t::y_high
uint8_t y_high
Definition: accel13.h:562
accel13_t
struct accel13_s accel13_t
Click ctx object definition.
accel13_6d_t::y_low
uint8_t y_low
Definition: accel13.h:563
accel13_6d_t::x_low
uint8_t x_low
Definition: accel13.h:565
ACCEL13_RETVAL
#define ACCEL13_RETVAL
Definition: accel13.h:91
accel13_get_temperature
float accel13_get_temperature(accel13_t *ctx)
Temperature functions.
accel13_s
Click ctx object definition.
Definition: accel13.h:439
accel13_tap_t::tap_y
uint8_t tap_y
Definition: accel13.h:548
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:470
accel13_status_t
Structure for collecting status data, read from the STATUS registers.
Definition: accel13.h:510
accel13_wake_up_t::free_fall_event
uint8_t free_fall_event
Definition: accel13.h:528
accel13_select_t
uint8_t accel13_select_t
Communication type.
Definition: accel13.h:428
accel13_user_offset_t::z
int8_t z
Definition: accel13.h:577
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:527
accel13_status_t::double_tap_event
uint8_t double_tap_event
Definition: accel13.h:514
accel13_wake_up_t::wakeup_x
uint8_t wakeup_x
Definition: accel13.h:531
accel13_6d_t
Structure for collecting status data, read from the 6D SRC register.
Definition: accel13.h:558
accel13_status_t::single_tap_event
uint8_t single_tap_event
Definition: accel13.h:515
accel13_cfg_t::cs_polarity
spi_master_chip_select_polarity_t cs_polarity
Definition: accel13.h:488
accel13_s::slave_address
uint8_t slave_address
Definition: accel13.h:455
accel13_cfg_t::miso
pin_name_t miso
Definition: accel13.h:472
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:445
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:544
accel13_status_t::event_6d
uint8_t event_6d
Definition: accel13.h:516
accel13_6d_t::z_high
uint8_t z_high
Definition: accel13.h:560