1 /**
2   ******************************************************************************
3   * @file    iis2dlpc_reg.h
4   * @author  Sensors Software Solution Team
5   * @brief   This file contains all the functions prototypes for the
6   *          iis2dlpc_reg.c driver.
7   ******************************************************************************
8   * @attention
9   *
10   * <h2><center>&copy; Copyright (c) 2021 STMicroelectronics.
11   * All rights reserved.</center></h2>
12   *
13   * This software component is licensed by ST under BSD 3-Clause license,
14   * the "License"; You may not use this file except in compliance with the
15   * License. You may obtain a copy of the License at:
16   *                        opensource.org/licenses/BSD-3-Clause
17   *
18   ******************************************************************************
19   */
20 
21 /* Define to prevent recursive inclusion -------------------------------------*/
22 #ifndef IIS2DLPC_REGS_H
23 #define IIS2DLPC_REGS_H
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 /* Includes ------------------------------------------------------------------*/
30 #include <stdint.h>
31 #include <stddef.h>
32 #include <math.h>
33 
34 /** @addtogroup IIS2DLPC
35   * @{
36   *
37   */
38 
39 /** @defgroup  Endianness definitions
40   * @{
41   *
42   */
43 
44 #ifndef DRV_BYTE_ORDER
45 #ifndef __BYTE_ORDER__
46 
47 #define DRV_LITTLE_ENDIAN 1234
48 #define DRV_BIG_ENDIAN    4321
49 
50 /** if _BYTE_ORDER is not defined, choose the endianness of your architecture
51   * by uncommenting the define which fits your platform endianness
52   */
53 //#define DRV_BYTE_ORDER    DRV_BIG_ENDIAN
54 #define DRV_BYTE_ORDER    DRV_LITTLE_ENDIAN
55 
56 #else /* defined __BYTE_ORDER__ */
57 
58 #define DRV_LITTLE_ENDIAN  __ORDER_LITTLE_ENDIAN__
59 #define DRV_BIG_ENDIAN     __ORDER_BIG_ENDIAN__
60 #define DRV_BYTE_ORDER     __BYTE_ORDER__
61 
62 #endif /* __BYTE_ORDER__*/
63 #endif /* DRV_BYTE_ORDER */
64 
65 /**
66   * @}
67   *
68   */
69 
70 /** @defgroup STMicroelectronics sensors common types
71   * @{
72   *
73   */
74 
75 #ifndef MEMS_SHARED_TYPES
76 #define MEMS_SHARED_TYPES
77 
78 typedef struct
79 {
80 #if DRV_BYTE_ORDER == DRV_LITTLE_ENDIAN
81   uint8_t bit0       : 1;
82   uint8_t bit1       : 1;
83   uint8_t bit2       : 1;
84   uint8_t bit3       : 1;
85   uint8_t bit4       : 1;
86   uint8_t bit5       : 1;
87   uint8_t bit6       : 1;
88   uint8_t bit7       : 1;
89 #elif DRV_BYTE_ORDER == DRV_BIG_ENDIAN
90   uint8_t bit7       : 1;
91   uint8_t bit6       : 1;
92   uint8_t bit5       : 1;
93   uint8_t bit4       : 1;
94   uint8_t bit3       : 1;
95   uint8_t bit2       : 1;
96   uint8_t bit1       : 1;
97   uint8_t bit0       : 1;
98 #endif /* DRV_BYTE_ORDER */
99 } bitwise_t;
100 
101 #define PROPERTY_DISABLE                (0U)
102 #define PROPERTY_ENABLE                 (1U)
103 
104 /** @addtogroup  Interfaces_Functions
105   * @brief       This section provide a set of functions used to read and
106   *              write a generic register of the device.
107   *              MANDATORY: return 0 -> no Error.
108   * @{
109   *
110   */
111 
112 typedef int32_t (*stmdev_write_ptr)(void *, uint8_t, const uint8_t *, uint16_t);
113 typedef int32_t (*stmdev_read_ptr)(void *, uint8_t, uint8_t *, uint16_t);
114 typedef void (*stmdev_mdelay_ptr)(uint32_t millisec);
115 
116 typedef struct
117 {
118   /** Component mandatory fields **/
119   stmdev_write_ptr  write_reg;
120   stmdev_read_ptr   read_reg;
121   /** Component optional fields **/
122   stmdev_mdelay_ptr   mdelay;
123   /** Customizable optional pointer **/
124   void *handle;
125 } stmdev_ctx_t;
126 
127 /**
128   * @}
129   *
130   */
131 
132 #endif /* MEMS_SHARED_TYPES */
133 
134 #ifndef MEMS_UCF_SHARED_TYPES
135 #define MEMS_UCF_SHARED_TYPES
136 
137 /** @defgroup    Generic address-data structure definition
138   * @brief       This structure is useful to load a predefined configuration
139   *              of a sensor.
140   *              You can create a sensor configuration by your own or using
141   *              Unico / Unicleo tools available on STMicroelectronics
142   *              web site.
143   *
144   * @{
145   *
146   */
147 
148 typedef struct
149 {
150   uint8_t address;
151   uint8_t data;
152 } ucf_line_t;
153 
154 /**
155   * @}
156   *
157   */
158 
159 #endif /* MEMS_UCF_SHARED_TYPES */
160 
161 /**
162   * @}
163   *
164   */
165 
166 /** @defgroup IIS2DLPC_Infos
167   * @{
168   *
169   */
170 
171 /** I2C Device Address 8 bit format  if SA0=0 -> 31 if SA0=1 -> 33 **/
172 #define IIS2DLPC_I2C_ADD_L   0x31U
173 #define IIS2DLPC_I2C_ADD_H   0x33U
174 
175 /** Device Identification (Who am I) **/
176 #define IIS2DLPC_ID            0x44U
177 
178 /**
179   * @}
180   *
181   */
182 
183 #define IIS2DLPC_OUT_T_L                     0x0DU
184 #define IIS2DLPC_OUT_T_H                     0x0EU
185 #define IIS2DLPC_WHO_AM_I                    0x0FU
186 #define IIS2DLPC_CTRL1                       0x20U
187 typedef struct
188 {
189 #if DRV_BYTE_ORDER == DRV_LITTLE_ENDIAN
190   uint8_t lp_mode                    : 2;
191   uint8_t mode                       : 2;
192   uint8_t odr                        : 4;
193 #elif DRV_BYTE_ORDER == DRV_BIG_ENDIAN
194   uint8_t odr                        : 4;
195   uint8_t mode                       : 2;
196   uint8_t lp_mode                    : 2;
197 #endif /* DRV_BYTE_ORDER */
198 } iis2dlpc_ctrl1_t;
199 
200 #define IIS2DLPC_CTRL2                       0x21U
201 typedef struct
202 {
203 #if DRV_BYTE_ORDER == DRV_LITTLE_ENDIAN
204   uint8_t sim                        : 1;
205   uint8_t i2c_disable                : 1;
206   uint8_t if_add_inc                 : 1;
207   uint8_t bdu                        : 1;
208   uint8_t cs_pu_disc                 : 1;
209   uint8_t not_used_01                : 1;
210   uint8_t soft_reset                 : 1;
211   uint8_t boot                       : 1;
212 #elif DRV_BYTE_ORDER == DRV_BIG_ENDIAN
213   uint8_t boot                       : 1;
214   uint8_t soft_reset                 : 1;
215   uint8_t not_used_01                : 1;
216   uint8_t cs_pu_disc                 : 1;
217   uint8_t bdu                        : 1;
218   uint8_t if_add_inc                 : 1;
219   uint8_t i2c_disable                : 1;
220   uint8_t sim                        : 1;
221 #endif /* DRV_BYTE_ORDER */
222 } iis2dlpc_ctrl2_t;
223 
224 #define IIS2DLPC_CTRL3                       0x22U
225 typedef struct
226 {
227 #if DRV_BYTE_ORDER == DRV_LITTLE_ENDIAN
228 uint8_t slp_mode                   :
229   2;  /* slp_mode_sel + slp_mode_1 */
230   uint8_t not_used_01                : 1;
231   uint8_t h_lactive                  : 1;
232   uint8_t lir                        : 1;
233   uint8_t pp_od                      : 1;
234   uint8_t st                         : 2;
235 #elif DRV_BYTE_ORDER == DRV_BIG_ENDIAN
236   uint8_t st                         : 2;
237   uint8_t pp_od                      : 1;
238   uint8_t lir                        : 1;
239   uint8_t h_lactive                  : 1;
240   uint8_t not_used_01                : 1;
241 uint8_t slp_mode                   :
242   2;  /* slp_mode_sel + slp_mode_1 */
243 #endif /* DRV_BYTE_ORDER */
244 } iis2dlpc_ctrl3_t;
245 
246 #define IIS2DLPC_CTRL4_INT1_PAD_CTRL         0x23U
247 typedef struct
248 {
249 #if DRV_BYTE_ORDER == DRV_LITTLE_ENDIAN
250   uint8_t int1_drdy                  : 1;
251   uint8_t int1_fth                   : 1;
252   uint8_t int1_diff5                 : 1;
253   uint8_t int1_tap                   : 1;
254   uint8_t int1_ff                    : 1;
255   uint8_t int1_wu                    : 1;
256   uint8_t int1_single_tap            : 1;
257   uint8_t int1_6d                    : 1;
258 #elif DRV_BYTE_ORDER == DRV_BIG_ENDIAN
259   uint8_t int1_6d                    : 1;
260   uint8_t int1_single_tap            : 1;
261   uint8_t int1_wu                    : 1;
262   uint8_t int1_ff                    : 1;
263   uint8_t int1_tap                   : 1;
264   uint8_t int1_diff5                 : 1;
265   uint8_t int1_fth                   : 1;
266   uint8_t int1_drdy                  : 1;
267 #endif /* DRV_BYTE_ORDER */
268 } iis2dlpc_ctrl4_int1_pad_ctrl_t;
269 
270 #define IIS2DLPC_CTRL5_INT2_PAD_CTRL         0x24U
271 typedef struct
272 {
273 #if DRV_BYTE_ORDER == DRV_LITTLE_ENDIAN
274   uint8_t int2_drdy                  : 1;
275   uint8_t int2_fth                   : 1;
276   uint8_t int2_diff5                 : 1;
277   uint8_t int2_ovr                   : 1;
278   uint8_t int2_drdy_t                : 1;
279   uint8_t int2_boot                  : 1;
280   uint8_t int2_sleep_chg             : 1;
281   uint8_t int2_sleep_state           : 1;
282 #elif DRV_BYTE_ORDER == DRV_BIG_ENDIAN
283   uint8_t int2_sleep_state           : 1;
284   uint8_t int2_sleep_chg             : 1;
285   uint8_t int2_boot                  : 1;
286   uint8_t int2_drdy_t                : 1;
287   uint8_t int2_ovr                   : 1;
288   uint8_t int2_diff5                 : 1;
289   uint8_t int2_fth                   : 1;
290   uint8_t int2_drdy                  : 1;
291 #endif /* DRV_BYTE_ORDER */
292 } iis2dlpc_ctrl5_int2_pad_ctrl_t;
293 
294 #define IIS2DLPC_CTRL6                       0x25U
295 typedef struct
296 {
297 #if DRV_BYTE_ORDER == DRV_LITTLE_ENDIAN
298   uint8_t not_used_01                : 2;
299   uint8_t low_noise                  : 1;
300   uint8_t fds                        : 1;
301   uint8_t fs                         : 2;
302   uint8_t bw_filt                    : 2;
303 #elif DRV_BYTE_ORDER == DRV_BIG_ENDIAN
304   uint8_t bw_filt                    : 2;
305   uint8_t fs                         : 2;
306   uint8_t fds                        : 1;
307   uint8_t low_noise                  : 1;
308   uint8_t not_used_01                : 2;
309 #endif /* DRV_BYTE_ORDER */
310 } iis2dlpc_ctrl6_t;
311 
312 #define IIS2DLPC_OUT_T                       0x26U
313 #define IIS2DLPC_STATUS                      0x27U
314 typedef struct
315 {
316 #if DRV_BYTE_ORDER == DRV_LITTLE_ENDIAN
317   uint8_t drdy                       : 1;
318   uint8_t ff_ia                      : 1;
319   uint8_t _6d_ia                     : 1;
320   uint8_t single_tap                 : 1;
321   uint8_t double_tap                 : 1;
322   uint8_t sleep_state                : 1;
323   uint8_t wu_ia                      : 1;
324   uint8_t fifo_ths                   : 1;
325 #elif DRV_BYTE_ORDER == DRV_BIG_ENDIAN
326   uint8_t fifo_ths                   : 1;
327   uint8_t wu_ia                      : 1;
328   uint8_t sleep_state                : 1;
329   uint8_t double_tap                 : 1;
330   uint8_t single_tap                 : 1;
331   uint8_t _6d_ia                     : 1;
332   uint8_t ff_ia                      : 1;
333   uint8_t drdy                       : 1;
334 #endif /* DRV_BYTE_ORDER */
335 } iis2dlpc_status_t;
336 
337 #define IIS2DLPC_OUT_X_L                     0x28U
338 #define IIS2DLPC_OUT_X_H                     0x29U
339 #define IIS2DLPC_OUT_Y_L                     0x2AU
340 #define IIS2DLPC_OUT_Y_H                     0x2BU
341 #define IIS2DLPC_OUT_Z_L                     0x2CU
342 #define IIS2DLPC_OUT_Z_H                     0x2DU
343 #define IIS2DLPC_FIFO_CTRL                   0x2EU
344 typedef struct
345 {
346 #if DRV_BYTE_ORDER == DRV_LITTLE_ENDIAN
347   uint8_t fth                        : 5;
348   uint8_t fmode                      : 3;
349 #elif DRV_BYTE_ORDER == DRV_BIG_ENDIAN
350   uint8_t fmode                      : 3;
351   uint8_t fth                        : 5;
352 #endif /* DRV_BYTE_ORDER */
353 } iis2dlpc_fifo_ctrl_t;
354 
355 #define IIS2DLPC_FIFO_SAMPLES                0x2FU
356 typedef struct
357 {
358 #if DRV_BYTE_ORDER == DRV_LITTLE_ENDIAN
359   uint8_t diff                       : 6;
360   uint8_t fifo_ovr                   : 1;
361   uint8_t fifo_fth                   : 1;
362 #elif DRV_BYTE_ORDER == DRV_BIG_ENDIAN
363   uint8_t fifo_fth                   : 1;
364   uint8_t fifo_ovr                   : 1;
365   uint8_t diff                       : 6;
366 #endif /* DRV_BYTE_ORDER */
367 } iis2dlpc_fifo_samples_t;
368 
369 #define IIS2DLPC_TAP_THS_X                   0x30U
370 typedef struct
371 {
372 #if DRV_BYTE_ORDER == DRV_LITTLE_ENDIAN
373   uint8_t tap_thsx                    : 5;
374   uint8_t _6d_ths                     : 2;
375   uint8_t _4d_en                      : 1;
376 #elif DRV_BYTE_ORDER == DRV_BIG_ENDIAN
377   uint8_t _4d_en                      : 1;
378   uint8_t _6d_ths                     : 2;
379   uint8_t tap_thsx                    : 5;
380 #endif /* DRV_BYTE_ORDER */
381 } iis2dlpc_tap_ths_x_t;
382 
383 #define IIS2DLPC_TAP_THS_Y                   0x31U
384 typedef struct
385 {
386 #if DRV_BYTE_ORDER == DRV_LITTLE_ENDIAN
387   uint8_t tap_thsy                   : 5;
388   uint8_t tap_prior                  : 3;
389 #elif DRV_BYTE_ORDER == DRV_BIG_ENDIAN
390   uint8_t tap_prior                  : 3;
391   uint8_t tap_thsy                   : 5;
392 #endif /* DRV_BYTE_ORDER */
393 } iis2dlpc_tap_ths_y_t;
394 
395 #define IIS2DLPC_TAP_THS_Z                   0x32U
396 typedef struct
397 {
398 #if DRV_BYTE_ORDER == DRV_LITTLE_ENDIAN
399   uint8_t tap_thsz                   : 5;
400   uint8_t tap_z_en                   : 1;
401   uint8_t tap_y_en                   : 1;
402   uint8_t tap_x_en                   : 1;
403 #elif DRV_BYTE_ORDER == DRV_BIG_ENDIAN
404   uint8_t tap_x_en                   : 1;
405   uint8_t tap_y_en                   : 1;
406   uint8_t tap_z_en                   : 1;
407   uint8_t tap_thsz                   : 5;
408 #endif /* DRV_BYTE_ORDER */
409 } iis2dlpc_tap_ths_z_t;
410 
411 #define IIS2DLPC_INT_DUR                     0x33U
412 typedef struct
413 {
414 #if DRV_BYTE_ORDER == DRV_LITTLE_ENDIAN
415   uint8_t shock                      : 2;
416   uint8_t quiet                      : 2;
417   uint8_t latency                    : 4;
418 #elif DRV_BYTE_ORDER == DRV_BIG_ENDIAN
419   uint8_t latency                    : 4;
420   uint8_t quiet                      : 2;
421   uint8_t shock                      : 2;
422 #endif /* DRV_BYTE_ORDER */
423 } iis2dlpc_int_dur_t;
424 
425 #define IIS2DLPC_WAKE_UP_THS                 0x34U
426 typedef struct
427 {
428 #if DRV_BYTE_ORDER == DRV_LITTLE_ENDIAN
429   uint8_t wk_ths                     : 6;
430   uint8_t sleep_on                   : 1;
431   uint8_t single_double_tap          : 1;
432 #elif DRV_BYTE_ORDER == DRV_BIG_ENDIAN
433   uint8_t single_double_tap          : 1;
434   uint8_t sleep_on                   : 1;
435   uint8_t wk_ths                     : 6;
436 #endif /* DRV_BYTE_ORDER */
437 } iis2dlpc_wake_up_ths_t;
438 
439 #define IIS2DLPC_WAKE_UP_DUR                 0x35U
440 typedef struct
441 {
442 #if DRV_BYTE_ORDER == DRV_LITTLE_ENDIAN
443   uint8_t sleep_dur                  : 4;
444   uint8_t stationary                 : 1;
445   uint8_t wake_dur                   : 2;
446   uint8_t ff_dur                     : 1;
447 #elif DRV_BYTE_ORDER == DRV_BIG_ENDIAN
448   uint8_t ff_dur                     : 1;
449   uint8_t wake_dur                   : 2;
450   uint8_t stationary                 : 1;
451   uint8_t sleep_dur                  : 4;
452 #endif /* DRV_BYTE_ORDER */
453 } iis2dlpc_wake_up_dur_t;
454 
455 #define IIS2DLPC_FREE_FALL                   0x36U
456 typedef struct
457 {
458 #if DRV_BYTE_ORDER == DRV_LITTLE_ENDIAN
459   uint8_t ff_ths                     : 3;
460   uint8_t ff_dur                     : 5;
461 #elif DRV_BYTE_ORDER == DRV_BIG_ENDIAN
462   uint8_t ff_dur                     : 5;
463   uint8_t ff_ths                     : 3;
464 #endif /* DRV_BYTE_ORDER */
465 } iis2dlpc_free_fall_t;
466 
467 #define IIS2DLPC_STATUS_DUP                  0x37U
468 typedef struct
469 {
470 #if DRV_BYTE_ORDER == DRV_LITTLE_ENDIAN
471   uint8_t drdy                       : 1;
472   uint8_t ff_ia                      : 1;
473   uint8_t _6d_ia                     : 1;
474   uint8_t single_tap                 : 1;
475   uint8_t double_tap                 : 1;
476   uint8_t sleep_state_ia             : 1;
477   uint8_t drdy_t                     : 1;
478   uint8_t ovr                        : 1;
479 #elif DRV_BYTE_ORDER == DRV_BIG_ENDIAN
480   uint8_t ovr                        : 1;
481   uint8_t drdy_t                     : 1;
482   uint8_t sleep_state_ia             : 1;
483   uint8_t double_tap                 : 1;
484   uint8_t single_tap                 : 1;
485   uint8_t _6d_ia                     : 1;
486   uint8_t ff_ia                      : 1;
487   uint8_t drdy                       : 1;
488 #endif /* DRV_BYTE_ORDER */
489 } iis2dlpc_status_dup_t;
490 
491 #define IIS2DLPC_WAKE_UP_SRC                 0x38U
492 typedef struct
493 {
494 #if DRV_BYTE_ORDER == DRV_LITTLE_ENDIAN
495   uint8_t z_wu                       : 1;
496   uint8_t y_wu                       : 1;
497   uint8_t x_wu                       : 1;
498   uint8_t wu_ia                      : 1;
499   uint8_t sleep_state_ia             : 1;
500   uint8_t ff_ia                      : 1;
501   uint8_t not_used_01                : 2;
502 #elif DRV_BYTE_ORDER == DRV_BIG_ENDIAN
503   uint8_t not_used_01                : 2;
504   uint8_t ff_ia                      : 1;
505   uint8_t sleep_state_ia             : 1;
506   uint8_t wu_ia                      : 1;
507   uint8_t x_wu                       : 1;
508   uint8_t y_wu                       : 1;
509   uint8_t z_wu                       : 1;
510 #endif /* DRV_BYTE_ORDER */
511 } iis2dlpc_wake_up_src_t;
512 
513 #define IIS2DLPC_TAP_SRC                     0x39U
514 typedef struct
515 {
516 #if DRV_BYTE_ORDER == DRV_LITTLE_ENDIAN
517   uint8_t z_tap                      : 1;
518   uint8_t y_tap                      : 1;
519   uint8_t x_tap                      : 1;
520   uint8_t tap_sign                   : 1;
521   uint8_t double_tap                 : 1;
522   uint8_t single_tap                 : 1;
523   uint8_t tap_ia                     : 1;
524   uint8_t not_used_01                : 1;
525 #elif DRV_BYTE_ORDER == DRV_BIG_ENDIAN
526   uint8_t not_used_01                : 1;
527   uint8_t tap_ia                     : 1;
528   uint8_t single_tap                 : 1;
529   uint8_t double_tap                 : 1;
530   uint8_t tap_sign                   : 1;
531   uint8_t x_tap                      : 1;
532   uint8_t y_tap                      : 1;
533   uint8_t z_tap                      : 1;
534 #endif /* DRV_BYTE_ORDER */
535 } iis2dlpc_tap_src_t;
536 
537 #define IIS2DLPC_SIXD_SRC                    0x3AU
538 typedef struct
539 {
540 #if DRV_BYTE_ORDER == DRV_LITTLE_ENDIAN
541   uint8_t xl                         : 1;
542   uint8_t xh                         : 1;
543   uint8_t yl                         : 1;
544   uint8_t yh                         : 1;
545   uint8_t zl                         : 1;
546   uint8_t zh                         : 1;
547   uint8_t _6d_ia                     : 1;
548   uint8_t not_used_01                : 1;
549 #elif DRV_BYTE_ORDER == DRV_BIG_ENDIAN
550   uint8_t not_used_01                : 1;
551   uint8_t _6d_ia                     : 1;
552   uint8_t zh                         : 1;
553   uint8_t zl                         : 1;
554   uint8_t yh                         : 1;
555   uint8_t yl                         : 1;
556   uint8_t xh                         : 1;
557   uint8_t xl                         : 1;
558 #endif /* DRV_BYTE_ORDER */
559 } iis2dlpc_sixd_src_t;
560 
561 #define IIS2DLPC_ALL_INT_SRC                 0x3BU
562 typedef struct
563 {
564 #if DRV_BYTE_ORDER == DRV_LITTLE_ENDIAN
565   uint8_t ff_ia                      : 1;
566   uint8_t wu_ia                      : 1;
567   uint8_t single_tap                 : 1;
568   uint8_t double_tap                 : 1;
569   uint8_t _6d_ia                     : 1;
570   uint8_t sleep_change_ia            : 1;
571   uint8_t not_used_01                : 2;
572 #elif DRV_BYTE_ORDER == DRV_BIG_ENDIAN
573   uint8_t not_used_01                : 2;
574   uint8_t sleep_change_ia            : 1;
575   uint8_t _6d_ia                     : 1;
576   uint8_t double_tap                 : 1;
577   uint8_t single_tap                 : 1;
578   uint8_t wu_ia                      : 1;
579   uint8_t ff_ia                      : 1;
580 #endif /* DRV_BYTE_ORDER */
581 } iis2dlpc_all_int_src_t;
582 
583 #define IIS2DLPC_X_OFS_USR                   0x3CU
584 #define IIS2DLPC_Y_OFS_USR                   0x3DU
585 #define IIS2DLPC_Z_OFS_USR                   0x3EU
586 #define IIS2DLPC_CTRL7                       0x3FU
587 typedef struct
588 {
589 #if DRV_BYTE_ORDER == DRV_LITTLE_ENDIAN
590   uint8_t lpass_on6d                 : 1;
591   uint8_t hp_ref_mode                : 1;
592   uint8_t usr_off_w                  : 1;
593   uint8_t usr_off_on_wu              : 1;
594   uint8_t usr_off_on_out             : 1;
595   uint8_t interrupts_enable          : 1;
596   uint8_t int2_on_int1               : 1;
597   uint8_t drdy_pulsed                : 1;
598 #elif DRV_BYTE_ORDER == DRV_BIG_ENDIAN
599   uint8_t drdy_pulsed                : 1;
600   uint8_t int2_on_int1               : 1;
601   uint8_t interrupts_enable          : 1;
602   uint8_t usr_off_on_out             : 1;
603   uint8_t usr_off_on_wu              : 1;
604   uint8_t usr_off_w                  : 1;
605   uint8_t hp_ref_mode                : 1;
606   uint8_t lpass_on6d                 : 1;
607 #endif /* DRV_BYTE_ORDER */
608 } iis2dlpc_ctrl7_t;
609 
610 /**
611   * @defgroup IIS2DLPC_Register_Union
612   * @brief    This union group all the registers having a bit-field
613   *           description.
614   *           This union is useful but it's not needed by the driver.
615   *
616   *           REMOVING this union you are compliant with:
617   *           MISRA-C 2012 [Rule 19.2] -> " Union are not allowed "
618   *
619   * @{
620   *
621   */
622 typedef union
623 {
624   iis2dlpc_ctrl1_t                   ctrl1;
625   iis2dlpc_ctrl2_t                   ctrl2;
626   iis2dlpc_ctrl3_t                   ctrl3;
627   iis2dlpc_ctrl4_int1_pad_ctrl_t     ctrl4_int1_pad_ctrl;
628   iis2dlpc_ctrl5_int2_pad_ctrl_t     ctrl5_int2_pad_ctrl;
629   iis2dlpc_ctrl6_t                   ctrl6;
630   iis2dlpc_status_t                  status;
631   iis2dlpc_fifo_ctrl_t               fifo_ctrl;
632   iis2dlpc_fifo_samples_t            fifo_samples;
633   iis2dlpc_tap_ths_x_t               tap_ths_x;
634   iis2dlpc_tap_ths_y_t               tap_ths_y;
635   iis2dlpc_tap_ths_z_t               tap_ths_z;
636   iis2dlpc_int_dur_t                 int_dur;
637   iis2dlpc_wake_up_ths_t             wake_up_ths;
638   iis2dlpc_wake_up_dur_t             wake_up_dur;
639   iis2dlpc_free_fall_t               free_fall;
640   iis2dlpc_status_dup_t              status_dup;
641   iis2dlpc_wake_up_src_t             wake_up_src;
642   iis2dlpc_tap_src_t                 tap_src;
643   iis2dlpc_sixd_src_t                sixd_src;
644   iis2dlpc_all_int_src_t             all_int_src;
645   iis2dlpc_ctrl7_t                   ctrl7;
646   bitwise_t                          bitwise;
647   uint8_t                            byte;
648 } iis2dlpc_reg_t;
649 
650 /**
651   * @}
652   *
653   */
654 
655 #ifndef __weak
656 #define __weak __attribute__((weak))
657 #endif /* __weak */
658 
659 /*
660  * These are the basic platform dependent I/O routines to read
661  * and write device registers connected on a standard bus.
662  * The driver keeps offering a default implementation based on function
663  * pointers to read/write routines for backward compatibility.
664  * The __weak directive allows the final application to overwrite
665  * them with a custom implementation.
666  */
667 
668 int32_t iis2dlpc_read_reg(const stmdev_ctx_t *ctx, uint8_t reg,
669                           uint8_t *data,
670                           uint16_t len);
671 int32_t iis2dlpc_write_reg(const stmdev_ctx_t *ctx, uint8_t reg,
672                            uint8_t *data,
673                            uint16_t len);
674 
675 float_t iis2dlpc_from_fs2_to_mg(int16_t lsb);
676 float_t iis2dlpc_from_fs4_to_mg(int16_t lsb);
677 float_t iis2dlpc_from_fs8_to_mg(int16_t lsb);
678 float_t iis2dlpc_from_fs16_to_mg(int16_t lsb);
679 
680 float_t iis2dlpc_from_fs2_lp1_to_mg(int16_t lsb);
681 float_t iis2dlpc_from_fs4_lp1_to_mg(int16_t lsb);
682 float_t iis2dlpc_from_fs8_lp1_to_mg(int16_t lsb);
683 float_t iis2dlpc_from_fs16_lp1_to_mg(int16_t lsb);
684 
685 float_t iis2dlpc_from_lsb_to_celsius(int16_t lsb);
686 
687 typedef enum
688 {
689   IIS2DLPC_HIGH_PERFORMANCE                    = 0x04,
690   IIS2DLPC_CONT_LOW_PWR_4                      = 0x03,
691   IIS2DLPC_CONT_LOW_PWR_3                      = 0x02,
692   IIS2DLPC_CONT_LOW_PWR_2                      = 0x01,
693   IIS2DLPC_CONT_LOW_PWR_12bit                  = 0x00,
694   IIS2DLPC_SINGLE_LOW_PWR_4                    = 0x0B,
695   IIS2DLPC_SINGLE_LOW_PWR_3                    = 0x0A,
696   IIS2DLPC_SINGLE_LOW_PWR_2                    = 0x09,
697   IIS2DLPC_SINGLE_LOW_PWR_12bit                = 0x08,
698   IIS2DLPC_HIGH_PERFORMANCE_LOW_NOISE          = 0x14,
699   IIS2DLPC_CONT_LOW_PWR_LOW_NOISE_4            = 0x13,
700   IIS2DLPC_CONT_LOW_PWR_LOW_NOISE_3            = 0x12,
701   IIS2DLPC_CONT_LOW_PWR_LOW_NOISE_2            = 0x11,
702   IIS2DLPC_CONT_LOW_PWR_LOW_NOISE_12bit        = 0x10,
703   IIS2DLPC_SINGLE_LOW_PWR_LOW_NOISE_4          = 0x1B,
704   IIS2DLPC_SINGLE_LOW_PWR_LOW_NOISE_3          = 0x1A,
705   IIS2DLPC_SINGLE_LOW_PWR_LOW_NOISE_2          = 0x19,
706   IIS2DLPC_SINGLE_LOW_LOW_NOISE_PWR_12bit      = 0x18,
707 } iis2dlpc_mode_t;
708 int32_t iis2dlpc_power_mode_set(const stmdev_ctx_t *ctx,
709                                 iis2dlpc_mode_t val);
710 int32_t iis2dlpc_power_mode_get(const stmdev_ctx_t *ctx,
711                                 iis2dlpc_mode_t *val);
712 
713 typedef enum
714 {
715   IIS2DLPC_XL_ODR_OFF            = 0x00,
716   IIS2DLPC_XL_ODR_1Hz6_LP_ONLY   = 0x01,
717   IIS2DLPC_XL_ODR_12Hz5          = 0x02,
718   IIS2DLPC_XL_ODR_25Hz           = 0x03,
719   IIS2DLPC_XL_ODR_50Hz           = 0x04,
720   IIS2DLPC_XL_ODR_100Hz          = 0x05,
721   IIS2DLPC_XL_ODR_200Hz          = 0x06,
722   IIS2DLPC_XL_ODR_400Hz          = 0x07,
723   IIS2DLPC_XL_ODR_800Hz          = 0x08,
724   IIS2DLPC_XL_ODR_1k6Hz          = 0x09,
725   IIS2DLPC_XL_SET_SW_TRIG        = 0x12,  /* Use this only in SINGLE mode */
726   IIS2DLPC_XL_SET_PIN_TRIG       = 0x22,  /* Use this only in SINGLE mode */
727 } iis2dlpc_odr_t;
728 int32_t iis2dlpc_data_rate_set(const stmdev_ctx_t *ctx, iis2dlpc_odr_t val);
729 int32_t iis2dlpc_data_rate_get(const stmdev_ctx_t *ctx,
730                                iis2dlpc_odr_t *val);
731 
732 int32_t iis2dlpc_block_data_update_set(const stmdev_ctx_t *ctx,
733                                        uint8_t val);
734 int32_t iis2dlpc_block_data_update_get(const stmdev_ctx_t *ctx,
735                                        uint8_t *val);
736 
737 typedef enum
738 {
739   IIS2DLPC_2g     = 0,
740   IIS2DLPC_4g     = 1,
741   IIS2DLPC_8g     = 2,
742   IIS2DLPC_16g    = 3,
743 } iis2dlpc_fs_t;
744 int32_t iis2dlpc_full_scale_set(const stmdev_ctx_t *ctx, iis2dlpc_fs_t val);
745 int32_t iis2dlpc_full_scale_get(const stmdev_ctx_t *ctx,
746                                 iis2dlpc_fs_t *val);
747 
748 int32_t iis2dlpc_status_reg_get(const stmdev_ctx_t *ctx,
749                                 iis2dlpc_status_t *val);
750 
751 int32_t iis2dlpc_flag_data_ready_get(const stmdev_ctx_t *ctx, uint8_t *val);
752 
753 typedef struct
754 {
755   iis2dlpc_status_dup_t   status_dup;
756   iis2dlpc_wake_up_src_t  wake_up_src;
757   iis2dlpc_tap_src_t      tap_src;
758   iis2dlpc_sixd_src_t     sixd_src;
759   iis2dlpc_all_int_src_t  all_int_src;
760 } iis2dlpc_all_sources_t;
761 int32_t iis2dlpc_all_sources_get(const stmdev_ctx_t *ctx,
762                                  iis2dlpc_all_sources_t *val);
763 
764 int32_t iis2dlpc_usr_offset_x_set(const stmdev_ctx_t *ctx, uint8_t *buff);
765 int32_t iis2dlpc_usr_offset_x_get(const stmdev_ctx_t *ctx, uint8_t *buff);
766 
767 int32_t iis2dlpc_usr_offset_y_set(const stmdev_ctx_t *ctx, uint8_t *buff);
768 int32_t iis2dlpc_usr_offset_y_get(const stmdev_ctx_t *ctx, uint8_t *buff);
769 
770 int32_t iis2dlpc_usr_offset_z_set(const stmdev_ctx_t *ctx, uint8_t *buff);
771 int32_t iis2dlpc_usr_offset_z_get(const stmdev_ctx_t *ctx, uint8_t *buff);
772 
773 typedef enum
774 {
775   IIS2DLPC_LSb_977ug    = 0,
776   IIS2DLPC_LSb_15mg6    = 1,
777 } iis2dlpc_usr_off_w_t;
778 int32_t iis2dlpc_offset_weight_set(const stmdev_ctx_t *ctx,
779                                    iis2dlpc_usr_off_w_t val);
780 int32_t iis2dlpc_offset_weight_get(const stmdev_ctx_t *ctx,
781                                    iis2dlpc_usr_off_w_t *val);
782 
783 int32_t iis2dlpc_temperature_raw_get(const stmdev_ctx_t *ctx, int16_t *val);
784 
785 int32_t iis2dlpc_acceleration_raw_get(const stmdev_ctx_t *ctx,
786                                       int16_t *val);
787 
788 int32_t iis2dlpc_device_id_get(const stmdev_ctx_t *ctx, uint8_t *buff);
789 
790 int32_t iis2dlpc_auto_increment_set(const stmdev_ctx_t *ctx, uint8_t val);
791 int32_t iis2dlpc_auto_increment_get(const stmdev_ctx_t *ctx, uint8_t *val);
792 
793 int32_t iis2dlpc_reset_set(const stmdev_ctx_t *ctx, uint8_t val);
794 int32_t iis2dlpc_reset_get(const stmdev_ctx_t *ctx, uint8_t *val);
795 
796 int32_t iis2dlpc_boot_set(const stmdev_ctx_t *ctx, uint8_t val);
797 int32_t iis2dlpc_boot_get(const stmdev_ctx_t *ctx, uint8_t *val);
798 
799 typedef enum
800 {
801   IIS2DLPC_XL_ST_DISABLE      = 0,
802   IIS2DLPC_XL_ST_POSITIVE     = 1,
803   IIS2DLPC_XL_ST_NEGATIVE     = 2,
804 } iis2dlpc_st_t;
805 int32_t iis2dlpc_self_test_set(const stmdev_ctx_t *ctx, iis2dlpc_st_t val);
806 int32_t iis2dlpc_self_test_get(const stmdev_ctx_t *ctx, iis2dlpc_st_t *val);
807 
808 typedef enum
809 {
810   IIS2DLPC_DRDY_LATCHED   = 0,
811   IIS2DLPC_DRDY_PULSED    = 1,
812 } iis2dlpc_drdy_pulsed_t;
813 int32_t iis2dlpc_data_ready_mode_set(const stmdev_ctx_t *ctx,
814                                      iis2dlpc_drdy_pulsed_t val);
815 int32_t iis2dlpc_data_ready_mode_get(const stmdev_ctx_t *ctx,
816                                      iis2dlpc_drdy_pulsed_t *val);
817 
818 typedef enum
819 {
820   IIS2DLPC_LPF_ON_OUT         = 0x00,
821   IIS2DLPC_USER_OFFSET_ON_OUT  = 0x01,
822   IIS2DLPC_HIGH_PASS_ON_OUT    = 0x10,
823 } iis2dlpc_fds_t;
824 int32_t iis2dlpc_filter_path_set(const stmdev_ctx_t *ctx,
825                                  iis2dlpc_fds_t val);
826 int32_t iis2dlpc_filter_path_get(const stmdev_ctx_t *ctx,
827                                  iis2dlpc_fds_t *val);
828 
829 typedef enum
830 {
831   IIS2DLPC_ODR_DIV_2     = 0,
832   IIS2DLPC_ODR_DIV_4     = 1,
833   IIS2DLPC_ODR_DIV_10    = 2,
834   IIS2DLPC_ODR_DIV_20    = 3,
835 } iis2dlpc_bw_filt_t;
836 int32_t iis2dlpc_filter_bandwidth_set(const stmdev_ctx_t *ctx,
837                                       iis2dlpc_bw_filt_t val);
838 int32_t iis2dlpc_filter_bandwidth_get(const stmdev_ctx_t *ctx,
839                                       iis2dlpc_bw_filt_t *val);
840 
841 int32_t iis2dlpc_reference_mode_set(const stmdev_ctx_t *ctx, uint8_t val);
842 int32_t iis2dlpc_reference_mode_get(const stmdev_ctx_t *ctx, uint8_t *val);
843 
844 typedef enum
845 {
846   IIS2DLPC_SPI_4_WIRE   = 0,
847   IIS2DLPC_SPI_3_WIRE   = 1,
848 } iis2dlpc_sim_t;
849 int32_t iis2dlpc_spi_mode_set(const stmdev_ctx_t *ctx, iis2dlpc_sim_t val);
850 int32_t iis2dlpc_spi_mode_get(const stmdev_ctx_t *ctx, iis2dlpc_sim_t *val);
851 
852 typedef enum
853 {
854   IIS2DLPC_I2C_ENABLE    = 0,
855   IIS2DLPC_I2C_DISABLE   = 1,
856 } iis2dlpc_i2c_disable_t;
857 int32_t iis2dlpc_i2c_interface_set(const stmdev_ctx_t *ctx,
858                                    iis2dlpc_i2c_disable_t val);
859 int32_t iis2dlpc_i2c_interface_get(const stmdev_ctx_t *ctx,
860                                    iis2dlpc_i2c_disable_t *val);
861 
862 typedef enum
863 {
864   IIS2DLPC_PULL_UP_CONNECT     = 0,
865   IIS2DLPC_PULL_UP_DISCONNECT  = 1,
866 } iis2dlpc_cs_pu_disc_t;
867 int32_t iis2dlpc_cs_mode_set(const stmdev_ctx_t *ctx,
868                              iis2dlpc_cs_pu_disc_t val);
869 int32_t iis2dlpc_cs_mode_get(const stmdev_ctx_t *ctx,
870                              iis2dlpc_cs_pu_disc_t *val);
871 
872 typedef enum
873 {
874   IIS2DLPC_ACTIVE_HIGH  = 0,
875   IIS2DLPC_ACTIVE_LOW   = 1,
876 } iis2dlpc_h_lactive_t;
877 int32_t iis2dlpc_pin_polarity_set(const stmdev_ctx_t *ctx,
878                                   iis2dlpc_h_lactive_t val);
879 int32_t iis2dlpc_pin_polarity_get(const stmdev_ctx_t *ctx,
880                                   iis2dlpc_h_lactive_t *val);
881 
882 typedef enum
883 {
884   IIS2DLPC_INT_PULSED   = 0,
885   IIS2DLPC_INT_LATCHED  = 1,
886 } iis2dlpc_lir_t;
887 int32_t iis2dlpc_int_notification_set(const stmdev_ctx_t *ctx,
888                                       iis2dlpc_lir_t val);
889 int32_t iis2dlpc_int_notification_get(const stmdev_ctx_t *ctx,
890                                       iis2dlpc_lir_t *val);
891 
892 typedef enum
893 {
894   IIS2DLPC_PUSH_PULL   = 0,
895   IIS2DLPC_OPEN_DRAIN  = 1,
896 } iis2dlpc_pp_od_t;
897 int32_t iis2dlpc_pin_mode_set(const stmdev_ctx_t *ctx,
898                               iis2dlpc_pp_od_t val);
899 int32_t iis2dlpc_pin_mode_get(const stmdev_ctx_t *ctx,
900                               iis2dlpc_pp_od_t *val);
901 
902 int32_t iis2dlpc_pin_int1_route_set(const stmdev_ctx_t *ctx,
903                                     iis2dlpc_ctrl4_int1_pad_ctrl_t *val);
904 int32_t iis2dlpc_pin_int1_route_get(const stmdev_ctx_t *ctx,
905                                     iis2dlpc_ctrl4_int1_pad_ctrl_t *val);
906 
907 int32_t iis2dlpc_pin_int2_route_set(const stmdev_ctx_t *ctx,
908                                     iis2dlpc_ctrl5_int2_pad_ctrl_t *val);
909 int32_t iis2dlpc_pin_int2_route_get(const stmdev_ctx_t *ctx,
910                                     iis2dlpc_ctrl5_int2_pad_ctrl_t *val);
911 
912 int32_t iis2dlpc_all_on_int1_set(const stmdev_ctx_t *ctx, uint8_t val);
913 int32_t iis2dlpc_all_on_int1_get(const stmdev_ctx_t *ctx, uint8_t *val);
914 
915 int32_t iis2dlpc_wkup_threshold_set(const stmdev_ctx_t *ctx, uint8_t val);
916 int32_t iis2dlpc_wkup_threshold_get(const stmdev_ctx_t *ctx, uint8_t *val);
917 
918 int32_t iis2dlpc_wkup_dur_set(const stmdev_ctx_t *ctx, uint8_t val);
919 int32_t iis2dlpc_wkup_dur_get(const stmdev_ctx_t *ctx, uint8_t *val);
920 
921 typedef enum
922 {
923   IIS2DLPC_HP_FEED           = 0,
924   IIS2DLPC_USER_OFFSET_FEED  = 1,
925 } iis2dlpc_usr_off_on_wu_t;
926 int32_t iis2dlpc_wkup_feed_data_set(const stmdev_ctx_t *ctx,
927                                     iis2dlpc_usr_off_on_wu_t val);
928 int32_t iis2dlpc_wkup_feed_data_get(const stmdev_ctx_t *ctx,
929                                     iis2dlpc_usr_off_on_wu_t *val);
930 
931 typedef enum
932 {
933   IIS2DLPC_NO_DETECTION        = 0,
934   IIS2DLPC_DETECT_ACT_INACT    = 1,
935   IIS2DLPC_DETECT_STAT_MOTION  = 3,
936 } iis2dlpc_sleep_on_t;
937 int32_t iis2dlpc_act_mode_set(const stmdev_ctx_t *ctx,
938                               iis2dlpc_sleep_on_t val);
939 int32_t iis2dlpc_act_mode_get(const stmdev_ctx_t *ctx,
940                               iis2dlpc_sleep_on_t *val);
941 
942 int32_t iis2dlpc_act_sleep_dur_set(const stmdev_ctx_t *ctx, uint8_t val);
943 int32_t iis2dlpc_act_sleep_dur_get(const stmdev_ctx_t *ctx, uint8_t *val);
944 
945 int32_t iis2dlpc_tap_threshold_x_set(const stmdev_ctx_t *ctx, uint8_t val);
946 int32_t iis2dlpc_tap_threshold_x_get(const stmdev_ctx_t *ctx, uint8_t *val);
947 
948 int32_t iis2dlpc_tap_threshold_y_set(const stmdev_ctx_t *ctx, uint8_t val);
949 int32_t iis2dlpc_tap_threshold_y_get(const stmdev_ctx_t *ctx, uint8_t *val);
950 
951 typedef enum
952 {
953   IIS2DLPC_XYZ    = 0,
954   IIS2DLPC_YXZ    = 1,
955   IIS2DLPC_XZY    = 2,
956   IIS2DLPC_ZYX    = 3,
957   IIS2DLPC_YZX    = 5,
958   IIS2DLPC_ZXY    = 6,
959 } iis2dlpc_tap_prior_t;
960 int32_t iis2dlpc_tap_axis_priority_set(const stmdev_ctx_t *ctx,
961                                        iis2dlpc_tap_prior_t val);
962 int32_t iis2dlpc_tap_axis_priority_get(const stmdev_ctx_t *ctx,
963                                        iis2dlpc_tap_prior_t *val);
964 
965 int32_t iis2dlpc_tap_threshold_z_set(const stmdev_ctx_t *ctx, uint8_t val);
966 int32_t iis2dlpc_tap_threshold_z_get(const stmdev_ctx_t *ctx, uint8_t *val);
967 
968 int32_t iis2dlpc_tap_detection_on_z_set(const stmdev_ctx_t *ctx,
969                                         uint8_t val);
970 int32_t iis2dlpc_tap_detection_on_z_get(const stmdev_ctx_t *ctx,
971                                         uint8_t *val);
972 
973 int32_t iis2dlpc_tap_detection_on_y_set(const stmdev_ctx_t *ctx,
974                                         uint8_t val);
975 int32_t iis2dlpc_tap_detection_on_y_get(const stmdev_ctx_t *ctx,
976                                         uint8_t *val);
977 
978 int32_t iis2dlpc_tap_detection_on_x_set(const stmdev_ctx_t *ctx,
979                                         uint8_t val);
980 int32_t iis2dlpc_tap_detection_on_x_get(const stmdev_ctx_t *ctx,
981                                         uint8_t *val);
982 
983 int32_t iis2dlpc_tap_shock_set(const stmdev_ctx_t *ctx, uint8_t val);
984 int32_t iis2dlpc_tap_shock_get(const stmdev_ctx_t *ctx, uint8_t *val);
985 
986 int32_t iis2dlpc_tap_quiet_set(const stmdev_ctx_t *ctx, uint8_t val);
987 int32_t iis2dlpc_tap_quiet_get(const stmdev_ctx_t *ctx, uint8_t *val);
988 
989 int32_t iis2dlpc_tap_dur_set(const stmdev_ctx_t *ctx, uint8_t val);
990 int32_t iis2dlpc_tap_dur_get(const stmdev_ctx_t *ctx, uint8_t *val);
991 
992 typedef enum
993 {
994   IIS2DLPC_ONLY_SINGLE          = 0,
995   IIS2DLPC_BOTH_SINGLE_DOUBLE   = 1,
996 } iis2dlpc_single_double_tap_t;
997 int32_t iis2dlpc_tap_mode_set(const stmdev_ctx_t *ctx,
998                               iis2dlpc_single_double_tap_t val);
999 int32_t iis2dlpc_tap_mode_get(const stmdev_ctx_t *ctx,
1000                               iis2dlpc_single_double_tap_t *val);
1001 
1002 int32_t iis2dlpc_tap_src_get(const stmdev_ctx_t *ctx,
1003                              iis2dlpc_tap_src_t *val);
1004 
1005 int32_t iis2dlpc_6d_threshold_set(const stmdev_ctx_t *ctx, uint8_t val);
1006 int32_t iis2dlpc_6d_threshold_get(const stmdev_ctx_t *ctx, uint8_t *val);
1007 
1008 int32_t iis2dlpc_4d_mode_set(const stmdev_ctx_t *ctx, uint8_t val);
1009 int32_t iis2dlpc_4d_mode_get(const stmdev_ctx_t *ctx, uint8_t *val);
1010 
1011 int32_t iis2dlpc_6d_src_get(const stmdev_ctx_t *ctx,
1012                             iis2dlpc_sixd_src_t *val);
1013 
1014 typedef enum
1015 {
1016   IIS2DLPC_ODR_DIV_2_FEED   = 0,
1017   IIS2DLPC_LPF2_FEED        = 1,
1018 } iis2dlpc_lpass_on6d_t;
1019 int32_t iis2dlpc_6d_feed_data_set(const stmdev_ctx_t *ctx,
1020                                   iis2dlpc_lpass_on6d_t val);
1021 int32_t iis2dlpc_6d_feed_data_get(const stmdev_ctx_t *ctx,
1022                                   iis2dlpc_lpass_on6d_t *val);
1023 
1024 int32_t iis2dlpc_ff_dur_set(const stmdev_ctx_t *ctx, uint8_t val);
1025 int32_t iis2dlpc_ff_dur_get(const stmdev_ctx_t *ctx, uint8_t *val);
1026 
1027 typedef enum
1028 {
1029   IIS2DLPC_FF_TSH_5LSb_FS2g  = 0,
1030   IIS2DLPC_FF_TSH_7LSb_FS2g  = 1,
1031   IIS2DLPC_FF_TSH_8LSb_FS2g  = 2,
1032   IIS2DLPC_FF_TSH_10LSb_FS2g = 3,
1033   IIS2DLPC_FF_TSH_11LSb_FS2g = 4,
1034   IIS2DLPC_FF_TSH_13LSb_FS2g = 5,
1035   IIS2DLPC_FF_TSH_15LSb_FS2g = 6,
1036   IIS2DLPC_FF_TSH_16LSb_FS2g = 7,
1037 } iis2dlpc_ff_ths_t;
1038 int32_t iis2dlpc_ff_threshold_set(const stmdev_ctx_t *ctx,
1039                                   iis2dlpc_ff_ths_t val);
1040 int32_t iis2dlpc_ff_threshold_get(const stmdev_ctx_t *ctx,
1041                                   iis2dlpc_ff_ths_t *val);
1042 
1043 int32_t iis2dlpc_fifo_watermark_set(const stmdev_ctx_t *ctx, uint8_t val);
1044 int32_t iis2dlpc_fifo_watermark_get(const stmdev_ctx_t *ctx, uint8_t *val);
1045 
1046 typedef enum
1047 {
1048   IIS2DLPC_BYPASS_MODE             = 0,
1049   IIS2DLPC_FIFO_MODE               = 1,
1050   IIS2DLPC_STREAM_TO_FIFO_MODE     = 3,
1051   IIS2DLPC_BYPASS_TO_STREAM_MODE   = 4,
1052   IIS2DLPC_STREAM_MODE             = 6,
1053 } iis2dlpc_fmode_t;
1054 int32_t iis2dlpc_fifo_mode_set(const stmdev_ctx_t *ctx,
1055                                iis2dlpc_fmode_t val);
1056 int32_t iis2dlpc_fifo_mode_get(const stmdev_ctx_t *ctx,
1057                                iis2dlpc_fmode_t *val);
1058 
1059 int32_t iis2dlpc_fifo_data_level_get(const stmdev_ctx_t *ctx, uint8_t *val);
1060 
1061 int32_t iis2dlpc_fifo_ovr_flag_get(const stmdev_ctx_t *ctx, uint8_t *val);
1062 
1063 int32_t iis2dlpc_fifo_wtm_flag_get(const stmdev_ctx_t *ctx, uint8_t *val);
1064 
1065 /**
1066   * @}
1067   *
1068   */
1069 
1070 #ifdef __cplusplus
1071 }
1072 #endif
1073 
1074 #endif /*IIS2DLPC_REGS_H */
1075 
1076 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
1077