accel6  2.0.0.0
accel6.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 ACCEL6_H
36 #define ACCEL6_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 ACCEL6_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 
77 #define ACCEL6_MASTER_I2C 0
78 #define ACCEL6_MASTER_SPI 1
79 
85 #define ACCEL6_RETVAL uint8_t
86 
87 #define ACCEL6_OK 0x00
88 #define ACCEL6_INIT_ERROR 0xFF
89 
95 #define ACCEL6_CHIP_ID 0xFB
96 #define ACCEL6_SOFT_RESET 0xB6
97 
103 #define ACCEL6_AXIS_X 0x02
104 #define ACCEL6_AXIS_Y 0x04
105 #define ACCEL6_AXIS_Z 0x06
106 
112 #define ACCEL6_REG_CHIP_ID 0x00
113 #define ACCEL6_REG_AXIS_X_LSB 0x02
114 #define ACCEL6_REG_AXIS_X_MSB 0x03
115 #define ACCEL6_REG_AXIS_Y_LSB 0x04
116 #define ACCEL6_REG_AXIS_Y_MSB 0x05
117 #define ACCEL6_REG_AXIS_Z_LSB 0x06
118 #define ACCEL6_REG_AXIS_Z_MSB 0x07
119 #define ACCEL6_REG_TEMPERATURE 0x08
120 #define ACCEL6_REG_INT_STATUS_0 0x09
121 #define ACCEL6_REG_INT_STATUS_1 0x0A
122 #define ACCEL6_REG_INT_STATUS_2 0x0B
123 #define ACCEL6_REG_INT_STATUS_3 0x0C
124 #define ACCEL6_REG_FIFO_STATUS 0x0E
125 #define ACCEL6_REG_PMU_RANGE 0x0F
126 #define ACCEL6_REG_PMU_BW 0x10
127 #define ACCEL6_REG_PMU_LPW 0x11
128 #define ACCEL6_REG_PMU_LOW_POWER 0x12
129 #define ACCEL6_REG_ACCD_HBW 0x13
130 #define ACCEL6_REG_BGW_SOFTRESET 0x14
131 #define ACCEL6_REG_INT_EN_0 0x16
132 #define ACCEL6_REG_INT_EN_1 0x17
133 #define ACCEL6_REG_INT_EN_2 0x18
134 #define ACCEL6_REG_INT_MAP_0 0x19
135 #define ACCEL6_REG_INT_MAP_1 0x1A
136 #define ACCEL6_REG_INT_MAP_2 0x1B
137 #define ACCEL6_REG_INT_SRC 0x1E
138 #define ACCEL6_REG_INT_OUT_CTRL 0x20
139 #define ACCEL6_REG_INT_RST_LATCH 0x21
140 #define ACCEL6_REG_INT1 0x23
141 #define ACCEL6_REG_INT2 0x24
142 #define ACCEL6_REG_INT3 0x25
143 #define ACCEL6_REG_INT4 0x26
144 #define ACCEL6_REG_INT5 0x27
145 #define ACCEL6_REG_INT6 0x28
146 #define ACCEL6_REG_INT7 0x29
147 #define ACCEL6_REG_INT8 0x2A
148 #define ACCEL6_REG_INT9 0x2B
149 #define ACCEL6_REG_INT_A 0x2C
150 #define ACCEL6_REG_INT_B 0x2D
151 #define ACCEL6_REG_INT_C 0x2E
152 #define ACCEL6_REG_INT_D 0x2F
153 #define ACCEL6_REG_FIFO_CONFIG_0 0x30
154 #define ACCEL6_REG_PMU_SELF_TEST 0x32
155 #define ACCEL6_REG_TRIM_NVM_CTRL 0x33
156 #define ACCEL6_REG_BGW_SPI3_WDT 0x34
157 #define ACCEL6_REG_OFC_CTRL 0x36
158 #define ACCEL6_REG_OFC_SETTINGS 0x37
159 #define ACCEL6_REG_OFC_OFFSET_X 0x38
160 #define ACCEL6_REG_OFC_OFFSET_Y 0x39
161 #define ACCEL6_REG_OFC_OFFSET_Z 0x3A
162 #define ACCEL6_REG_TRIM_GP_0 0x3B
163 #define ACCEL6_REG_TRIM_GP_1 0x3C
164 #define ACCEL6_REG_FIFO_CONFIG_1 0x3E
165 #define ACCEL6_REG_FIFO_DATA 0x3F
166 
172 #define ACCEL6_STATUS_0_FLAT_INT 0x80
173 #define ACCEL6_STATUS_0_ORIENT_INT 0x40
174 #define ACCEL6_STATUS_0_SINGLE_TAP_INT 0x20
175 #define ACCEL6_STATUS_0_DOUBLE_TAP_INT 0x10
176 #define ACCEL6_STATUS_0_MOTION_INT 0x08
177 #define ACCEL6_STATUS_0_SLOPE_INT 0x04
178 #define ACCEL6_STATUS_0_HIGH_INT 0x02
179 #define ACCEL6_STATUS_0_LOW_INT 0x01
180 
186 #define ACCEL6_STATUS_1_DATA_INT 0x80
187 #define ACCEL6_STATUS_1_FIFO_WM_INT 0x40
188 #define ACCEL6_STATUS_1_FIFO_FULL_INT 0x20
189 
195 #define ACCEL6_STATUS_2_TAP_SING 0x80
196 #define ACCEL6_STATUS_2_TAP_FIRST_Z 0x40
197 #define ACCEL6_STATUS_2_TAP_FIRST_Y 0x20
198 #define ACCEL6_STATUS_2_TAP_FIRST_X 0x10
199 #define ACCEL6_STATUS_2_SLOPE_SING 0x08
200 #define ACCEL6_STATUS_2_SLOPE_FIRST_Z 0x04
201 #define ACCEL6_STATUS_2_SLOPE_FIRST_Y 0x02
202 #define ACCEL6_STATUS_2_SLOPE_FIRST_X 0x01
203 
209 #define ACCEL6_STATUS_3_FLAT_POSITION 0x80
210 #define ACCEL6_STATUS_3_ORIENT_Z_UPWARD 0x00
211 #define ACCEL6_STATUS_3_ORIENT_Z_DOWNWARD 0x40
212 #define ACCEL6_STATUS_3_ORIENT_XY_UPRIGHT 0x00
213 #define ACCEL6_STATUS_3_ORIENT_XY_UPSIDE 0x10
214 #define ACCEL6_STATUS_3_ORIENT_XY_LANDSCAPE_LEFT 0x20
215 #define ACCEL6_STATUS_3_ORIENT_XY_LANDSCAPE_RIGHT 0x30
216 #define ACCEL6_STATUS_3_HIGH_SING_POSITIVE 0x00
217 #define ACCEL6_STATUS_3_HIGH_SING_NEGATIVE 0x08
218 #define ACCEL6_STATUS_3_HIGH_FIRST_Z 0x04
219 #define ACCEL6_STATUS_3_HIGH_FIRST_Y 0x02
220 #define ACCEL6_STATUS_3_HIGH_FIRST_X 0x01
221 
227 #define ACCEL6_PMU_RANGE_2g 0x03
228 #define ACCEL6_PMU_RANGE_4g 0x05
229 #define ACCEL6_PMU_RANGE_8g 0x08
230 #define ACCEL6_PMU_RANGE_16g 0x0C
231 
237 #define ACCEL6_PMU_BW_7_81Hz 0x08
238 #define ACCEL6_PMU_BW_15_63Hz 0x09
239 #define ACCEL6_PMU_BW_31_25Hz 0x0A
240 #define ACCEL6_PMU_BW_62_5Hz 0x0B
241 #define ACCEL6_PMU_BW_125Hz 0x0C
242 #define ACCEL6_PMU_BW_250Hz 0x0D
243 #define ACCEL6_PMU_BW_500Hz 0x0E
244 
250 #define ACCEL6_PMU_LPW_NORMAL_MODE 0x00
251 #define ACCEL6_PMU_LPW_DEEP_SUSPEND_MODE 0x20
252 #define ACCEL6_PMU_LPW_LOW_POWER_MODE 0x40
253 #define ACCEL6_PMU_LPW_SUSPEND_MODE 0x80
254 #define ACCEL6_PMU_LPW_SLEEP_0_5ms 0x05
255 #define ACCEL6_PMU_LPW_SLEEP_1ms 0x06
256 #define ACCEL6_PMU_LPW_SLEEP_2ms 0x07
257 #define ACCEL6_PMU_LPW_SLEEP_4ms 0x08
258 #define ACCEL6_PMU_LPW_SLEEP_6ms 0x09
259 #define ACCEL6_PMU_LPW_SLEEP_10ms 0x0A
260 #define ACCEL6_PMU_LPW_SLEEP_25ms 0x0B
261 #define ACCEL6_PMU_LPW_SLEEP_50ms 0x0C
262 #define ACCEL6_PMU_LPW_SLEEP_100ms 0x0D
263 #define ACCEL6_PMU_LPW_SLEEP_500ms 0x0E
264 
270 #define ACCEL6_INT_EN_0_FLAT_ENABLE 0x80
271 #define ACCEL6_INT_EN_0_ORIENT_ENABLE 0x40
272 #define ACCEL6_INT_EN_0_SINGLE_TAP_ENABLE 0x20
273 #define ACCEL6_INT_EN_0_DOUBLE_TAP_ENABLE 0x10
274 #define ACCEL6_INT_EN_0_SLOPE_Z_ENABLE 0x04
275 #define ACCEL6_INT_EN_0_SLOPE_Y_ENABLE 0x02
276 #define ACCEL6_INT_EN_0_SLOPE_X_ENABLE 0x01
277 
283 #define ACCEL6_INT_EN_1_FIFO_WM_ENABLE 0x40
284 #define ACCEL6_INT_EN_1_FIFO_FULL_ENABLE 0x20
285 #define ACCEL6_INT_EN_1_DATA_ENABLE 0x10
286 #define ACCEL6_INT_EN_1_LOW_ENABLE 0x08
287 #define ACCEL6_INT_EN_1_HIGH_Z_ENABLE 0x04
288 #define ACCEL6_INT_EN_1_HIGH_Y_ENABLE 0x02
289 #define ACCEL6_INT_EN_1_HIGH_X_ENABLE 0x01
290 
296 #define ACCEL6_INT_EN_2_MOTION_ENABLE 0x08
297 #define ACCEL6_INT_EN_2_MOTION_Z_ENABLE 0x04
298 #define ACCEL6_INT_EN_2_MOTION_Y_ENABLE 0x02
299 #define ACCEL6_INT_EN_2_MOTION_X_ENABLE 0x01
300 
306 #define ACCEL6_INT1_MAP_FLAT_ENABLE 0x80
307 #define ACCEL6_INT1_MAP_ORIENT_ENABLE 0x40
308 #define ACCEL6_INT1_MAP_SINGLE_TAP_ENABLE 0x20
309 #define ACCEL6_INT1_MAP_DOUBLE_TAP_ENABLE 0x10
310 #define ACCEL6_INT1_MAP_MOTION_ENABLE 0x08
311 #define ACCEL6_INT1_MAP_SLOPE_ENABLE 0x04
312 #define ACCEL6_INT1_MAP_HIGH_ENABLE 0x02
313 #define ACCEL6_INT1_MAP_LOW_ENABLE 0x01
314 
320 #define ACCEL6_INT2_MAP_DATA_ENABLE 0x80
321 #define ACCEL6_INT2_MAP_FIFO_WM_ENABLE 0x40
322 #define ACCEL6_INT2_MAP_FIFO_FULL_ENABLE 0x20
323 #define ACCEL6_INT1_MAP_DATA_ENABLE 0x01
324 #define ACCEL6_INT1_MAP_FIFO_WM_ENABLE 0x02
325 #define ACCEL6_INT1_MAP_FIFO_FULL_ENABLE 0x04
326 
332 #define ACCEL6_INT2_MAP_FLAT_ENABLE 0x80
333 #define ACCEL6_INT2_MAP_ORIENT_ENABLE 0x40
334 #define ACCEL6_INT2_MAP_SINGLE_TAP_ENABLE 0x20
335 #define ACCEL6_INT2_MAP_DOUBLE_TAP_ENABLE 0x10
336 #define ACCEL6_INT2_MAP_MOTION_ENABLE 0x08
337 #define ACCEL6_INT2_MAP_SLOPE_ENABLE 0x04
338 #define ACCEL6_INT2_MAP_HIGH_ENABLE 0x02
339 #define ACCEL6_INT2_MAP_LOW_ENABLE 0x01
340 
346 #define ACCEL6_INT_SRC_DATA 0x20
347 #define ACCEL6_INT_SRC_TAP 0x10
348 #define ACCEL6_INT_SRC_MOTION 0x08
349 #define ACCEL6_INT_SRC_SLOPE 0x04
350 #define ACCEL6_INT_SRC_HIGH 0x02
351 #define ACCEL6_INT_SRC_LOW 0x01
352 
358 #define ACCEL6_INT2_CTRL_OPEN_DRAIN 0x08
359 #define ACCEL6_INT1_CTRL_OPEN_DRAIN 0x02
360 #define ACCEL6_INT2_CTRL_ACTIVE_HIGH_LEVEL 0x04
361 #define ACCEL6_INT1_CTRL_ACTIVE_HIGH_LEVEL 0x01
362 
368 #define ACCEL6_LATCH_RESET_INT 0x80
369 #define ACCEL6_LATCH_INT_250ms 0x01
370 #define ACCEL6_LATCH_INT_500ms 0x02
371 #define ACCEL6_LATCH_INT_1sec 0x03
372 #define ACCEL6_LATCH_INT_2sec 0x04
373 #define ACCEL6_LATCH_INT_4sec 0x05
374 #define ACCEL6_LATCH_INT_8sec 0x06
375 #define ACCEL6_LATCH_INT_250us 0x09
376 #define ACCEL6_LATCH_INT_500us 0x0A
377 #define ACCEL6_LATCH_INT_1ms 0x0B
378 #define ACCEL6_LATCH_INT_12_5ms 0x0C
379 #define ACCEL6_LATCH_INT_25ms 0x0D
380 #define ACCEL6_LATCH_INT_50ms 0x0E
381 
387 #define ACCEL6_TAP_QUIET_30ms 0x00
388 #define ACCEL6_TAP_QUIET_20ms 0x80
389 #define ACCEL6_TAP_SHOCK_50ms 0x00
390 #define ACCEL6_TAP_SHOCK_75ms 0x40
391 #define ACCEL6_TAP_DUR_50ms 0x00
392 #define ACCEL6_TAP_DUR_100ms 0x01
393 #define ACCEL6_TAP_DUR_150ms 0x02
394 #define ACCEL6_TAP_DUR_200ms 0x03
395 #define ACCEL6_TAP_DUR_250ms 0x04
396 #define ACCEL6_TAP_DUR_375ms 0x05
397 #define ACCEL6_TAP_DUR_500ms 0x06
398 #define ACCEL6_TAP_DUR_700ms 0x07
399 
405 #define ACCEL6_TAP_2_SAMPLES 0x00
406 #define ACCEL6_TAP_4_SAMPLES 0x40
407 #define ACCEL6_TAP_8_SAMPLES 0x80
408 #define ACCEL6_TAP_16_SAMPLES 0xC0
409 
415 #define ACCEL6_SELF_TEST_SING_POSITIVE 0x40
416 #define ACCEL6_SELF_TEST_SING_NEGATIVE 0x00
417 #define ACCEL6_SELF_TEST_DISABLE 0x00
418 #define ACCEL6_SELF_TEST_X_AXIS 0x01
419 #define ACCEL6_SELF_TEST_Y_AXIS 0x02
420 #define ACCEL6_SELF_TEST_Z_AXIS 0x03
421 
427 #define ACCEL6_I2C_ENABLE 0x04
428 #define ACCEL6_I2C_DISABLE 0x00
429 #define ACCEL6_I2C_WTD_1ms 0x00
430 #define ACCEL6_I2C_WTD_50ms 0x02
431 #define ACCEL6_SPI_4_WIRE 0x00
432 #define ACCEL6_SPI_3_WIRE 0x01
433 
439 #define ACCEL6_OFFSET_RESET 0x80
440 #define ACCEL6_OFFSET_TRIGGER_X_AXIS 0x20
441 #define ACCEL6_OFFSET_TRIGGER_Y_AXIS 0x40
442 #define ACCEL6_OFFSET_TRIGGER_Z_AXIS 0x60
443 #define ACCEL6_OFFSET_NOT_TRIGGER 0x00
444 #define ACCEL6_OFC_HP_X_ENABLE 0x04
445 #define ACCEL6_OFC_HP_Y_ENABLE 0x02
446 #define ACCEL6_OFC_HP_Z_ENABLE 0x01
447 
453 #define ACCEL6_OFFSET_TARGET_Z_0g 0x00
454 #define ACCEL6_OFFSET_TARGET_Z_PLUS_1g 0x20
455 #define ACCEL6_OFFSET_TARGET_Z_MINUS_1g 0x40
456 #define ACCEL6_OFFSET_TARGET_Y_PLUS_1g 0x08
457 #define ACCEL6_OFFSET_TARGET_Y_MINUS_1g 0x10
458 #define ACCEL6_OFFSET_TARGET_X_PLUS_1g 0x02
459 #define ACCEL6_OFFSET_TARGET_X_MINUS_1g 0x04
460 #define ACCEL6_OFFSET_CUT_OFF_1Hz 0x00
461 #define ACCEL6_OFFSET_CUT_OFF_10Hz 0x01
462 
468 #define ACCEL6_FIFO_MODE_BYPASS 0x00
469 #define ACCEL6_FIFO_MODE_FIFO 0x40
470 #define ACCEL6_FIFO_MODE_STREAM 0x80
471 #define ACCEL6_FIFO_SELECT_XYZ_AXIS 0x00
472 #define ACCEL6_FIFO_SELECT_X_AXIS 0x01
473 #define ACCEL6_FIFO_SELECT_Y_AXIS 0x02
474 #define ACCEL6_FIFO_SELECT_Z_AXIS 0x03
475 
481 /* */
482 #define DEVICE_ERROR 0x04
483 #define DEVICE_OK 0x00
484 
490 #define TAP_X_NEGATIVE 0x01
491 #define TAP_Y_NEGATIVE 0x02
492 #define TAP_Z_NEGATIVE 0x03
493 #define TAP_X_POSITIVE 0x04
494 #define TAP_Y_POSITIVE 0x05
495 #define TAP_Z_POSITIVE 0x06
496 #define NON_TAP 0x00
497 
503 #define SLOPE_X_NEGATIVE 0x01
504 #define SLOPE_Y_NEGATIVE 0x02
505 #define SLOPE_Z_NEGATIVE 0x03
506 #define SLOPE_X_POSITIVE 0x04
507 #define SLOPE_Y_POSITIVE 0x05
508 #define SLOPE_Z_POSITIVE 0x06
509 #define NON_SLOPE 0x00
510 
516 #define Z_ORIENT_UPWARD_LOOKING 0x01
517 #define Z_ORIENT_DOWNWARD_LOOKING 0x02
518 #define XY_ORIENT_UPSIDE_DOWN 0x01
519 #define XY_ORIENT_LANDSCAPE_LEFT 0x02
520 #define XY_ORIENT_LANDSCAPE_RIGHT 0x03
521 #define XY_ORIENT_UPRIGHT 0x04
522  // End group macro
525 // --------------------------------------------------------------- PUBLIC TYPES
534 typedef uint8_t accel6_select_t;
535 
539 typedef void ( *accel6_master_io_t )( struct accel6_s*, uint8_t, uint8_t*, uint8_t );
540 
544 typedef struct accel6_s
545 {
546  digital_out_t cs;
547 
548  // Modules
549 
550  i2c_master_t i2c;
551  spi_master_t spi;
552 
553  // ctx variable
554 
555  uint8_t slave_address;
556  pin_name_t chip_select;
560 
561  float device_gaus;
562  float device_freq;
563 
565 
569 typedef struct
570 {
571  // Communication gpio pins
572 
573  pin_name_t scl;
574  pin_name_t sda;
575  pin_name_t miso;
576  pin_name_t mosi;
577  pin_name_t sck;
578  pin_name_t cs;
579 
580  // static variable
581 
582  uint32_t i2c_speed;
583  uint8_t i2c_address;
584  uint32_t spi_speed;
585  uint8_t spi_mode;
586  spi_master_chip_select_polarity_t cs_polarity;
587 
589 
590  float dev_gaus;
591  float dev_freq;
592 
593 } accel6_cfg_t;
594  // End types group
596 // ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
602 #ifdef __cplusplus
603 extern "C"{
604 #endif
605 
615 
624 
635 void accel6_generic_write ( accel6_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len );
636 
647 void accel6_generic_read ( accel6_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len );
648 
656 
694 void accel6_default_cfg ( accel6_t *ctx, uint8_t range_data, uint8_t bw_data, uint8_t lpw_data );
695 
707 void accel6_data_offset ( accel6_t *ctx, uint8_t set_offset, float *offset_data );
708 
728 
748 
768 void accel6_get_orient ( accel6_t *ctx, uint8_t *z_orient, uint8_t *xy_orient );
769 
780 float accel6_get_axis ( accel6_t *ctx, uint8_t axis );
781 
798 
799 #ifdef __cplusplus
800 }
801 #endif
802 #endif // _ACCEL6_H_
803  // End public_function group
806 
807 // ------------------------------------------------------------------------- END
accel6_cfg_t::spi_speed
uint32_t spi_speed
Definition: accel6.h:584
accel6_data_offset
void accel6_data_offset(accel6_t *ctx, uint8_t set_offset, float *offset_data)
Functions for set offset.
accel6_cfg_t
Click configuration structure definition.
Definition: accel6.h:570
accel6_get_axis
float accel6_get_axis(accel6_t *ctx, uint8_t axis)
Functions for read axis data.
accel6_cfg_t::i2c_speed
uint32_t i2c_speed
Definition: accel6.h:582
accel6_cfg_t::i2c_address
uint8_t i2c_address
Definition: accel6.h:583
accel6_cfg_t::sck
pin_name_t sck
Definition: accel6.h:577
accel6_generic_write
void accel6_generic_write(accel6_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic write function.
accel6_generic_read
void accel6_generic_read(accel6_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic read function.
accel6_cfg_t::miso
pin_name_t miso
Definition: accel6.h:575
accel6_get_temperature
float accel6_get_temperature(accel6_t *ctx)
Functions for read temperature.
accel6_s::spi
spi_master_t spi
Definition: accel6.h:551
accel6_cfg_t::scl
pin_name_t scl
Definition: accel6.h:573
accel6_get_orient
void accel6_get_orient(accel6_t *ctx, uint8_t *z_orient, uint8_t *xy_orient)
Functions for read orient.
accel6_soft_reset
void accel6_soft_reset(accel6_t *ctx)
Functions for software reset.
accel6_s::device_freq
float device_freq
Definition: accel6.h:562
accel6_cfg_t::cs_polarity
spi_master_chip_select_polarity_t cs_polarity
Definition: accel6.h:586
accel6_select_t
uint8_t accel6_select_t
Communication type.
Definition: accel6.h:534
accel6_s::i2c
i2c_master_t i2c
Definition: accel6.h:550
accel6_s::device_gaus
float device_gaus
Definition: accel6.h:561
accel6_cfg_setup
void accel6_cfg_setup(accel6_cfg_t *cfg)
Config Object Initialization function.
accel6_cfg_t::spi_mode
uint8_t spi_mode
Definition: accel6.h:585
accel6_cfg_t::dev_freq
float dev_freq
Definition: accel6.h:591
accel6_init
ACCEL6_RETVAL accel6_init(accel6_t *ctx, accel6_cfg_t *cfg)
Initialization function.
accel6_s::master_sel
accel6_select_t master_sel
Definition: accel6.h:559
accel6_default_cfg
void accel6_default_cfg(accel6_t *ctx, uint8_t range_data, uint8_t bw_data, uint8_t lpw_data)
Click Default Configuration function.
accel6_cfg_t::dev_gaus
float dev_gaus
Definition: accel6.h:590
accel6_s::slave_address
uint8_t slave_address
Definition: accel6.h:555
accel6_s::chip_select
pin_name_t chip_select
Definition: accel6.h:556
accel6_cfg_t::cs
pin_name_t cs
Definition: accel6.h:578
accel6_get_slope_status
uint8_t accel6_get_slope_status(accel6_t *ctx)
Functions for detect slope on the x/y/z axis.
accel6_cfg_t::sel
accel6_select_t sel
Definition: accel6.h:588
accel6_t
struct accel6_s accel6_t
Click ctx object definition.
accel6_s::write_f
accel6_master_io_t write_f
Definition: accel6.h:557
accel6_get_tap_status
uint8_t accel6_get_tap_status(accel6_t *ctx)
Functions for detect tap on the x/y/z axis.
ACCEL6_RETVAL
#define ACCEL6_RETVAL
Definition: accel6.h:85
accel6_master_io_t
void(* accel6_master_io_t)(struct accel6_s *, uint8_t, uint8_t *, uint8_t)
Master Input/Output type.
Definition: accel6.h:539
accel6_s::cs
digital_out_t cs
Definition: accel6.h:546
accel6_s
Click ctx object definition.
Definition: accel6.h:545
accel6_s::read_f
accel6_master_io_t read_f
Definition: accel6.h:558
accel6_cfg_t::mosi
pin_name_t mosi
Definition: accel6.h:576
accel6_cfg_t::sda
pin_name_t sda
Definition: accel6.h:574