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 
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 ACCEL6_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 
81 #define ACCEL6_MASTER_I2C 0
82 #define ACCEL6_MASTER_SPI 1
83 
89 #define ACCEL6_RETVAL uint8_t
90 
91 #define ACCEL6_OK 0x00
92 #define ACCEL6_INIT_ERROR 0xFF
93 
99 #define ACCEL6_CHIP_ID 0xFB
100 #define ACCEL6_SOFT_RESET 0xB6
101 
107 #define ACCEL6_AXIS_X 0x02
108 #define ACCEL6_AXIS_Y 0x04
109 #define ACCEL6_AXIS_Z 0x06
110 
116 #define ACCEL6_REG_CHIP_ID 0x00
117 #define ACCEL6_REG_AXIS_X_LSB 0x02
118 #define ACCEL6_REG_AXIS_X_MSB 0x03
119 #define ACCEL6_REG_AXIS_Y_LSB 0x04
120 #define ACCEL6_REG_AXIS_Y_MSB 0x05
121 #define ACCEL6_REG_AXIS_Z_LSB 0x06
122 #define ACCEL6_REG_AXIS_Z_MSB 0x07
123 #define ACCEL6_REG_TEMPERATURE 0x08
124 #define ACCEL6_REG_INT_STATUS_0 0x09
125 #define ACCEL6_REG_INT_STATUS_1 0x0A
126 #define ACCEL6_REG_INT_STATUS_2 0x0B
127 #define ACCEL6_REG_INT_STATUS_3 0x0C
128 #define ACCEL6_REG_FIFO_STATUS 0x0E
129 #define ACCEL6_REG_PMU_RANGE 0x0F
130 #define ACCEL6_REG_PMU_BW 0x10
131 #define ACCEL6_REG_PMU_LPW 0x11
132 #define ACCEL6_REG_PMU_LOW_POWER 0x12
133 #define ACCEL6_REG_ACCD_HBW 0x13
134 #define ACCEL6_REG_BGW_SOFTRESET 0x14
135 #define ACCEL6_REG_INT_EN_0 0x16
136 #define ACCEL6_REG_INT_EN_1 0x17
137 #define ACCEL6_REG_INT_EN_2 0x18
138 #define ACCEL6_REG_INT_MAP_0 0x19
139 #define ACCEL6_REG_INT_MAP_1 0x1A
140 #define ACCEL6_REG_INT_MAP_2 0x1B
141 #define ACCEL6_REG_INT_SRC 0x1E
142 #define ACCEL6_REG_INT_OUT_CTRL 0x20
143 #define ACCEL6_REG_INT_RST_LATCH 0x21
144 #define ACCEL6_REG_INT1 0x23
145 #define ACCEL6_REG_INT2 0x24
146 #define ACCEL6_REG_INT3 0x25
147 #define ACCEL6_REG_INT4 0x26
148 #define ACCEL6_REG_INT5 0x27
149 #define ACCEL6_REG_INT6 0x28
150 #define ACCEL6_REG_INT7 0x29
151 #define ACCEL6_REG_INT8 0x2A
152 #define ACCEL6_REG_INT9 0x2B
153 #define ACCEL6_REG_INT_A 0x2C
154 #define ACCEL6_REG_INT_B 0x2D
155 #define ACCEL6_REG_INT_C 0x2E
156 #define ACCEL6_REG_INT_D 0x2F
157 #define ACCEL6_REG_FIFO_CONFIG_0 0x30
158 #define ACCEL6_REG_PMU_SELF_TEST 0x32
159 #define ACCEL6_REG_TRIM_NVM_CTRL 0x33
160 #define ACCEL6_REG_BGW_SPI3_WDT 0x34
161 #define ACCEL6_REG_OFC_CTRL 0x36
162 #define ACCEL6_REG_OFC_SETTINGS 0x37
163 #define ACCEL6_REG_OFC_OFFSET_X 0x38
164 #define ACCEL6_REG_OFC_OFFSET_Y 0x39
165 #define ACCEL6_REG_OFC_OFFSET_Z 0x3A
166 #define ACCEL6_REG_TRIM_GP_0 0x3B
167 #define ACCEL6_REG_TRIM_GP_1 0x3C
168 #define ACCEL6_REG_FIFO_CONFIG_1 0x3E
169 #define ACCEL6_REG_FIFO_DATA 0x3F
170 
176 #define ACCEL6_STATUS_0_FLAT_INT 0x80
177 #define ACCEL6_STATUS_0_ORIENT_INT 0x40
178 #define ACCEL6_STATUS_0_SINGLE_TAP_INT 0x20
179 #define ACCEL6_STATUS_0_DOUBLE_TAP_INT 0x10
180 #define ACCEL6_STATUS_0_MOTION_INT 0x08
181 #define ACCEL6_STATUS_0_SLOPE_INT 0x04
182 #define ACCEL6_STATUS_0_HIGH_INT 0x02
183 #define ACCEL6_STATUS_0_LOW_INT 0x01
184 
190 #define ACCEL6_STATUS_1_DATA_INT 0x80
191 #define ACCEL6_STATUS_1_FIFO_WM_INT 0x40
192 #define ACCEL6_STATUS_1_FIFO_FULL_INT 0x20
193 
199 #define ACCEL6_STATUS_2_TAP_SING 0x80
200 #define ACCEL6_STATUS_2_TAP_FIRST_Z 0x40
201 #define ACCEL6_STATUS_2_TAP_FIRST_Y 0x20
202 #define ACCEL6_STATUS_2_TAP_FIRST_X 0x10
203 #define ACCEL6_STATUS_2_SLOPE_SING 0x08
204 #define ACCEL6_STATUS_2_SLOPE_FIRST_Z 0x04
205 #define ACCEL6_STATUS_2_SLOPE_FIRST_Y 0x02
206 #define ACCEL6_STATUS_2_SLOPE_FIRST_X 0x01
207 
213 #define ACCEL6_STATUS_3_FLAT_POSITION 0x80
214 #define ACCEL6_STATUS_3_ORIENT_Z_UPWARD 0x00
215 #define ACCEL6_STATUS_3_ORIENT_Z_DOWNWARD 0x40
216 #define ACCEL6_STATUS_3_ORIENT_XY_UPRIGHT 0x00
217 #define ACCEL6_STATUS_3_ORIENT_XY_UPSIDE 0x10
218 #define ACCEL6_STATUS_3_ORIENT_XY_LANDSCAPE_LEFT 0x20
219 #define ACCEL6_STATUS_3_ORIENT_XY_LANDSCAPE_RIGHT 0x30
220 #define ACCEL6_STATUS_3_HIGH_SING_POSITIVE 0x00
221 #define ACCEL6_STATUS_3_HIGH_SING_NEGATIVE 0x08
222 #define ACCEL6_STATUS_3_HIGH_FIRST_Z 0x04
223 #define ACCEL6_STATUS_3_HIGH_FIRST_Y 0x02
224 #define ACCEL6_STATUS_3_HIGH_FIRST_X 0x01
225 
231 #define ACCEL6_PMU_RANGE_2g 0x03
232 #define ACCEL6_PMU_RANGE_4g 0x05
233 #define ACCEL6_PMU_RANGE_8g 0x08
234 #define ACCEL6_PMU_RANGE_16g 0x0C
235 
241 #define ACCEL6_PMU_BW_7_81Hz 0x08
242 #define ACCEL6_PMU_BW_15_63Hz 0x09
243 #define ACCEL6_PMU_BW_31_25Hz 0x0A
244 #define ACCEL6_PMU_BW_62_5Hz 0x0B
245 #define ACCEL6_PMU_BW_125Hz 0x0C
246 #define ACCEL6_PMU_BW_250Hz 0x0D
247 #define ACCEL6_PMU_BW_500Hz 0x0E
248 
254 #define ACCEL6_PMU_LPW_NORMAL_MODE 0x00
255 #define ACCEL6_PMU_LPW_DEEP_SUSPEND_MODE 0x20
256 #define ACCEL6_PMU_LPW_LOW_POWER_MODE 0x40
257 #define ACCEL6_PMU_LPW_SUSPEND_MODE 0x80
258 #define ACCEL6_PMU_LPW_SLEEP_0_5ms 0x05
259 #define ACCEL6_PMU_LPW_SLEEP_1ms 0x06
260 #define ACCEL6_PMU_LPW_SLEEP_2ms 0x07
261 #define ACCEL6_PMU_LPW_SLEEP_4ms 0x08
262 #define ACCEL6_PMU_LPW_SLEEP_6ms 0x09
263 #define ACCEL6_PMU_LPW_SLEEP_10ms 0x0A
264 #define ACCEL6_PMU_LPW_SLEEP_25ms 0x0B
265 #define ACCEL6_PMU_LPW_SLEEP_50ms 0x0C
266 #define ACCEL6_PMU_LPW_SLEEP_100ms 0x0D
267 #define ACCEL6_PMU_LPW_SLEEP_500ms 0x0E
268 
274 #define ACCEL6_INT_EN_0_FLAT_ENABLE 0x80
275 #define ACCEL6_INT_EN_0_ORIENT_ENABLE 0x40
276 #define ACCEL6_INT_EN_0_SINGLE_TAP_ENABLE 0x20
277 #define ACCEL6_INT_EN_0_DOUBLE_TAP_ENABLE 0x10
278 #define ACCEL6_INT_EN_0_SLOPE_Z_ENABLE 0x04
279 #define ACCEL6_INT_EN_0_SLOPE_Y_ENABLE 0x02
280 #define ACCEL6_INT_EN_0_SLOPE_X_ENABLE 0x01
281 
287 #define ACCEL6_INT_EN_1_FIFO_WM_ENABLE 0x40
288 #define ACCEL6_INT_EN_1_FIFO_FULL_ENABLE 0x20
289 #define ACCEL6_INT_EN_1_DATA_ENABLE 0x10
290 #define ACCEL6_INT_EN_1_LOW_ENABLE 0x08
291 #define ACCEL6_INT_EN_1_HIGH_Z_ENABLE 0x04
292 #define ACCEL6_INT_EN_1_HIGH_Y_ENABLE 0x02
293 #define ACCEL6_INT_EN_1_HIGH_X_ENABLE 0x01
294 
300 #define ACCEL6_INT_EN_2_MOTION_ENABLE 0x08
301 #define ACCEL6_INT_EN_2_MOTION_Z_ENABLE 0x04
302 #define ACCEL6_INT_EN_2_MOTION_Y_ENABLE 0x02
303 #define ACCEL6_INT_EN_2_MOTION_X_ENABLE 0x01
304 
310 #define ACCEL6_INT1_MAP_FLAT_ENABLE 0x80
311 #define ACCEL6_INT1_MAP_ORIENT_ENABLE 0x40
312 #define ACCEL6_INT1_MAP_SINGLE_TAP_ENABLE 0x20
313 #define ACCEL6_INT1_MAP_DOUBLE_TAP_ENABLE 0x10
314 #define ACCEL6_INT1_MAP_MOTION_ENABLE 0x08
315 #define ACCEL6_INT1_MAP_SLOPE_ENABLE 0x04
316 #define ACCEL6_INT1_MAP_HIGH_ENABLE 0x02
317 #define ACCEL6_INT1_MAP_LOW_ENABLE 0x01
318 
324 #define ACCEL6_INT2_MAP_DATA_ENABLE 0x80
325 #define ACCEL6_INT2_MAP_FIFO_WM_ENABLE 0x40
326 #define ACCEL6_INT2_MAP_FIFO_FULL_ENABLE 0x20
327 #define ACCEL6_INT1_MAP_DATA_ENABLE 0x01
328 #define ACCEL6_INT1_MAP_FIFO_WM_ENABLE 0x02
329 #define ACCEL6_INT1_MAP_FIFO_FULL_ENABLE 0x04
330 
336 #define ACCEL6_INT2_MAP_FLAT_ENABLE 0x80
337 #define ACCEL6_INT2_MAP_ORIENT_ENABLE 0x40
338 #define ACCEL6_INT2_MAP_SINGLE_TAP_ENABLE 0x20
339 #define ACCEL6_INT2_MAP_DOUBLE_TAP_ENABLE 0x10
340 #define ACCEL6_INT2_MAP_MOTION_ENABLE 0x08
341 #define ACCEL6_INT2_MAP_SLOPE_ENABLE 0x04
342 #define ACCEL6_INT2_MAP_HIGH_ENABLE 0x02
343 #define ACCEL6_INT2_MAP_LOW_ENABLE 0x01
344 
350 #define ACCEL6_INT_SRC_DATA 0x20
351 #define ACCEL6_INT_SRC_TAP 0x10
352 #define ACCEL6_INT_SRC_MOTION 0x08
353 #define ACCEL6_INT_SRC_SLOPE 0x04
354 #define ACCEL6_INT_SRC_HIGH 0x02
355 #define ACCEL6_INT_SRC_LOW 0x01
356 
362 #define ACCEL6_INT2_CTRL_OPEN_DRAIN 0x08
363 #define ACCEL6_INT1_CTRL_OPEN_DRAIN 0x02
364 #define ACCEL6_INT2_CTRL_ACTIVE_HIGH_LEVEL 0x04
365 #define ACCEL6_INT1_CTRL_ACTIVE_HIGH_LEVEL 0x01
366 
372 #define ACCEL6_LATCH_RESET_INT 0x80
373 #define ACCEL6_LATCH_INT_250ms 0x01
374 #define ACCEL6_LATCH_INT_500ms 0x02
375 #define ACCEL6_LATCH_INT_1sec 0x03
376 #define ACCEL6_LATCH_INT_2sec 0x04
377 #define ACCEL6_LATCH_INT_4sec 0x05
378 #define ACCEL6_LATCH_INT_8sec 0x06
379 #define ACCEL6_LATCH_INT_250us 0x09
380 #define ACCEL6_LATCH_INT_500us 0x0A
381 #define ACCEL6_LATCH_INT_1ms 0x0B
382 #define ACCEL6_LATCH_INT_12_5ms 0x0C
383 #define ACCEL6_LATCH_INT_25ms 0x0D
384 #define ACCEL6_LATCH_INT_50ms 0x0E
385 
391 #define ACCEL6_TAP_QUIET_30ms 0x00
392 #define ACCEL6_TAP_QUIET_20ms 0x80
393 #define ACCEL6_TAP_SHOCK_50ms 0x00
394 #define ACCEL6_TAP_SHOCK_75ms 0x40
395 #define ACCEL6_TAP_DUR_50ms 0x00
396 #define ACCEL6_TAP_DUR_100ms 0x01
397 #define ACCEL6_TAP_DUR_150ms 0x02
398 #define ACCEL6_TAP_DUR_200ms 0x03
399 #define ACCEL6_TAP_DUR_250ms 0x04
400 #define ACCEL6_TAP_DUR_375ms 0x05
401 #define ACCEL6_TAP_DUR_500ms 0x06
402 #define ACCEL6_TAP_DUR_700ms 0x07
403 
409 #define ACCEL6_TAP_2_SAMPLES 0x00
410 #define ACCEL6_TAP_4_SAMPLES 0x40
411 #define ACCEL6_TAP_8_SAMPLES 0x80
412 #define ACCEL6_TAP_16_SAMPLES 0xC0
413 
419 #define ACCEL6_SELF_TEST_SING_POSITIVE 0x40
420 #define ACCEL6_SELF_TEST_SING_NEGATIVE 0x00
421 #define ACCEL6_SELF_TEST_DISABLE 0x00
422 #define ACCEL6_SELF_TEST_X_AXIS 0x01
423 #define ACCEL6_SELF_TEST_Y_AXIS 0x02
424 #define ACCEL6_SELF_TEST_Z_AXIS 0x03
425 
431 #define ACCEL6_I2C_ENABLE 0x04
432 #define ACCEL6_I2C_DISABLE 0x00
433 #define ACCEL6_I2C_WTD_1ms 0x00
434 #define ACCEL6_I2C_WTD_50ms 0x02
435 #define ACCEL6_SPI_4_WIRE 0x00
436 #define ACCEL6_SPI_3_WIRE 0x01
437 
443 #define ACCEL6_OFFSET_RESET 0x80
444 #define ACCEL6_OFFSET_TRIGGER_X_AXIS 0x20
445 #define ACCEL6_OFFSET_TRIGGER_Y_AXIS 0x40
446 #define ACCEL6_OFFSET_TRIGGER_Z_AXIS 0x60
447 #define ACCEL6_OFFSET_NOT_TRIGGER 0x00
448 #define ACCEL6_OFC_HP_X_ENABLE 0x04
449 #define ACCEL6_OFC_HP_Y_ENABLE 0x02
450 #define ACCEL6_OFC_HP_Z_ENABLE 0x01
451 
457 #define ACCEL6_OFFSET_TARGET_Z_0g 0x00
458 #define ACCEL6_OFFSET_TARGET_Z_PLUS_1g 0x20
459 #define ACCEL6_OFFSET_TARGET_Z_MINUS_1g 0x40
460 #define ACCEL6_OFFSET_TARGET_Y_PLUS_1g 0x08
461 #define ACCEL6_OFFSET_TARGET_Y_MINUS_1g 0x10
462 #define ACCEL6_OFFSET_TARGET_X_PLUS_1g 0x02
463 #define ACCEL6_OFFSET_TARGET_X_MINUS_1g 0x04
464 #define ACCEL6_OFFSET_CUT_OFF_1Hz 0x00
465 #define ACCEL6_OFFSET_CUT_OFF_10Hz 0x01
466 
472 #define ACCEL6_FIFO_MODE_BYPASS 0x00
473 #define ACCEL6_FIFO_MODE_FIFO 0x40
474 #define ACCEL6_FIFO_MODE_STREAM 0x80
475 #define ACCEL6_FIFO_SELECT_XYZ_AXIS 0x00
476 #define ACCEL6_FIFO_SELECT_X_AXIS 0x01
477 #define ACCEL6_FIFO_SELECT_Y_AXIS 0x02
478 #define ACCEL6_FIFO_SELECT_Z_AXIS 0x03
479 
485 /* */
486 #define DEVICE_ERROR 0x04
487 #define DEVICE_OK 0x00
488 
494 #define TAP_X_NEGATIVE 0x01
495 #define TAP_Y_NEGATIVE 0x02
496 #define TAP_Z_NEGATIVE 0x03
497 #define TAP_X_POSITIVE 0x04
498 #define TAP_Y_POSITIVE 0x05
499 #define TAP_Z_POSITIVE 0x06
500 #define NON_TAP 0x00
501 
507 #define SLOPE_X_NEGATIVE 0x01
508 #define SLOPE_Y_NEGATIVE 0x02
509 #define SLOPE_Z_NEGATIVE 0x03
510 #define SLOPE_X_POSITIVE 0x04
511 #define SLOPE_Y_POSITIVE 0x05
512 #define SLOPE_Z_POSITIVE 0x06
513 #define NON_SLOPE 0x00
514 
520 #define Z_ORIENT_UPWARD_LOOKING 0x01
521 #define Z_ORIENT_DOWNWARD_LOOKING 0x02
522 #define XY_ORIENT_UPSIDE_DOWN 0x01
523 #define XY_ORIENT_LANDSCAPE_LEFT 0x02
524 #define XY_ORIENT_LANDSCAPE_RIGHT 0x03
525 #define XY_ORIENT_UPRIGHT 0x04
526  // End group macro
529 // --------------------------------------------------------------- PUBLIC TYPES
538 typedef uint8_t accel6_select_t;
539 
543 typedef void ( *accel6_master_io_t )( struct accel6_s*, uint8_t, uint8_t*, uint8_t );
544 
548 typedef struct accel6_s
549 {
550  digital_out_t cs;
551 
552  // Modules
553 
554  i2c_master_t i2c;
555  spi_master_t spi;
556 
557  // ctx variable
558 
559  uint8_t slave_address;
560  pin_name_t chip_select;
564 
565  float device_gaus;
566  float device_freq;
567 
569 
573 typedef struct
574 {
575  // Communication gpio pins
576 
577  pin_name_t scl;
578  pin_name_t sda;
579  pin_name_t miso;
580  pin_name_t mosi;
581  pin_name_t sck;
582  pin_name_t cs;
583 
584  // static variable
585 
586  uint32_t i2c_speed;
587  uint8_t i2c_address;
588  uint32_t spi_speed;
589  uint8_t spi_mode;
590  spi_master_chip_select_polarity_t cs_polarity;
591 
593 
594  float dev_gaus;
595  float dev_freq;
596 
597 } accel6_cfg_t;
598  // End types group
600 // ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
606 #ifdef __cplusplus
607 extern "C"{
608 #endif
609 
619 
628 
639 void accel6_generic_write ( accel6_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len );
640 
651 void accel6_generic_read ( accel6_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len );
652 
660 
698 void accel6_default_cfg ( accel6_t *ctx, uint8_t range_data, uint8_t bw_data, uint8_t lpw_data );
699 
711 void accel6_data_offset ( accel6_t *ctx, uint8_t set_offset, float *offset_data );
712 
732 
752 
772 void accel6_get_orient ( accel6_t *ctx, uint8_t *z_orient, uint8_t *xy_orient );
773 
784 float accel6_get_axis ( accel6_t *ctx, uint8_t axis );
785 
802 
803 #ifdef __cplusplus
804 }
805 #endif
806 #endif // _ACCEL6_H_
807  // End public_function group
810 
811 // ------------------------------------------------------------------------- END
accel6_cfg_t::spi_speed
uint32_t spi_speed
Definition: accel6.h:588
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:574
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:586
accel6_cfg_t::i2c_address
uint8_t i2c_address
Definition: accel6.h:587
accel6_cfg_t::sck
pin_name_t sck
Definition: accel6.h:581
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:579
accel6_get_temperature
float accel6_get_temperature(accel6_t *ctx)
Functions for read temperature.
accel6_s::spi
spi_master_t spi
Definition: accel6.h:555
accel6_cfg_t::scl
pin_name_t scl
Definition: accel6.h:577
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:566
accel6_cfg_t::cs_polarity
spi_master_chip_select_polarity_t cs_polarity
Definition: accel6.h:590
accel6_select_t
uint8_t accel6_select_t
Communication type.
Definition: accel6.h:538
accel6_s::i2c
i2c_master_t i2c
Definition: accel6.h:554
accel6_s::device_gaus
float device_gaus
Definition: accel6.h:565
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:589
accel6_cfg_t::dev_freq
float dev_freq
Definition: accel6.h:595
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:563
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:594
accel6_s::slave_address
uint8_t slave_address
Definition: accel6.h:559
accel6_s::chip_select
pin_name_t chip_select
Definition: accel6.h:560
accel6_cfg_t::cs
pin_name_t cs
Definition: accel6.h:582
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:592
accel6_t
struct accel6_s accel6_t
Click ctx object definition.
accel6_s::write_f
accel6_master_io_t write_f
Definition: accel6.h:561
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:89
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:543
accel6_s::cs
digital_out_t cs
Definition: accel6.h:550
accel6_s
Click ctx object definition.
Definition: accel6.h:549
accel6_s::read_f
accel6_master_io_t read_f
Definition: accel6.h:562
accel6_cfg_t::mosi
pin_name_t mosi
Definition: accel6.h:580
accel6_cfg_t::sda
pin_name_t sda
Definition: accel6.h:578