ChibiOS/EX 1.3.0
adxl355.h
Go to the documentation of this file.
1/*
2 ChibiOS - Copyright (C) 2016..2023 Rocco Marco Guglielmi
3
4 This file is part of ChibiOS.
5
6 ChibiOS is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
10
11 ChibiOS is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
18
19*/
20
21/**
22 * @file adxl355.h
23 * @brief ADXL355 MEMS interface module header.
24 *
25 * @addtogroup ADXL355
26 * @ingroup EX_ADI
27 * @{
28 */
29
30#ifndef _ADXL355_H_
31#define _ADXL355_H_
32
33#include "ex_accelerometer.h"
34
35/*===========================================================================*/
36/* Driver constants. */
37/*===========================================================================*/
38
39/**
40 * @name Version identification
41 * @{
42 */
43/**
44 * @brief ADXL355 driver version string.
45 */
46#define EX_ADXL355_VERSION "1.1.0"
47
48/**
49 * @brief ADXL355 driver version major number.
50 */
51#define EX_ADXL355_MAJOR 1
52
53/**
54 * @brief ADXL355 driver version minor number.
55 */
56#define EX_ADXL355_MINOR 1
57
58/**
59 * @brief ADXL355 driver version patch number.
60 */
61#define EX_ADXL355_PATCH 0
62/** @} */
63
64/**
65 * @brief ADXL355 accelerometer subsystem characteristics.
66 * @note Sensitivity is expressed as milli-G/LSB whereas
67 * 1 milli-G = 0.00980665 m/s^2.
68 * @note Bias is expressed as milli-G.
69 *
70 * @{
71 */
72#define ADXL355_ACC_NUMBER_OF_AXES 3U
73
74#define ADXL355_ACC_2G 2.048f
75#define ADXL355_ACC_4G 4.096f
76#define ADXL355_ACC_8G 8.0192f
77
78#define ADXL355_ACC_SENS_2G 0.003906f
79#define ADXL355_ACC_SENS_4G 0.007813f
80#define ADXL355_ACC_SENS_8G 0.015625f
81
82#define ADXL355_ACC_BIAS 0.0f
83/** @} */
84
85/**
86 * @name ADXL355 communication interfaces related bit masks
87 * @{
88 */
89#define ADXL355_DI_MASK 0xFF
90#define ADXL355_DI(n) (1 << n)
91#define ADXL355_AD_MASK 0xFE
92#define ADXL355_RW (1 << 0)
93#define ADXL355_AD(n) (1 << (n + 1))
94/** @} */
95
96/**
97 * @name ADXL355 register addresses
98 * @{
99 */
100#define ADXL355_AD_DEVID_AD 0x00
101#define ADXL355_AD_DEVID_MST 0x01
102#define ADXL355_AD_PARTID 0x02
103#define ADXL355_AD_REVID 0x03
104#define ADXL355_AD_STATUS 0x04
105#define ADXL355_AD_FIFO_ENTRIES 0x05
106#define ADXL355_AD_TEMP2 0x06
107#define ADXL355_AD_TEMP1 0x07
108#define ADXL355_AD_XDATA3 0x08
109#define ADXL355_AD_XDATA2 0x09
110#define ADXL355_AD_XDATA1 0x0A
111#define ADXL355_AD_YDATA3 0x0B
112#define ADXL355_AD_YDATA2 0x0C
113#define ADXL355_AD_YDATA1 0x0D
114#define ADXL355_AD_ZDATA3 0x0E
115#define ADXL355_AD_ZDATA2 0x0F
116#define ADXL355_AD_ZDATA1 0x10
117#define ADXL355_AD_FIFO_DATA 0x11
118#define ADXL355_AD_OFFSET_X_H 0x1E
119#define ADXL355_AD_OFFSET_X_L 0x1F
120#define ADXL355_AD_OFFSET_Y_H 0x20
121#define ADXL355_AD_OFFSET_Y_L 0x21
122#define ADXL355_AD_OFFSET_Z_H 0x22
123#define ADXL355_AD_OFFSET_Z_L 0x23
124#define ADXL355_AD_ACT_EN 0x24
125#define ADXL355_AD_ACT_THRES_L 0x25
126#define ADXL355_AD_ACT_THRES_H 0x26
127#define ADXL355_AD_ACT_COUNTER 0x27
128#define ADXL355_AD_FILTER 0x28
129#define ADXL355_AD_FIFO_SAMPLES 0x29
130#define ADXL355_AD_INT_MAP 0x2A
131#define ADXL355_AD_SYNC 0x2B
132#define ADXL355_AD_RANGE 0x2C
133#define ADXL355_AD_POWER_CTL 0x2D
134#define ADXL355_AD_SELF_TEST 0x2E
135#define ADXL355_AD_RESET 0x2F
136/** @} */
137
138/**
139 * @name ADXL355 Device Identifier
140 * @{
141 */
142#define ADXL355_DEVID_MST 0x1D
143/** @} */
144
145/**
146 * @name ADXL355_FILTER register bits definitions
147 * @{
148 */
149#define ADXL355_FILTER_MASK 0x7F
150#define ADXL355_FILTER_ORD_LPF_0 (1 << 0)
151#define ADXL355_FILTER_ORD_LPF_1 (1 << 1)
152#define ADXL355_FILTER_ORD_LPF_2 (1 << 2)
153#define ADXL355_FILTER_ORD_LPF_3 (1 << 3)
154#define ADXL355_FILTER_HPF_CORNER_0 (1 << 4)
155#define ADXL355_FILTER_HPF_CORNER_1 (1 << 5)
156#define ADXL355_FILTER_HPF_CORNER_2 (1 << 6)
157/** @} */
158
159/**
160 * @name ADXL355_FIFO_SAMPLES register bits definitions
161 * @{
162 */
163#define ADXL355_FIFO_SAMPLES_MASK 0x7F
164#define ADXL355_FIFO_SAMPLES_BIT_0 (1 << 0)
165#define ADXL355_FIFO_SAMPLES_BIT_1 (1 << 1)
166#define ADXL355_FIFO_SAMPLES_BIT_2 (1 << 2)
167#define ADXL355_FIFO_SAMPLES_BIT_3 (1 << 3)
168#define ADXL355_FIFO_SAMPLES_BIT_4 (1 << 4)
169#define ADXL355_FIFO_SAMPLES_BIT_5 (1 << 5)
170#define ADXL355_FIFO_SAMPLES_BIT_6 (1 << 6)
171/** @} */
172
173/**
174 * @name ADXL355_INT_MAP register bits definitions
175 * @{
176 */
177#define ADXL355_INT_MAP_MASK 0xFF
178#define ADXL355_INT_MAP_RDY_EN1 (1 << 0)
179#define ADXL355_INT_MAP_FULL_EN1 (1 << 1)
180#define ADXL355_INT_MAP_OVR_EN1 (1 << 2)
181#define ADXL355_INT_MAP_ACT_EN1 (1 << 3)
182#define ADXL355_INT_MAP_RDY_EN2 (1 << 4)
183#define ADXL355_INT_MAP_FULL_EN2 (1 << 5)
184#define ADXL355_INT_MAP_OVR_EN2 (1 << 6)
185#define ADXL355_INT_MAP_ACT_EN2 (1 << 7)
186/** @} */
187
188/**
189 * @name ADXL355_SYNC register bits definitions
190 * @{
191 */
192#define ADXL355_SYNC_MASK 0x07
193#define ADXL355_SYNC_EXT_SYNC_0 (1 << 0)
194#define ADXL355_SYNC_EXT_SYNC_1 (1 << 1)
195#define ADXL355_SYNC_EXT_CLK (1 << 2)
196/** @} */
197
198/**
199 * @name ADXL355_RANGE register bits definitions
200 * @{
201 */
202#define ADXL355_RANGE_MASK 0xC3
203#define ADXL355_RANGE_RANGE_MASK 0x03
204#define ADXL355_RANGE_RANGE_1 (1 << 1)
205#define ADXL355_RANGE_RANGE_0 (1 << 0)
206#define ADXL355_RANGE_RANGE_1 (1 << 1)
207#define ADXL355_RANGE_INT_POL (1 << 6)
208#define ADXL355_RANGE_I2C_HS (1 << 7)
209/** @} */
210
211/**
212 * @name ADXL355_POWER_CTL register bits definitions
213 * @{
214 */
215#define ADXL355_POWER_CTL_MASK 0x07
216#define ADXL355_POWER_CTL_STANDBY (1 << 0)
217#define ADXL355_POWER_CTL_TEMP_OFF (1 << 1)
218#define ADXL355_POWER_CTL_DRDY_OFF (1 << 2)
219/** @} */
220
221/**
222 * @name ADXL355_SELT_TEST register bits definitions
223 * @{
224 */
225#define ADXL355_SELF_TEST_MASK 0x03
226#define ADXL355_SELF_TEST_ST1 (1 << 0)
227#define ADXL355_SELF_TEST_ST2 (1 << 1)
228/** @} */
229
230/*===========================================================================*/
231/* Driver pre-compile time settings. */
232/*===========================================================================*/
233
234/**
235 * @name Configuration options
236 * @{
237 */
238/**
239 * @brief ADXL355 SPI interface switch.
240 * @details If set to @p TRUE the support for SPI is included.
241 * @note The default is @p TRUE.
242 */
243#if !defined(ADXL355_USE_SPI) || defined(__DOXYGEN__)
244#define ADXL355_USE_SPI TRUE
245#endif
246
247/**
248 * @brief ADXL355 shared SPI switch.
249 * @details If set to @p TRUE the device acquires SPI bus ownership
250 * on each transaction.
251 * @note The default is @p FALSE. Requires SPI_USE_MUTUAL_EXCLUSION.
252 */
253#if !defined(ADXL355_SHARED_SPI) || defined(__DOXYGEN__)
254#define ADXL355_SHARED_SPI FALSE
255#endif
256
257/**
258 * @brief ADXL355 I2C interface switch.
259 * @details If set to @p TRUE the support for I2C is included.
260 * @note The default is @p FALSE.
261 */
262#if !defined(ADXL355_USE_I2C) || defined(__DOXYGEN__)
263#define ADXL355_USE_I2C FALSE
264#endif
265
266/**
267 * @brief ADXL355 shared I2C switch.
268 * @details If set to @p TRUE the device acquires I2C bus ownership
269 * on each transaction.
270 * @note The default is @p FALSE. Requires I2C_USE_MUTUAL_EXCLUSION.
271 */
272#if !defined(ADXL355_SHARED_I2C) || defined(__DOXYGEN__)
273#define ADXL355_SHARED_I2C FALSE
274#endif
275
276/**
277 * @brief ADXL355 advanced configurations switch.
278 * @details If set to @p TRUE more configurations are available.
279 * @note The default is @p FALSE.
280 */
281#if !defined(ADXL355_USE_ADVANCED) || defined(__DOXYGEN__)
282#define ADXL355_USE_ADVANCED FALSE
283#endif
284
285/**
286 * @brief ADXL355 internal communication buffer sizes.
287 */
288#if !defined(ADXL355_COMM_BUFF_SIZE) || defined(__DOXYGEN__)
289#define ADXL355_COMM_BUFF_SIZE 32
290#endif
291/** @} */
292
293/*===========================================================================*/
294/* Derived constants and error checks. */
295/*===========================================================================*/
296
297#if !(ADXL355_USE_SPI ^ ADXL355_USE_I2C)
298#error "ADXL355_USE_SPI and ADXL355_USE_I2C cannot be both true or both false"
299#endif
300
301#if ADXL355_USE_SPI && !HAL_USE_SPI
302#error "ADXL355_USE_SPI requires HAL_USE_SPI"
303#endif
304
305#if ADXL355_SHARED_SPI && !SPI_USE_MUTUAL_EXCLUSION
306#error "ADXL355_SHARED_SPI requires SPI_USE_MUTUAL_EXCLUSION"
307#endif
308
309#if ADXL355_USE_I2C && !HAL_USE_I2C
310#error "ADXL355_USE_I2C requires HAL_USE_I2C"
311#endif
312
313#if ADXL355_SHARED_I2C && !I2C_USE_MUTUAL_EXCLUSION
314#error "ADXL355_SHARED_I2C requires I2C_USE_MUTUAL_EXCLUSION"
315#endif
316
317/*
318 * CHTODO: Add support for ADXL355 over I2C.
319 */
320#if ADXL355_USE_I2C
321#error "ADXL355 over I2C still not supported"
322#endif
323
324/*===========================================================================*/
325/* Driver data structures and types. */
326/*===========================================================================*/
327
328/**
329 * @name ADXL355 data structures and types
330 * @{
331 */
332/**
333 * @brief Structure representing a ADXL355 driver.
334 */
336
337/**
338 * @brief ADXL355 full scale.
339 */
340typedef enum {
341 ADXL355_ACC_FS_2G = 0x01, /**< Full scale ±2g. */
342 ADXL355_ACC_FS_4G = 0x02, /**< Full scale ±4g. */
343 ADXL355_ACC_FS_8G = 0x03, /**< Full scale ±8g. */
345
346/**
347 * @brief ADXL355 output data rate.
348 */
349typedef enum {
350 ADXL355_ACC_ODR_4000HZ = 0x00, /**< ODR 4000 Hz, LP cut-off ODR/4. */
351 ADXL355_ACC_ODR_2000HZ = 0x01, /**< ODR 2000 Hz, LP cut-off ODR/4. */
352 ADXL355_ACC_ODR_1000HZ = 0x02, /**< ODR 1000 Hz, LP cut-off ODR/4. */
353 ADXL355_ACC_ODR_500HZ = 0x03, /**< ODR 500 Hz, LP cut-off ODR/4. */
354 ADXL355_ACC_ODR_250HZ = 0x04, /**< ODR 250 Hz, LP cut-off ODR/4. */
355 ADXL355_ACC_ODR_125HZ = 0x06, /**< ODR 125 Hz, LP cut-off ODR/4. */
356 ADXL355_ACC_ODR_62P5HZ = 0x06, /**< ODR 62.5 Hz, LP cut-off ODR/4. */
357 ADXL355_ACC_ODR_31P25HZ = 0x07, /**< ODR 31.25 Hz, LP cut-off ODR/4. */
358 ADXL355_ACC_ODR_15P625HZ = 0x08, /**< ODR 15.625 Hz, LP cut-off ODR/4. */
359 ADXL355_ACC_ODR_7P913HZ = 0x09, /**< ODR 7.913 Hz, LP cut-off ODR/4. */
360 ADXL355_ACC_ODR_3P906HZ = 0x0A /**< ODR 3.906 Hz, LP cut-off ODR/4. */
362
363/**
364 * @brief ADXL355 HP filter.
365 */
366typedef enum {
367 ADXL355_ACC_HP_DISABLED = 0x00, /**< HP disabled. */
368 ADXL355_ACC_HP_LEV_1 = 0x10, /**< HP cut-off 247 x 10^-3 x ODR. */
369 ADXL355_ACC_HP_LEV_2 = 0x20, /**< HP cut-off 62.084 x 10^-3 x ODR. */
370 ADXL355_ACC_HP_LEV_3 = 0x30, /**< HP cut-off 15.545 x 10^-3 x ODR. */
371 ADXL355_ACC_HP_LEV_4 = 0x40, /**< HP cut-off 3.892 x 10^-3 x ODR. */
372 ADXL355_ACC_HP_LEV_5 = 0x50, /**< HP cut-off 0.954 x 10^-3 x ODR. */
373 ADXL355_ACC_HP_LEV_6 = 0x60, /**< HP cut-off 0.238 x 10^-3 x ODR. */
375
376/**
377 * @brief Driver state machine possible states.
378 */
379typedef enum {
380 ADXL355_UNINIT = 0, /**< Not initialized. */
381 ADXL355_STOP = 1, /**< Stopped. */
382 ADXL355_READY = 2, /**< Ready. */
384
385/**
386 * @brief ADXL355 configuration structure.
387 */
388typedef struct {
389
390#if (ADXL355_USE_SPI) || defined(__DOXYGEN__)
391 /**
392 * @brief SPI driver associated to this ADXL355.
393 */
394 SPIDriver *spip;
395 /**
396 * @brief SPI configuration associated to this ADXL355.
397 */
398 const SPIConfig *spicfg;
399#endif /* ADXL355_USE_SPI */
400#if (ADXL355_USE_I2C) || defined(__DOXYGEN__)
401 /**
402 * @brief I2C driver associated to this ADXL355.
403 */
404 I2CDriver *i2cp;
405 /**
406 * @brief I2C configuration associated to this ADXL355.
407 */
408 const I2CConfig *i2ccfg;
409#endif /* ADXL355_USE_I2C */
410 /**
411 * @brief ADXL355 accelerometer subsystem initial sensitivity.
412 */
414 /**
415 * @brief ADXL355 accelerometer subsystem initial bias.
416 */
417 float *accbias;
418 /**
419 * @brief ADXL355 accelerometer subsystem initial full scale.
420 */
422 /**
423 * @brief ADXL355 output data rate selection.
424 */
426#if ADXL355_USE_ADVANCED || defined(__DOXYGEN__)
427 /**
428 * @brief ADXL355 HP filter bandwidth.
429 */
431#endif
433
434/**
435 * @brief @p ADXL355 specific methods.
436 */
437#define _adxl355_methods_alone \
438 /* Change full scale value of ADXL355 accelerometer subsystem.*/ \
439 msg_t (*acc_set_full_scale)(ADXL355Driver *devp, adxl355_acc_fs_t fs);
440
441
442/**
443 * @brief @p ADXL355 specific methods with inherited ones.
444 */
445#define _adxl355_methods \
446 _base_object_methods \
447 _adxl355_methods_alone
448
449/**
450 * @extends BaseObjectVMT
451 *
452 * @brief @p ADXL355 virtual methods table.
453 */
456};
457
458/**
459 * @brief @p ADXL355Driver specific data.
460 */
461#define _adxl355_data \
462 _base_sensor_data \
463 /* Driver state.*/ \
464 adxl355_state_t state; \
465 /* Current configuration data.*/ \
466 const ADXL355Config *config; \
467 /* Accelerometer subsystem axes number.*/ \
468 size_t accaxes; \
469 /* Accelerometer subsystem current sensitivity.*/ \
470 float accsensitivity[ADXL355_ACC_NUMBER_OF_AXES]; \
471 /* Accelerometer subsystem current bias .*/ \
472 float accbias[ADXL355_ACC_NUMBER_OF_AXES]; \
473 /* Accelerometer subsystem current full scale value.*/ \
474 float accfullscale; \
475 /* Accelerometer communication tx buffer pointer.*/ \
476 uint8_t* commtxp; \
477 /* Accelerometer communication rx buffer pointer.*/ \
478 uint8_t* commrxp;
479
480/**
481 * @brief ADXL355 3-axis accelerometer class.
482 */
484 /** @brief Virtual Methods Table.*/
485 const struct ADXL355VMT *vmt;
486 /** @brief Base accelerometer interface.*/
489};
490/** @} */
491
492/*===========================================================================*/
493/* Driver macros. */
494/*===========================================================================*/
495
496/**
497 * @brief Return the number of axes of the BaseAccelerometer.
498 *
499 * @param[in] devp pointer to @p ADXL355Driver.
500 *
501 * @return the number of axes.
502 *
503 * @api
504 */
505#define adxl355AccelerometerGetAxesNumber(devp) \
506 accelerometerGetAxesNumber(&((devp)->acc_if))
507
508/**
509 * @brief Retrieves raw data from the BaseAccelerometer.
510 * @note This data is retrieved from MEMS register without any algebraical
511 * manipulation.
512 * @note The axes array must be at least the same size of the
513 * BaseAccelerometer axes number.
514 *
515 * @param[in] devp pointer to @p ADXL355Driver.
516 * @param[out] axes a buffer which would be filled with raw data.
517 *
518 * @return The operation status.
519 * @retval MSG_OK if the function succeeded.
520 * @retval MSG_RESET if one or more I2C errors occurred, the errors can
521 * be retrieved using @p i2cGetErrors().
522 * @retval MSG_TIMEOUT if a timeout occurred before operation end.
523 *
524 * @api
525 */
526#define adxl355AccelerometerReadRaw(devp, axes) \
527 accelerometerReadRaw(&((devp)->acc_if), axes)
528
529/**
530 * @brief Retrieves cooked data from the BaseAccelerometer.
531 * @note This data is manipulated according to the formula
532 * cooked = (raw * sensitivity) - bias.
533 * @note Final data is expressed as milli-G.
534 * @note The axes array must be at least the same size of the
535 * BaseAccelerometer axes number.
536 *
537 * @param[in] devp pointer to @p ADXL355Driver.
538 * @param[out] axes a buffer which would be filled with cooked data.
539 *
540 * @return The operation status.
541 * @retval MSG_OK if the function succeeded.
542 * @retval MSG_RESET if one or more I2C errors occurred, the errors can
543 * be retrieved using @p i2cGetErrors().
544 * @retval MSG_TIMEOUT if a timeout occurred before operation end.
545 *
546 * @api
547 */
548#define adxl355AccelerometerReadCooked(devp, axes) \
549 accelerometerReadCooked(&((devp)->acc_if), axes)
550
551/**
552 * @brief Set bias values for the BaseAccelerometer.
553 * @note Bias must be expressed as milli-G.
554 * @note The bias buffer must be at least the same size of the
555 * BaseAccelerometer axes number.
556 *
557 * @param[in] devp pointer to @p ADXL355Driver.
558 * @param[in] bp a buffer which contains biases.
559 *
560 * @return The operation status.
561 * @retval MSG_OK if the function succeeded.
562 *
563 * @api
564 */
565#define adxl355AccelerometerSetBias(devp, bp) \
566 accelerometerSetBias(&((devp)->acc_if), bp)
567
568/**
569 * @brief Reset bias values for the BaseAccelerometer.
570 * @note Default biases value are obtained from device datasheet when
571 * available otherwise they are considered zero.
572 *
573 * @param[in] devp pointer to @p ADXL355Driver.
574 *
575 * @return The operation status.
576 * @retval MSG_OK if the function succeeded.
577 *
578 * @api
579 */
580#define adxl355AccelerometerResetBias(devp) \
581 accelerometerResetBias(&((devp)->acc_if))
582
583/**
584 * @brief Set sensitivity values for the BaseAccelerometer.
585 * @note Sensitivity must be expressed as milli-G/LSB.
586 * @note The sensitivity buffer must be at least the same size of the
587 * BaseAccelerometer axes number.
588 *
589 * @param[in] devp pointer to @p ADXL355Driver.
590 * @param[in] sp a buffer which contains sensitivities.
591 *
592 * @return The operation status.
593 * @retval MSG_OK if the function succeeded.
594 *
595 * @api
596 */
597#define adxl355AccelerometerSetSensitivity(devp, sp) \
598 accelerometerSetSensitivity(&((devp)->acc_if), sp)
599
600/**
601 * @brief Reset sensitivity values for the BaseAccelerometer.
602 * @note Default sensitivities value are obtained from device datasheet.
603 *
604 * @param[in] devp pointer to @p ADXL355Driver.
605 *
606 * @return The operation status.
607 * @retval MSG_OK if the function succeeded.
608 * @retval MSG_RESET otherwise.
609 *
610 * @api
611 */
612#define adxl355AccelerometerResetSensitivity(devp) \
613 accelerometerResetSensitivity(&((devp)->acc_if))
614
615/**
616 * @brief Changes the ADXL355Driver accelerometer fullscale value.
617 * @note This function also rescale sensitivities and biases based on
618 * previous and next fullscale value.
619 * @note A recalibration is highly suggested after calling this function.
620 *
621 * @param[in] devp pointer to @p ADXL355Driver.
622 * @param[in] fs new fullscale value.
623 *
624 * @return The operation status.
625 * @retval MSG_OK if the function succeeded.
626 * @retval MSG_RESET otherwise.
627 *
628 * @api
629 */
630#define adxl355AccelerometerSetFullScale(devp, fs) \
631 (devp)->vmt->acc_set_full_scale(devp, fs)
632
633/*===========================================================================*/
634/* External declarations. */
635/*===========================================================================*/
636
637#ifdef __cplusplus
638extern "C" {
639#endif
640#if (ADXL355_USE_SPI) || defined(__DOXYGEN__)
641 void adxl355SPIReadRegister(ADXL355Driver *devp, uint8_t reg, size_t n,
642 uint8_t* b);
643 void adxl355SPIWriteRegister(ADXL355Driver *devp, uint8_t reg, size_t n,
644 uint8_t* b);
645#endif /* ADXL355_USE_SPI */
646 void adxl355ObjectInit(ADXL355Driver *devp, uint8_t* txbp, uint8_t* rxbp);
647 void adxl355Start(ADXL355Driver *devp, const ADXL355Config *config);
648 void adxl355Stop(ADXL355Driver *devp);
649#ifdef __cplusplus
650}
651#endif
652
653#endif /* _ADXL355_H_ */
654
655/** @} */
656
Generic accelerometer interface header.
void adxl355SPIWriteRegister(ADXL355Driver *devp, uint8_t reg, size_t n, uint8_t *b)
Writes a value into a generic register using SPI.
Definition adxl355.c:432
adxl355_acc_fs_t
ADXL355 full scale.
Definition adxl355.h:340
adxl355_acc_hp_t
ADXL355 HP filter.
Definition adxl355.h:366
#define _adxl355_data
ADXL355Driver specific data.
Definition adxl355.h:461
adxl355_acc_odr_t
ADXL355 output data rate.
Definition adxl355.h:349
void adxl355Start(ADXL355Driver *devp, const ADXL355Config *config)
Configures and activates ADXL355 Complex Driver peripheral.
Definition adxl355.c:484
adxl355_state_t
Driver state machine possible states.
Definition adxl355.h:379
void adxl355SPIReadRegister(ADXL355Driver *devp, uint8_t reg, size_t n, uint8_t *b)
Reads a generic register value using SPI.
Definition adxl355.c:403
void adxl355ObjectInit(ADXL355Driver *devp, uint8_t *txbp, uint8_t *rxbp)
Initializes an instance.
Definition adxl355.c:463
void adxl355Stop(ADXL355Driver *devp)
Deactivates the ADXL355 Complex Driver peripheral.
Definition adxl355.c:618
#define _adxl355_methods
ADXL355 specific methods with inherited ones.
Definition adxl355.h:445
@ ADXL355_ACC_FS_4G
Definition adxl355.h:342
@ ADXL355_ACC_FS_8G
Definition adxl355.h:343
@ ADXL355_ACC_FS_2G
Definition adxl355.h:341
@ ADXL355_ACC_HP_DISABLED
Definition adxl355.h:367
@ ADXL355_ACC_HP_LEV_6
Definition adxl355.h:373
@ ADXL355_ACC_HP_LEV_3
Definition adxl355.h:370
@ ADXL355_ACC_HP_LEV_5
Definition adxl355.h:372
@ ADXL355_ACC_HP_LEV_2
Definition adxl355.h:369
@ ADXL355_ACC_HP_LEV_1
Definition adxl355.h:368
@ ADXL355_ACC_HP_LEV_4
Definition adxl355.h:371
@ ADXL355_ACC_ODR_15P625HZ
Definition adxl355.h:358
@ ADXL355_ACC_ODR_500HZ
Definition adxl355.h:353
@ ADXL355_ACC_ODR_7P913HZ
Definition adxl355.h:359
@ ADXL355_ACC_ODR_125HZ
Definition adxl355.h:355
@ ADXL355_ACC_ODR_3P906HZ
Definition adxl355.h:360
@ ADXL355_ACC_ODR_250HZ
Definition adxl355.h:354
@ ADXL355_ACC_ODR_31P25HZ
Definition adxl355.h:357
@ ADXL355_ACC_ODR_62P5HZ
Definition adxl355.h:356
@ ADXL355_ACC_ODR_1000HZ
Definition adxl355.h:352
@ ADXL355_ACC_ODR_4000HZ
Definition adxl355.h:350
@ ADXL355_ACC_ODR_2000HZ
Definition adxl355.h:351
@ ADXL355_READY
Definition adxl355.h:382
@ ADXL355_UNINIT
Definition adxl355.h:380
@ ADXL355_STOP
Definition adxl355.h:381
ADXL355 configuration structure.
Definition adxl355.h:388
SPIDriver * spip
SPI driver associated to this ADXL355.
Definition adxl355.h:394
const SPIConfig * spicfg
SPI configuration associated to this ADXL355.
Definition adxl355.h:398
I2CDriver * i2cp
I2C driver associated to this ADXL355.
Definition adxl355.h:404
adxl355_acc_hp_t acchighpass
ADXL355 HP filter bandwidth.
Definition adxl355.h:430
adxl355_acc_odr_t accodr
ADXL355 output data rate selection.
Definition adxl355.h:425
adxl355_acc_fs_t accfullscale
ADXL355 accelerometer subsystem initial full scale.
Definition adxl355.h:421
float * accbias
ADXL355 accelerometer subsystem initial bias.
Definition adxl355.h:417
float * accsensitivity
ADXL355 accelerometer subsystem initial sensitivity.
Definition adxl355.h:413
const I2CConfig * i2ccfg
I2C configuration associated to this ADXL355.
Definition adxl355.h:408
ADXL355 3-axis accelerometer class.
Definition adxl355.h:483
BaseAccelerometer acc_if
Base accelerometer interface.
Definition adxl355.h:487
const struct ADXL355VMT * vmt
Virtual Methods Table.
Definition adxl355.h:485
ADXL355 virtual methods table.
Definition adxl355.h:454
Base accelerometer class.