STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
ism330dhcx_reg.c
Go to the documentation of this file.
1/**
2 ******************************************************************************
3 * @file ism330dhcx_reg.c
4 * @author Sensors Software Solution Team
5 * @brief ISM330DHCX driver file
6 ******************************************************************************
7 * @attention
8 *
9 * <h2><center>&copy; Copyright (c) 2021 STMicroelectronics.
10 * All rights reserved.</center></h2>
11 *
12 * This software component is licensed by ST under BSD 3-Clause license,
13 * the "License"; You may not use this file except in compliance with the
14 * License. You may obtain a copy of the License at:
15 * opensource.org/licenses/BSD-3-Clause
16 *
17 ******************************************************************************
18 */
19
20#include "ism330dhcx_reg.h"
21
22/**
23 * @defgroup ISM330DHCX
24 * @brief This file provides a set of functions needed to drive the
25 * ism330dhcx enhanced inertial module.
26 * @{
27 *
28 */
29
30/**
31 * @defgroup ISM330DHCX_Interfaces_Functions
32 * @brief This section provide a set of functions used to read and
33 * write a generic register of the device.
34 * MANDATORY: return 0 -> no Error.
35 * @{
36 *
37 */
38
39/**
40 * @brief Read generic device register
41 *
42 * @param ctx read / write interface definitions(ptr)
43 * @param reg register to read
44 * @param data pointer to buffer that store the data read(ptr)
45 * @param len number of consecutive register to read
46 * @retval interface status (MANDATORY: return 0 -> no Error)
47 *
48 */
49int32_t ism330dhcx_read_reg(stmdev_ctx_t *ctx, uint8_t reg,
50 uint8_t *data,
51 uint16_t len)
52{
53 int32_t ret;
54 ret = ctx->read_reg(ctx->handle, reg, data, len);
55
56 return ret;
57}
58
59/**
60 * @brief Write generic device register
61 *
62 * @param ctx read / write interface definitions(ptr)
63 * @param reg register to write
64 * @param data pointer to data to write in register reg(ptr)
65 * @param len number of consecutive register to write
66 * @retval interface status (MANDATORY: return 0 -> no Error)
67 *
68 */
70 uint8_t *data,
71 uint16_t len)
72{
73 int32_t ret;
74 ret = ctx->write_reg(ctx->handle, reg, data, len);
75
76 return ret;
77}
78
79/**
80 * @}
81 *
82 */
83
84/**
85 * @defgroup ISM330DHCX_Sensitivity
86 * @brief These functions convert raw-data into engineering units.
87 * @{
88 *
89 */
90
92{
93 return ((float)lsb * 0.061f);
94}
95
97{
98 return ((float)lsb * 0.122f);
99}
100
102{
103 return ((float)lsb * 0.244f);
104}
105
107{
108 return ((float)lsb * 0.488f);
109}
110
112{
113 return ((float)lsb * 4.375f);
114}
115
117{
118 return ((float)lsb * 8.75f);
119}
120
122{
123 return ((float)lsb * 17.50f);
124}
125
127{
128 return ((float)lsb * 35.0f);
129}
130
132{
133 return ((float)lsb * 70.0f);
134}
135
137{
138 return ((float)lsb * 140.0f);
139}
140
142{
143 return (((float)lsb / 256.0f) + 25.0f);
144}
145
147{
148 return ((float)lsb * 25000.0f);
149}
150
151/**
152 * @}
153 *
154 */
155
156/**
157 * @defgroup LSM9DS1_Data_generation
158 * @brief This section groups all the functions concerning data
159 * generation
160 * @{
161 *
162 */
163
164/**
165 * @brief Accelerometer full-scale selection[set]
166 *
167 * @param ctx Read / write interface definitions.(ptr)
168 * @param val Change the values of fs_xl in reg CTRL1_XL
169 * @retval Interface status (MANDATORY: return 0 -> no Error).
170 *
171 */
174{
175 ism330dhcx_ctrl1_xl_t ctrl1_xl;
176 int32_t ret;
178 (uint8_t *)&ctrl1_xl, 1);
179
180 if (ret == 0)
181 {
182 ctrl1_xl.fs_xl = (uint8_t)val;
184 (uint8_t *)&ctrl1_xl, 1);
185 }
186
187 return ret;
188}
189
190/**
191 * @brief Accelerometer full-scale selection.[get]
192 *
193 * @param ctx Read / write interface definitions.(ptr)
194 * @param val Get the values of fs_xl in reg CTRL1_XL
195 * @retval Interface status (MANDATORY: return 0 -> no Error).
196 *
197 */
200{
201 ism330dhcx_ctrl1_xl_t ctrl1_xl;
202 int32_t ret;
204 (uint8_t *)&ctrl1_xl, 1);
205
206 switch (ctrl1_xl.fs_xl)
207 {
208 case ISM330DHCX_2g:
209 *val = ISM330DHCX_2g;
210 break;
211
212 case ISM330DHCX_16g:
213 *val = ISM330DHCX_16g;
214 break;
215
216 case ISM330DHCX_4g:
217 *val = ISM330DHCX_4g;
218 break;
219
220 case ISM330DHCX_8g:
221 *val = ISM330DHCX_8g;
222 break;
223
224 default:
225 *val = ISM330DHCX_2g;
226 break;
227 }
228
229 return ret;
230}
231
232/**
233 * @brief Accelerometer UI data rate selection.[set]
234 *
235 * @param ctx Read / write interface definitions.(ptr)
236 * @param val Change the values of odr_xl in reg CTRL1_XL
237 * @retval Interface status (MANDATORY: return 0 -> no Error).
238 *
239 */
242{
243 ism330dhcx_odr_xl_t odr_xl = val;
245 ism330dhcx_fsm_odr_t fsm_odr;
246 uint8_t mlc_enable;
247 ism330dhcx_mlc_odr_t mlc_odr;
248 ism330dhcx_ctrl1_xl_t ctrl1_xl;
249 int32_t ret;
250 /* Check the Finite State Machine data rate constraints */
251 ret = ism330dhcx_fsm_enable_get(ctx, &fsm_enable);
252
253 if (ret == 0)
254 {
255 if ((fsm_enable.fsm_enable_a.fsm1_en |
256 fsm_enable.fsm_enable_a.fsm2_en |
257 fsm_enable.fsm_enable_a.fsm3_en |
258 fsm_enable.fsm_enable_a.fsm4_en |
259 fsm_enable.fsm_enable_a.fsm5_en |
260 fsm_enable.fsm_enable_a.fsm6_en |
261 fsm_enable.fsm_enable_a.fsm7_en |
262 fsm_enable.fsm_enable_a.fsm8_en |
263 fsm_enable.fsm_enable_b.fsm9_en |
264 fsm_enable.fsm_enable_b.fsm10_en |
265 fsm_enable.fsm_enable_b.fsm11_en |
266 fsm_enable.fsm_enable_b.fsm12_en |
267 fsm_enable.fsm_enable_b.fsm13_en |
268 fsm_enable.fsm_enable_b.fsm14_en |
269 fsm_enable.fsm_enable_b.fsm15_en |
271 {
272 ret = ism330dhcx_fsm_data_rate_get(ctx, &fsm_odr);
273
274 if (ret == 0)
275 {
276 switch (fsm_odr)
277 {
279 if (val == ISM330DHCX_XL_ODR_OFF)
280 {
282 }
283
284 else
285 {
286 odr_xl = val;
287 }
288
289 break;
290
292 if (val == ISM330DHCX_XL_ODR_OFF)
293 {
294 odr_xl = ISM330DHCX_XL_ODR_26Hz;
295 }
296
297 else if (val == ISM330DHCX_XL_ODR_12Hz5)
298 {
299 odr_xl = ISM330DHCX_XL_ODR_26Hz;
300 }
301
302 else
303 {
304 odr_xl = val;
305 }
306
307 break;
308
310 if (val == ISM330DHCX_XL_ODR_OFF)
311 {
312 odr_xl = ISM330DHCX_XL_ODR_52Hz;
313 }
314
315 else if (val == ISM330DHCX_XL_ODR_12Hz5)
316 {
317 odr_xl = ISM330DHCX_XL_ODR_52Hz;
318 }
319
320 else if (val == ISM330DHCX_XL_ODR_26Hz)
321 {
322 odr_xl = ISM330DHCX_XL_ODR_52Hz;
323 }
324
325 else
326 {
327 odr_xl = val;
328 }
329
330 break;
331
333 if (val == ISM330DHCX_XL_ODR_OFF)
334 {
336 }
337
338 else if (val == ISM330DHCX_XL_ODR_12Hz5)
339 {
341 }
342
343 else if (val == ISM330DHCX_XL_ODR_26Hz)
344 {
346 }
347
348 else if (val == ISM330DHCX_XL_ODR_52Hz)
349 {
351 }
352
353 else
354 {
355 odr_xl = val;
356 }
357
358 break;
359
360 default:
361 odr_xl = val;
362 break;
363 }
364 }
365 }
366 }
367
368 /* Check the Machine Learning Core data rate constraints */
369 mlc_enable = PROPERTY_DISABLE;
370
371 if (ret == 0)
372 {
373 ret = ism330dhcx_mlc_get(ctx, &mlc_enable);
374
375 if (mlc_enable == PROPERTY_ENABLE)
376 {
377 ret = ism330dhcx_mlc_data_rate_get(ctx, &mlc_odr);
378
379 if (ret == 0)
380 {
381 switch (mlc_odr)
382 {
384 if (val == ISM330DHCX_XL_ODR_OFF)
385 {
387 }
388
389 else
390 {
391 odr_xl = val;
392 }
393
394 break;
395
397 if (val == ISM330DHCX_XL_ODR_OFF)
398 {
399 odr_xl = ISM330DHCX_XL_ODR_26Hz;
400 }
401
402 else if (val == ISM330DHCX_XL_ODR_12Hz5)
403 {
404 odr_xl = ISM330DHCX_XL_ODR_26Hz;
405 }
406
407 else
408 {
409 odr_xl = val;
410 }
411
412 break;
413
415 if (val == ISM330DHCX_XL_ODR_OFF)
416 {
417 odr_xl = ISM330DHCX_XL_ODR_52Hz;
418 }
419
420 else if (val == ISM330DHCX_XL_ODR_12Hz5)
421 {
422 odr_xl = ISM330DHCX_XL_ODR_52Hz;
423 }
424
425 else if (val == ISM330DHCX_XL_ODR_26Hz)
426 {
427 odr_xl = ISM330DHCX_XL_ODR_52Hz;
428 }
429
430 else
431 {
432 odr_xl = val;
433 }
434
435 break;
436
438 if (val == ISM330DHCX_XL_ODR_OFF)
439 {
441 }
442
443 else if (val == ISM330DHCX_XL_ODR_12Hz5)
444 {
446 }
447
448 else if (val == ISM330DHCX_XL_ODR_26Hz)
449 {
451 }
452
453 else if (val == ISM330DHCX_XL_ODR_52Hz)
454 {
456 }
457
458 else
459 {
460 odr_xl = val;
461 }
462
463 break;
464
465 default:
466 odr_xl = val;
467 break;
468 }
469 }
470 }
471 }
472
473 if (ret == 0)
474 {
476 (uint8_t *)&ctrl1_xl, 1);
477 }
478
479 if (ret == 0)
480 {
481 ctrl1_xl.odr_xl = (uint8_t)odr_xl;
483 (uint8_t *)&ctrl1_xl, 1);
484 }
485
486 return ret;
487}
488
489/**
490 * @brief Accelerometer UI data rate selection.[get]
491 *
492 * @param ctx Read / write interface definitions.(ptr)
493 * @param val Get the values of odr_xl in reg CTRL1_XL
494 * @retval Interface status (MANDATORY: return 0 -> no Error).
495 *
496 */
499{
500 ism330dhcx_ctrl1_xl_t ctrl1_xl;
501 int32_t ret;
503 (uint8_t *)&ctrl1_xl, 1);
504
505 switch (ctrl1_xl.odr_xl)
506 {
509 break;
510
513 break;
514
517 break;
518
521 break;
522
525 break;
526
529 break;
530
533 break;
534
537 break;
538
541 break;
542
545 break;
546
549 break;
550
553 break;
554
555 default:
557 break;
558 }
559
560 return ret;
561}
562
563/**
564 * @brief Gyroscope UI chain full-scale selection.[set]
565 *
566 * @param ctx Read / write interface definitions.(ptr)
567 * @param val Change the values of fs_g in reg CTRL2_G
568 * @retval Interface status (MANDATORY: return 0 -> no Error).
569 *
570 */
573{
574 ism330dhcx_ctrl2_g_t ctrl2_g;
575 int32_t ret;
577 (uint8_t *)&ctrl2_g, 1);
578
579 if (ret == 0)
580 {
581 ctrl2_g.fs_g = (uint8_t)val;
583 (uint8_t *)&ctrl2_g, 1);
584 }
585
586 return ret;
587}
588
589/**
590 * @brief Gyroscope UI chain full-scale selection.[get]
591 *
592 * @param ctx Read / write interface definitions.(ptr)
593 * @param val Get the values of fs_g in reg CTRL2_G
594 * @retval Interface status (MANDATORY: return 0 -> no Error).
595 *
596 */
599{
600 ism330dhcx_ctrl2_g_t ctrl2_g;
601 int32_t ret;
603 (uint8_t *)&ctrl2_g, 1);
604
605 switch (ctrl2_g.fs_g)
606 {
608 *val = ISM330DHCX_125dps;
609 break;
610
612 *val = ISM330DHCX_250dps;
613 break;
614
616 *val = ISM330DHCX_500dps;
617 break;
618
620 *val = ISM330DHCX_1000dps;
621 break;
622
624 *val = ISM330DHCX_2000dps;
625 break;
626
628 *val = ISM330DHCX_4000dps;
629 break;
630
631 default:
632 *val = ISM330DHCX_125dps;
633 break;
634 }
635
636 return ret;
637}
638
639/**
640 * @brief Gyroscope data rate.[set]
641 *
642 * @param ctx Read / write interface definitions.(ptr)
643 * @param val Change the values of odr_g in reg CTRL2_G
644 * @retval Interface status (MANDATORY: return 0 -> no Error).
645 *
646 */
649{
650 ism330dhcx_odr_g_t odr_gy = val;
652 ism330dhcx_fsm_odr_t fsm_odr;
653 uint8_t mlc_enable;
654 ism330dhcx_mlc_odr_t mlc_odr;
655 ism330dhcx_ctrl2_g_t ctrl2_g;
656 int32_t ret;
657 /* Check the Finite State Machine data rate constraints */
658 ret = ism330dhcx_fsm_enable_get(ctx, &fsm_enable);
659
660 if (ret == 0)
661 {
662 if ((fsm_enable.fsm_enable_a.fsm1_en |
663 fsm_enable.fsm_enable_a.fsm2_en |
664 fsm_enable.fsm_enable_a.fsm3_en |
665 fsm_enable.fsm_enable_a.fsm4_en |
666 fsm_enable.fsm_enable_a.fsm5_en |
667 fsm_enable.fsm_enable_a.fsm6_en |
668 fsm_enable.fsm_enable_a.fsm7_en |
669 fsm_enable.fsm_enable_a.fsm8_en |
670 fsm_enable.fsm_enable_b.fsm9_en |
671 fsm_enable.fsm_enable_b.fsm10_en |
672 fsm_enable.fsm_enable_b.fsm11_en |
673 fsm_enable.fsm_enable_b.fsm12_en |
674 fsm_enable.fsm_enable_b.fsm13_en |
675 fsm_enable.fsm_enable_b.fsm14_en |
676 fsm_enable.fsm_enable_b.fsm15_en |
678 {
679 ret = ism330dhcx_fsm_data_rate_get(ctx, &fsm_odr);
680
681 if (ret == 0)
682 {
683 switch (fsm_odr)
684 {
686 if (val == ISM330DHCX_GY_ODR_OFF)
687 {
689 }
690
691 else
692 {
693 odr_gy = val;
694 }
695
696 break;
697
699 if (val == ISM330DHCX_GY_ODR_OFF)
700 {
701 odr_gy = ISM330DHCX_GY_ODR_26Hz;
702 }
703
704 else if (val == ISM330DHCX_GY_ODR_12Hz5)
705 {
706 odr_gy = ISM330DHCX_GY_ODR_26Hz;
707 }
708
709 else
710 {
711 odr_gy = val;
712 }
713
714 break;
715
717 if (val == ISM330DHCX_GY_ODR_OFF)
718 {
719 odr_gy = ISM330DHCX_GY_ODR_52Hz;
720 }
721
722 else if (val == ISM330DHCX_GY_ODR_12Hz5)
723 {
724 odr_gy = ISM330DHCX_GY_ODR_52Hz;
725 }
726
727 else if (val == ISM330DHCX_GY_ODR_26Hz)
728 {
729 odr_gy = ISM330DHCX_GY_ODR_52Hz;
730 }
731
732 else
733 {
734 odr_gy = val;
735 }
736
737 break;
738
740 if (val == ISM330DHCX_GY_ODR_OFF)
741 {
743 }
744
745 else if (val == ISM330DHCX_GY_ODR_12Hz5)
746 {
748 }
749
750 else if (val == ISM330DHCX_GY_ODR_26Hz)
751 {
753 }
754
755 else if (val == ISM330DHCX_GY_ODR_52Hz)
756 {
758 }
759
760 else
761 {
762 odr_gy = val;
763 }
764
765 break;
766
767 default:
768 odr_gy = val;
769 break;
770 }
771 }
772 }
773 }
774
775 /* Check the Machine Learning Core data rate constraints */
776 mlc_enable = PROPERTY_DISABLE;
777
778 if (ret == 0)
779 {
780 ret = ism330dhcx_mlc_get(ctx, &mlc_enable);
781
782 if (mlc_enable == PROPERTY_ENABLE)
783 {
784 ret = ism330dhcx_mlc_data_rate_get(ctx, &mlc_odr);
785
786 if (ret == 0)
787 {
788 switch (mlc_odr)
789 {
791 if (val == ISM330DHCX_GY_ODR_OFF)
792 {
794 }
795
796 else
797 {
798 odr_gy = val;
799 }
800
801 break;
802
804 if (val == ISM330DHCX_GY_ODR_OFF)
805 {
806 odr_gy = ISM330DHCX_GY_ODR_26Hz;
807 }
808
809 else if (val == ISM330DHCX_GY_ODR_12Hz5)
810 {
811 odr_gy = ISM330DHCX_GY_ODR_26Hz;
812 }
813
814 else
815 {
816 odr_gy = val;
817 }
818
819 break;
820
822 if (val == ISM330DHCX_GY_ODR_OFF)
823 {
824 odr_gy = ISM330DHCX_GY_ODR_52Hz;
825 }
826
827 else if (val == ISM330DHCX_GY_ODR_12Hz5)
828 {
829 odr_gy = ISM330DHCX_GY_ODR_52Hz;
830 }
831
832 else if (val == ISM330DHCX_GY_ODR_26Hz)
833 {
834 odr_gy = ISM330DHCX_GY_ODR_52Hz;
835 }
836
837 else
838 {
839 odr_gy = val;
840 }
841
842 break;
843
845 if (val == ISM330DHCX_GY_ODR_OFF)
846 {
848 }
849
850 else if (val == ISM330DHCX_GY_ODR_12Hz5)
851 {
853 }
854
855 else if (val == ISM330DHCX_GY_ODR_26Hz)
856 {
858 }
859
860 else if (val == ISM330DHCX_GY_ODR_52Hz)
861 {
863 }
864
865 else
866 {
867 odr_gy = val;
868 }
869
870 break;
871
872 default:
873 odr_gy = val;
874 break;
875 }
876 }
877 }
878 }
879
880 if (ret == 0)
881 {
883 (uint8_t *)&ctrl2_g, 1);
884 }
885
886 if (ret == 0)
887 {
888 ctrl2_g.odr_g = (uint8_t)odr_gy;
890 (uint8_t *)&ctrl2_g, 1);
891 }
892
893 return ret;
894}
895
896/**
897 * @brief Gyroscope data rate.[get]
898 *
899 * @param ctx Read / write interface definitions.(ptr)
900 * @param val Get the values of odr_g in reg CTRL2_G
901 * @retval Interface status (MANDATORY: return 0 -> no Error).
902 *
903 */
906{
907 ism330dhcx_ctrl2_g_t ctrl2_g;
908 int32_t ret;
910 (uint8_t *)&ctrl2_g, 1);
911
912 switch (ctrl2_g.odr_g)
913 {
916 break;
917
920 break;
921
924 break;
925
928 break;
929
932 break;
933
936 break;
937
940 break;
941
944 break;
945
948 break;
949
952 break;
953
956 break;
957
958 default:
960 break;
961 }
962
963 return ret;
964}
965
966/**
967 * @brief Block data update.[set]
968 *
969 * @param ctx Read / write interface definitions.(ptr)
970 * @param val Change the values of bdu in reg CTRL3_C
971 * @retval Interface status (MANDATORY: return 0 -> no Error).
972 *
973 */
975 uint8_t val)
976{
977 ism330dhcx_ctrl3_c_t ctrl3_c;
978 int32_t ret;
980 (uint8_t *)&ctrl3_c, 1);
981
982 if (ret == 0)
983 {
984 ctrl3_c.bdu = (uint8_t)val;
986 (uint8_t *)&ctrl3_c, 1);
987 }
988
989 return ret;
990}
991
992/**
993 * @brief Block data update.[get]
994 *
995 * @param ctx Read / write interface definitions.(ptr)
996 * @param val Change the values of bdu in reg CTRL3_C
997 * @retval Interface status (MANDATORY: return 0 -> no Error).
998 *
999 */
1001 uint8_t *val)
1002{
1003 ism330dhcx_ctrl3_c_t ctrl3_c;
1004 int32_t ret;
1006 (uint8_t *)&ctrl3_c, 1);
1007 *val = ctrl3_c.bdu;
1008
1009 return ret;
1010}
1011
1012/**
1013 * @brief Weight of XL user offset bits of registers X_OFS_USR (73h),
1014 * Y_OFS_USR (74h), Z_OFS_USR (75h).[set]
1015 *
1016 * @param ctx Read / write interface definitions.(ptr)
1017 * @param val Change the values of usr_off_w in reg CTRL6_C
1018 * @retval Interface status (MANDATORY: return 0 -> no Error).
1019 *
1020 */
1023{
1024 ism330dhcx_ctrl6_c_t ctrl6_c;
1025 int32_t ret;
1027 (uint8_t *)&ctrl6_c, 1);
1028
1029 if (ret == 0)
1030 {
1031 ctrl6_c.usr_off_w = (uint8_t)val;
1033 (uint8_t *)&ctrl6_c, 1);
1034 }
1035
1036 return ret;
1037}
1038
1039/**
1040 * @brief Weight of XL user offset bits of registers X_OFS_USR (73h),
1041 * Y_OFS_USR (74h), Z_OFS_USR (75h).[get]
1042 *
1043 * @param ctx Read / write interface definitions.(ptr)
1044 * @param val Get the values of usr_off_w in reg CTRL6_C
1045 * @retval Interface status (MANDATORY: return 0 -> no Error).
1046 *
1047 */
1050{
1051 ism330dhcx_ctrl6_c_t ctrl6_c;
1052 int32_t ret;
1054 (uint8_t *)&ctrl6_c, 1);
1055
1056 switch (ctrl6_c.usr_off_w)
1057 {
1058 case ISM330DHCX_LSb_1mg:
1059 *val = ISM330DHCX_LSb_1mg;
1060 break;
1061
1063 *val = ISM330DHCX_LSb_16mg;
1064 break;
1065
1066 default:
1067 *val = ISM330DHCX_LSb_1mg;
1068 break;
1069 }
1070
1071 return ret;
1072}
1073
1074/**
1075 * @brief Accelerometer power mode.[set]
1076 *
1077 * @param ctx Read / write interface definitions.(ptr)
1078 * @param val Change the values of xl_hm_mode in reg CTRL6_C
1079 * @retval Interface status (MANDATORY: return 0 -> no Error).
1080 *
1081 */
1084{
1085 ism330dhcx_ctrl6_c_t ctrl6_c;
1086 int32_t ret;
1088 (uint8_t *)&ctrl6_c, 1);
1089
1090 if (ret == 0)
1091 {
1092 ctrl6_c.xl_hm_mode = (uint8_t)val & 0x01U;
1094 (uint8_t *)&ctrl6_c, 1);
1095 }
1096
1097 return ret;
1098}
1099
1100/**
1101 * @brief Accelerometer power mode[get]
1102 *
1103 * @param ctx Read / write interface definitions.(ptr)
1104 * @param val Get the values of xl_hm_mode in reg CTRL6_C
1105 * @retval Interface status (MANDATORY: return 0 -> no Error).
1106 *
1107 */
1110{
1111 ism330dhcx_ctrl6_c_t ctrl6_c;
1112 int32_t ret;
1114 (uint8_t *)&ctrl6_c, 1);
1115
1116 switch (ctrl6_c.xl_hm_mode)
1117 {
1120 break;
1121
1124 break;
1125
1126 default:
1128 break;
1129 }
1130
1131 return ret;
1132}
1133
1134/**
1135 * @brief Operating mode for gyroscope.[set]
1136 *
1137 * @param ctx Read / write interface definitions.(ptr)
1138 * @param val Change the values of g_hm_mode in reg CTRL7_G
1139 * @retval Interface status (MANDATORY: return 0 -> no Error).
1140 *
1141 */
1144{
1145 ism330dhcx_ctrl7_g_t ctrl7_g;
1146 int32_t ret;
1148 (uint8_t *)&ctrl7_g, 1);
1149
1150 if (ret == 0)
1151 {
1152 ctrl7_g.g_hm_mode = (uint8_t)val;
1154 (uint8_t *)&ctrl7_g, 1);
1155 }
1156
1157 return ret;
1158}
1159
1160/**
1161 * @brief gy_power_mode: [get] Operating mode for gyroscope.
1162 *
1163 * @param ctx Read / write interface definitions.(ptr)
1164 * @param val Get the values of g_hm_mode in reg CTRL7_G
1165 * @retval Interface status (MANDATORY: return 0 -> no Error).
1166 *
1167 */
1170{
1171 ism330dhcx_ctrl7_g_t ctrl7_g;
1172 int32_t ret;
1174 (uint8_t *)&ctrl7_g, 1);
1175
1176 switch (ctrl7_g.g_hm_mode)
1177 {
1180 break;
1181
1183 *val = ISM330DHCX_GY_NORMAL;
1184 break;
1185
1186 default:
1188 break;
1189 }
1190
1191 return ret;
1192}
1193
1194/**
1195 * @brief Read all the interrupt flag of the device.
1196 *[get]
1197 * @param ctx Read / write interface definitions.(ptr)
1198 * @param val Get registers ALL_INT_SRC; WAKE_UP_SRC;
1199 * TAP_SRC; D6D_SRC; STATUS_REG;
1200 * EMB_FUNC_STATUS; FSM_STATUS_A/B
1201 * @retval Interface status (MANDATORY: return 0 -> no Error).
1202 *
1203 */
1206{
1207 int32_t ret;
1209 (uint8_t *)&val->all_int_src, 1);
1210
1211 if (ret == 0)
1212 {
1214 (uint8_t *)&val->wake_up_src, 1);
1215 }
1216
1217 if (ret == 0)
1218 {
1220 (uint8_t *)&val->tap_src, 1);
1221 }
1222
1223 if (ret == 0)
1224 {
1226 (uint8_t *)&val->d6d_src, 1);
1227 }
1228
1229 if (ret == 0)
1230 {
1232 (uint8_t *)&val->status_reg, 1);
1233 }
1234
1235 if (ret == 0)
1236 {
1238 }
1239
1240 if (ret == 0)
1241 {
1243 (uint8_t *)&val->emb_func_status, 1);
1244 }
1245
1246 if (ret == 0)
1247 {
1249 (uint8_t *)&val->fsm_status_a, 1);
1250 }
1251
1252 if (ret == 0)
1253 {
1255 (uint8_t *)&val->fsm_status_b, 1);
1256 }
1257
1258 if (ret == 0)
1259 {
1261 }
1262
1263 return ret;
1264}
1265
1266/**
1267 * @brief The STATUS_REG register is read by the primary interface.[get]
1268 *
1269 * @param ctx Read / write interface definitions.(ptr)
1270 * @param val Get register STATUS_REG
1271 * @retval Interface status (MANDATORY: return 0 -> no Error).
1272 *
1273 */
1276{
1277 int32_t ret;
1278 ret = ism330dhcx_read_reg(ctx, ISM330DHCX_STATUS_REG, (uint8_t *) val, 1);
1279
1280 return ret;
1281}
1282
1283/**
1284 * @brief Accelerometer new data available.[get]
1285 *
1286 * @param ctx Read / write interface definitions.(ptr)
1287 * @param val Change the values of xlda in reg STATUS_REG
1288 * @retval Interface status (MANDATORY: return 0 -> no Error).
1289 *
1290 */
1292 uint8_t *val)
1293{
1294 ism330dhcx_status_reg_t status_reg;
1295 int32_t ret;
1297 (uint8_t *)&status_reg, 1);
1298 *val = status_reg.xlda;
1299
1300 return ret;
1301}
1302
1303/**
1304 * @brief Gyroscope new data available.[get]
1305 *
1306 * @param ctx Read / write interface definitions.(ptr)
1307 * @param val Change the values of gda in reg STATUS_REG
1308 * @retval Interface status (MANDATORY: return 0 -> no Error).
1309 *
1310 */
1312 uint8_t *val)
1313{
1314 ism330dhcx_status_reg_t status_reg;
1315 int32_t ret;
1317 (uint8_t *)&status_reg, 1);
1318 *val = status_reg.gda;
1319
1320 return ret;
1321}
1322
1323/**
1324 * @brief Temperature new data available.[get]
1325 *
1326 * @param ctx Read / write interface definitions.(ptr)
1327 * @param val Change the values of tda in reg STATUS_REG
1328 * @retval Interface status (MANDATORY: return 0 -> no Error).
1329 *
1330 */
1332 uint8_t *val)
1333{
1334 ism330dhcx_status_reg_t status_reg;
1335 int32_t ret;
1337 (uint8_t *)&status_reg, 1);
1338 *val = status_reg.tda;
1339
1340 return ret;
1341}
1342
1343/**
1344 * @brief Accelerometer X-axis user offset correction expressed in two’s
1345 * complement, weight depends on USR_OFF_W in CTRL6_C (15h).
1346 * The value must be in the range [-127 127].[set]
1347 *
1348 * @param ctx Read / write interface definitions.(ptr)
1349 * @param buff Buffer that contains data to write
1350 * @retval Interface status (MANDATORY: return 0 -> no Error).
1351 *
1352 */
1354 uint8_t *buff)
1355{
1356 int32_t ret;
1357 ret = ism330dhcx_write_reg(ctx, ISM330DHCX_X_OFS_USR, buff, 1);
1358
1359 return ret;
1360}
1361
1362/**
1363 * @brief Accelerometer X-axis user offset correction expressed in two’s
1364 * complement, weight depends on USR_OFF_W in CTRL6_C (15h).
1365 * The value must be in the range [-127 127].[get]
1366 *
1367 * @param ctx Read / write interface definitions.(ptr)
1368 * @param buff Buffer that stores data read
1369 * @retval Interface status (MANDATORY: return 0 -> no Error).
1370 *
1371 */
1373 uint8_t *buff)
1374{
1375 int32_t ret;
1376 ret = ism330dhcx_read_reg(ctx, ISM330DHCX_X_OFS_USR, buff, 1);
1377
1378 return ret;
1379}
1380
1381/**
1382 * @brief Accelerometer Y-axis user offset correction expressed in two’s
1383 * complement, weight depends on USR_OFF_W in CTRL6_C (15h).
1384 * The value must be in the range [-127 127].[set]
1385 *
1386 * @param ctx Read / write interface definitions.(ptr)
1387 * @param buff Buffer that contains data to write
1388 * @retval Interface status (MANDATORY: return 0 -> no Error).
1389 *
1390 */
1392 uint8_t *buff)
1393{
1394 int32_t ret;
1395 ret = ism330dhcx_write_reg(ctx, ISM330DHCX_Y_OFS_USR, buff, 1);
1396
1397 return ret;
1398}
1399
1400/**
1401 * @brief Accelerometer Y-axis user offset correction expressed in two’s
1402 * complement, weight depends on USR_OFF_W in CTRL6_C (15h).
1403 * The value must be in the range [-127 127].[get]
1404 *
1405 * @param ctx Read / write interface definitions.(ptr)
1406 * @param buff Buffer that stores data read
1407 * @retval Interface status (MANDATORY: return 0 -> no Error).
1408 *
1409 */
1411 uint8_t *buff)
1412{
1413 int32_t ret;
1414 ret = ism330dhcx_read_reg(ctx, ISM330DHCX_Y_OFS_USR, buff, 1);
1415
1416 return ret;
1417}
1418
1419/**
1420 * @brief Accelerometer Z-axis user offset correction expressed in two’s
1421 * complement, weight depends on USR_OFF_W in CTRL6_C (15h).
1422 * The value must be in the range [-127 127].[set]
1423 *
1424 * @param ctx Read / write interface definitions.(ptr)
1425 * @param buff Buffer that contains data to write
1426 * @retval Interface status (MANDATORY: return 0 -> no Error).
1427 *
1428 */
1430 uint8_t *buff)
1431{
1432 int32_t ret;
1433 ret = ism330dhcx_write_reg(ctx, ISM330DHCX_Z_OFS_USR, buff, 1);
1434
1435 return ret;
1436}
1437
1438/**
1439 * @brief Accelerometer X-axis user offset correction expressed in two’s
1440 * complement, weight depends on USR_OFF_W in CTRL6_C (15h).
1441 * The value must be in the range [-127 127].[get]
1442 *
1443 * @param ctx Read / write interface definitions.(ptr)
1444 * @param buff Buffer that stores data read
1445 * @retval Interface status (MANDATORY: return 0 -> no Error).
1446 *
1447 */
1449 uint8_t *buff)
1450{
1451 int32_t ret;
1452 ret = ism330dhcx_read_reg(ctx, ISM330DHCX_Z_OFS_USR, buff, 1);
1453
1454 return ret;
1455}
1456
1457/**
1458 * @brief Enables user offset on out.[set]
1459 *
1460 * @param ctx Read / write interface definitions.(ptr)
1461 * @param val Change the values of usr_off_on_out in reg CTRL7_G
1462 * @retval Interface status (MANDATORY: return 0 -> no Error).
1463 *
1464 */
1466{
1467 ism330dhcx_ctrl7_g_t ctrl7_g;
1468 int32_t ret;
1470 (uint8_t *)&ctrl7_g, 1);
1471
1472 if (ret == 0)
1473 {
1474 ctrl7_g.usr_off_on_out = (uint8_t)val;
1476 (uint8_t *)&ctrl7_g, 1);
1477 }
1478
1479 return ret;
1480}
1481
1482/**
1483 * @brief Get user offset on out flag.[get]
1484 *
1485 * @param ctx Read / write interface definitions.(ptr)
1486 * @param val Get values of usr_off_on_out in reg CTRL7_G
1487 * @retval Interface status (MANDATORY: return 0 -> no Error).
1488 *
1489 */
1491{
1492 ism330dhcx_ctrl7_g_t ctrl7_g;
1493 int32_t ret;
1495 (uint8_t *)&ctrl7_g, 1);
1496 *val = ctrl7_g.usr_off_on_out;
1497
1498 return ret;
1499}
1500
1501/**
1502 * @}
1503 *
1504 */
1505
1506/**
1507 * @defgroup ISM330DHCX_Timestamp
1508 * @brief This section groups all the functions that manage the
1509 * timestamp generation.
1510 * @{
1511 *
1512 */
1513
1514/**
1515 * @brief Reset timestamp counter.[set]
1516 *
1517 * @param ctx Read / write interface definitions.(ptr)
1518 * @retval Interface status (MANDATORY: return 0 -> no Error).
1519 *
1520 */
1522{
1523 uint8_t rst_val = 0xAA;
1524 return ism330dhcx_write_reg(ctx, ISM330DHCX_TIMESTAMP2, &rst_val, 1);
1525}
1526
1527/**
1528 * @brief Enables timestamp counter.[set]
1529 *
1530 * @param ctx Read / write interface definitions.(ptr)
1531 * @param val Change the values of timestamp_en in reg CTRL10_C
1532 * @retval Interface status (MANDATORY: return 0 -> no Error).
1533 *
1534 */
1535int32_t ism330dhcx_timestamp_set(stmdev_ctx_t *ctx, uint8_t val)
1536{
1537 ism330dhcx_ctrl10_c_t ctrl10_c;
1538 int32_t ret;
1540 (uint8_t *)&ctrl10_c, 1);
1541
1542 if (ret == 0)
1543 {
1544 ctrl10_c.timestamp_en = (uint8_t)val;
1546 (uint8_t *)&ctrl10_c, 1);
1547 }
1548
1549 return ret;
1550}
1551
1552/**
1553 * @brief Enables timestamp counter.[get]
1554 *
1555 * @param ctx Read / write interface definitions.(ptr)
1556 * @param val Change the values of timestamp_en in reg CTRL10_C
1557 * @retval Interface status (MANDATORY: return 0 -> no Error).
1558 *
1559 */
1560int32_t ism330dhcx_timestamp_get(stmdev_ctx_t *ctx, uint8_t *val)
1561{
1562 ism330dhcx_ctrl10_c_t ctrl10_c;
1563 int32_t ret;
1565 (uint8_t *)&ctrl10_c, 1);
1566 *val = ctrl10_c.timestamp_en;
1567
1568 return ret;
1569}
1570
1571/**
1572 * @brief Timestamp first data output register (r).
1573 * The value is expressed as a 32-bit word and the bit resolution
1574 * is 25 μs.[get]
1575 *
1576 * @param ctx Read / write interface definitions.(ptr)
1577 * @param buff Buffer that stores data read
1578 * @retval Interface status (MANDATORY: return 0 -> no Error).
1579 *
1580 */
1581int32_t ism330dhcx_timestamp_raw_get(stmdev_ctx_t *ctx, uint32_t *val)
1582{
1583 uint8_t buff[4];
1584 int32_t ret;
1585 ret = ism330dhcx_read_reg(ctx, ISM330DHCX_TIMESTAMP0, buff, 4);
1586 *val = buff[3];
1587 *val = (*val * 256U) + buff[2];
1588 *val = (*val * 256U) + buff[1];
1589 *val = (*val * 256U) + buff[0];
1590
1591 return ret;
1592}
1593
1594/**
1595 * @}
1596 *
1597 */
1598
1599/**
1600 * @defgroup ISM330DHCX_Data output
1601 * @brief This section groups all the data output functions.
1602 * @{
1603 *
1604 */
1605
1606/**
1607 * @brief Circular burst-mode (rounding) read of the output registers.[set]
1608 *
1609 * @param ctx Read / write interface definitions.(ptr)
1610 * @param val Change the values of rounding in reg CTRL5_C
1611 * @retval Interface status (MANDATORY: return 0 -> no Error).
1612 *
1613 */
1616{
1617 ism330dhcx_ctrl5_c_t ctrl5_c;
1618 int32_t ret;
1620 (uint8_t *)&ctrl5_c, 1);
1621
1622 if (ret == 0)
1623 {
1624 ctrl5_c.rounding = (uint8_t)val;
1626 (uint8_t *)&ctrl5_c, 1);
1627 }
1628
1629 return ret;
1630}
1631
1632/**
1633 * @brief Gyroscope UI chain full-scale selection.[get]
1634 *
1635 * @param ctx Read / write interface definitions.(ptr)
1636 * @param val Get the values of rounding in reg CTRL5_C
1637 * @retval Interface status (MANDATORY: return 0 -> no Error).
1638 *
1639 */
1642{
1643 ism330dhcx_ctrl5_c_t ctrl5_c;
1644 int32_t ret;
1646 (uint8_t *)&ctrl5_c, 1);
1647
1648 switch (ctrl5_c.rounding)
1649 {
1651 *val = ISM330DHCX_NO_ROUND;
1652 break;
1653
1655 *val = ISM330DHCX_ROUND_XL;
1656 break;
1657
1659 *val = ISM330DHCX_ROUND_GY;
1660 break;
1661
1664 break;
1665
1666 default:
1667 *val = ISM330DHCX_NO_ROUND;
1668 break;
1669 }
1670
1671 return ret;
1672}
1673
1674/**
1675 * @brief Temperature data output register (r).
1676 * L and H registers together express a 16-bit word in two’s
1677 * complement.[get]
1678 *
1679 * @param ctx Read / write interface definitions.(ptr)
1680 * @param buff Buffer that stores data read
1681 * @retval Interface status (MANDATORY: return 0 -> no Error).
1682 *
1683 */
1685 int16_t *val)
1686{
1687 uint8_t buff[2];
1688 int32_t ret;
1689 ret = ism330dhcx_read_reg(ctx, ISM330DHCX_OUT_TEMP_L, buff, 2);
1690 *val = (int16_t)buff[1];
1691 *val = (*val * 256) + (int16_t)buff[0];
1692
1693 return ret;
1694}
1695
1696/**
1697 * @brief Angular rate sensor. The value is expressed as a 16-bit
1698 * word in two’s complement.[get]
1699 *
1700 * @param ctx Read / write interface definitions.(ptr)
1701 * @param buff Buffer that stores data read
1702 * @retval Interface status (MANDATORY: return 0 -> no Error).
1703 *
1704 */
1706 int16_t *val)
1707{
1708 uint8_t buff[6];
1709 int32_t ret;
1710 ret = ism330dhcx_read_reg(ctx, ISM330DHCX_OUTX_L_G, buff, 6);
1711 val[0] = (int16_t)buff[1];
1712 val[0] = (val[0] * 256) + (int16_t)buff[0];
1713 val[1] = (int16_t)buff[3];
1714 val[1] = (val[1] * 256) + (int16_t)buff[2];
1715 val[2] = (int16_t)buff[5];
1716 val[2] = (val[2] * 256) + (int16_t)buff[4];
1717
1718 return ret;
1719}
1720
1721/**
1722 * @brief Linear acceleration output register. The value is expressed as a
1723 * 16-bit word in two’s complement.[get]
1724 *
1725 * @param ctx Read / write interface definitions.(ptr)
1726 * @param buff Buffer that stores data read
1727 * @retval Interface status (MANDATORY: return 0 -> no Error).
1728 *
1729 */
1731 int16_t *val)
1732{
1733 uint8_t buff[6];
1734 int32_t ret;
1735 ret = ism330dhcx_read_reg(ctx, ISM330DHCX_OUTX_L_A, buff, 6);
1736 val[0] = (int16_t)buff[1];
1737 val[0] = (val[0] * 256) + (int16_t)buff[0];
1738 val[1] = (int16_t)buff[3];
1739 val[1] = (val[1] * 256) + (int16_t)buff[2];
1740 val[2] = (int16_t)buff[5];
1741 val[2] = (val[2] * 256) + (int16_t)buff[4];
1742
1743 return ret;
1744}
1745
1746/**
1747 * @brief FIFO data output.[get]
1748 *
1749 * @param ctx Read / write interface definitions.(ptr)
1750 * @param buff Buffer that stores data read
1751 * @retval Interface status (MANDATORY: return 0 -> no Error).
1752 *
1753 */
1754int32_t ism330dhcx_fifo_out_raw_get(stmdev_ctx_t *ctx, uint8_t *buff)
1755{
1756 int32_t ret;
1758
1759 return ret;
1760}
1761
1762/**
1763 * @brief Step counter output register.[get]
1764 *
1765 * @param ctx Read / write interface definitions.(ptr)
1766 * @param buff Buffer that stores data read
1767 * @retval Interface status (MANDATORY: return 0 -> no Error).
1768 *
1769 */
1771 uint16_t *val)
1772{
1773 uint8_t buff[2];
1774 int32_t ret;
1776
1777 if (ret == 0)
1778 {
1780 *val = buff[1];
1781 *val = (*val * 256U) + buff[0];
1782 }
1783
1784 if (ret == 0)
1785 {
1787 }
1788
1789 return ret;
1790}
1791
1792/**
1793 * @brief Reset step counter register.[get]
1794 *
1795 * @param ctx Read / write interface definitions.(ptr)
1796 * @retval Interface status (MANDATORY: return 0 -> no Error).
1797 *
1798 */
1800{
1801 ism330dhcx_emb_func_src_t emb_func_src;
1802 int32_t ret;
1804
1805 if (ret == 0)
1806 {
1808 (uint8_t *)&emb_func_src, 1);
1809 }
1810
1811 if (ret == 0)
1812 {
1813 emb_func_src.pedo_rst_step = PROPERTY_ENABLE;
1815 (uint8_t *)&emb_func_src, 1);
1816 }
1817
1818 if (ret == 0)
1819 {
1821 }
1822
1823 return ret;
1824}
1825
1826/**
1827 * @brief prgsens_out: [get] Output value of all MLCx decision trees.
1828 *
1829 * @param ctx_t *ctx: read / write interface definitions
1830 * @param uint8_t * : buffer that stores data read
1831 *
1832 */
1833int32_t ism330dhcx_mlc_out_get(stmdev_ctx_t *ctx, uint8_t *buff)
1834{
1835 int32_t ret;
1837
1838 if (ret == 0)
1839 {
1840 ret = ism330dhcx_read_reg(ctx, ISM330DHCX_MLC0_SRC, buff, 8);
1841 }
1842
1843 if (ret == 0)
1844 {
1846 }
1847
1848 return ret;
1849}
1850
1851/**
1852 * @}
1853 *
1854 */
1855
1856/**
1857 * @defgroup ISM330DHCX_common
1858 * @brief This section groups common useful functions.
1859 * @{
1860 *
1861 */
1862
1863/**
1864 * @brief DEVICE_CONF bit configuration[set]
1865 *
1866 * @param ctx Read / write interface definitions.(ptr)
1867 * @param val Change the values of device_conf in reg CTRL9_XL
1868 * @retval Interface status (MANDATORY: return 0 -> no Error).
1869 *
1870 */
1872{
1873 ism330dhcx_ctrl9_xl_t ctrl9_xl;
1874 int32_t ret;
1876 (uint8_t *)&ctrl9_xl, 1);
1877
1878 if (ret == 0)
1879 {
1880 ctrl9_xl.device_conf = (uint8_t)val;
1882 (uint8_t *)&ctrl9_xl, 1);
1883 }
1884
1885 return ret;
1886}
1887
1888/**
1889 * @brief DEVICE_CONF bit configuration[get]
1890 *
1891 * @param ctx Read / write interface definitions.(ptr)
1892 * @param val Get the values of device_conf in reg CTRL9_XL
1893 * @retval Interface status (MANDATORY: return 0 -> no Error).
1894 *
1895 */
1896int32_t ism330dhcx_device_conf_get(stmdev_ctx_t *ctx, uint8_t *val)
1897{
1898 ism330dhcx_ctrl9_xl_t ctrl9_xl;
1899 int32_t ret;
1901 (uint8_t *)&ctrl9_xl, 1);
1902 *val = ctrl9_xl.device_conf;
1903
1904 return ret;
1905}
1906
1907/**
1908 * @brief Difference in percentage of the effective ODR (and timestamp rate)
1909 * with respect to the typical.[set]
1910 * Step: 0.15%. 8-bit format, 2's complement.
1911 *
1912 * @param ctx Read / write interface definitions.(ptr)
1913 * @param val Change the values of freq_fine in reg INTERNAL_FREQ_FINE
1914 * @retval Interface status (MANDATORY: return 0 -> no Error).
1915 *
1916 */
1918{
1919 ism330dhcx_internal_freq_fine_t internal_freq_fine;
1920 int32_t ret;
1922 (uint8_t *)&internal_freq_fine, 1);
1923
1924 if (ret == 0)
1925 {
1926 internal_freq_fine.freq_fine = (uint8_t)val;
1928 (uint8_t *)&internal_freq_fine, 1);
1929 }
1930
1931 return ret;
1932}
1933
1934/**
1935 * @brief Difference in percentage of the effective ODR (and timestamp rate)
1936 * with respect to the typical.[get]
1937 * Step: 0.15%. 8-bit format, 2's complement.
1938 *
1939 * @param ctx Read / write interface definitions.(ptr)
1940 * @param val Change the values of freq_fine in reg INTERNAL_FREQ_FINE
1941 * @retval Interface status (MANDATORY: return 0 -> no Error).
1942 *
1943 */
1944int32_t ism330dhcx_odr_cal_reg_get(stmdev_ctx_t *ctx, uint8_t *val)
1945{
1946 ism330dhcx_internal_freq_fine_t internal_freq_fine;
1947 int32_t ret;
1949 (uint8_t *)&internal_freq_fine, 1);
1950 *val = internal_freq_fine.freq_fine;
1951
1952 return ret;
1953}
1954
1955/**
1956 * @brief Enable access to the embedded functions/sensor hub configuration
1957 * registers.[set]
1958 *
1959 * @param ctx Read / write interface definitions.(ptr)
1960 * @param val Change the values of reg_access in reg FUNC_CFG_ACCESS
1961 * @retval Interface status (MANDATORY: return 0 -> no Error).
1962 *
1963 */
1966{
1967 ism330dhcx_func_cfg_access_t func_cfg_access;
1968 int32_t ret;
1970 (uint8_t *)&func_cfg_access, 1);
1971
1972 if (ret == 0)
1973 {
1974 func_cfg_access.reg_access = (uint8_t)val;
1976 (uint8_t *)&func_cfg_access, 1);
1977 }
1978
1979 return ret;
1980}
1981
1982/**
1983 * @brief Enable access to the embedded functions/sensor hub configuration
1984 * registers.[get]
1985 *
1986 * @param ctx Read / write interface definitions.(ptr)
1987 * @param val Get the values of reg_access in reg FUNC_CFG_ACCESS
1988 * @retval Interface status (MANDATORY: return 0 -> no Error).
1989 *
1990 */
1993{
1994 ism330dhcx_func_cfg_access_t func_cfg_access;
1995 int32_t ret;
1997 (uint8_t *)&func_cfg_access, 1);
1998
1999 switch (func_cfg_access.reg_access)
2000 {
2002 *val = ISM330DHCX_USER_BANK;
2003 break;
2004
2007 break;
2008
2011 break;
2012
2013 default:
2014 *val = ISM330DHCX_USER_BANK;
2015 break;
2016 }
2017
2018 return ret;
2019}
2020
2021/**
2022 * @brief Write a line(byte) in a page.[set]
2023 *
2024 * @param ctx Read / write interface definitions.(ptr)
2025 * @param add Page line address
2026 * @param val Value to write
2027 * @retval Interface status (MANDATORY: return 0 -> no Error).
2028 *
2029 */
2031 uint8_t *val)
2032{
2033 ism330dhcx_page_rw_t page_rw;
2034 ism330dhcx_page_sel_t page_sel;
2035 ism330dhcx_page_address_t page_address;
2036 int32_t ret;
2038
2039 if (ret == 0)
2040 {
2042 (uint8_t *)&page_rw, 1);
2043 }
2044
2045 if (ret == 0)
2046 {
2047 page_rw.page_rw = 0x02U; /* page_write enable */
2049 (uint8_t *)&page_rw, 1);
2050 }
2051
2052 if (ret == 0)
2053 {
2055 (uint8_t *)&page_sel, 1);
2056 }
2057
2058 if (ret == 0)
2059 {
2060 page_sel.page_sel = (uint8_t)((add / 256U) & 0x0FU);
2061 page_sel.not_used_01 = 1;
2063 (uint8_t *)&page_sel, 1);
2064 }
2065
2066 if (ret == 0)
2067 {
2068 page_address.page_addr = (uint8_t)(add - (page_sel.page_sel * 256U));
2070 (uint8_t *)&page_address, 1);
2071 }
2072
2073 if (ret == 0)
2074 {
2075 ret = ism330dhcx_write_reg(ctx, ISM330DHCX_PAGE_VALUE, val, 1);
2076 }
2077
2078 if (ret == 0)
2079 {
2081 (uint8_t *)&page_rw, 1);
2082 }
2083
2084 if (ret == 0)
2085 {
2086 page_rw.page_rw = 0x00; /* page_write disable */
2088 (uint8_t *)&page_rw, 1);
2089 }
2090
2091 if (ret == 0)
2092 {
2094 }
2095
2096 return ret;
2097}
2098
2099/**
2100 * @brief Write buffer in a page.[set]
2101 *
2102 * @param ctx Read / write interface definitions.(ptr)
2103 * @param buf Page line address.(ptr)
2104 * @param val Value to write.
2105 * @param len buffer length.
2106 * @retval Interface status (MANDATORY: return 0 -> no Error).
2107 *
2108 */
2109int32_t ism330dhcx_ln_pg_write(stmdev_ctx_t *ctx, uint16_t add,
2110 uint8_t *buf, uint8_t len)
2111{
2112 ism330dhcx_page_rw_t page_rw;
2113 ism330dhcx_page_sel_t page_sel;
2114 ism330dhcx_page_address_t page_address;
2115 uint8_t msb, lsb;
2116 int32_t ret;
2117 uint8_t i ;
2118 msb = (uint8_t)((add / 256U) & 0x0FU);
2119 lsb = (uint8_t)(add - (msb * 256U));
2121
2122 if (ret == 0)
2123 {
2125 (uint8_t *)&page_rw, 1);
2126 }
2127
2128 if (ret == 0)
2129 {
2130 page_rw.page_rw = 0x02U; /* page_write enable*/
2132 (uint8_t *)&page_rw, 1);
2133 }
2134
2135 if (ret == 0)
2136 {
2138 (uint8_t *)&page_sel, 1);
2139 }
2140
2141 if (ret == 0)
2142 {
2143 page_sel.page_sel = msb;
2144 page_sel.not_used_01 = 1;
2146 (uint8_t *)&page_sel, 1);
2147 }
2148
2149 if (ret == 0)
2150 {
2151 page_address.page_addr = lsb;
2153 (uint8_t *)&page_address, 1);
2154 }
2155
2156 for (i = 0; i < len; i++)
2157 {
2158 if (ret == 0)
2159 {
2160 ret = ism330dhcx_write_reg(ctx, ISM330DHCX_PAGE_VALUE, &buf[i], 1);
2161
2162 if (ret == 0)
2163 {
2164 /* Check if page wrap */
2165 if (lsb == 0x00U)
2166 {
2167 msb++;
2169 (uint8_t *)&page_sel, 1);
2170 }
2171
2172 lsb++;
2173 }
2174
2175 if (ret == 0)
2176 {
2177 page_sel.page_sel = msb;
2178 page_sel.not_used_01 = 1;
2180 (uint8_t *)&page_sel, 1);
2181 }
2182 }
2183 }
2184
2185 if (ret == 0)
2186 {
2187 page_sel.page_sel = 0;
2188 page_sel.not_used_01 = 1;
2190 (uint8_t *)&page_sel, 1);
2191 }
2192
2193 if (ret == 0)
2194 {
2196 (uint8_t *)&page_rw, 1);
2197 }
2198
2199 if (ret == 0)
2200 {
2201 page_rw.page_rw = 0x00U; /* page_write disable */
2203 (uint8_t *)&page_rw, 1);
2204 }
2205
2206 if (ret == 0)
2207 {
2209 }
2210
2211 return ret;
2212}
2213
2214/**
2215 * @brief Read a line(byte) in a page.[get]
2216 *
2217 * @param ctx Read / write interface definitions.(ptr)
2218 * @param add Page line address.
2219 * @param val Read value.(ptr)
2220 * @retval Interface status (MANDATORY: return 0 -> no Error).
2221 *
2222 */
2223int32_t ism330dhcx_ln_pg_read_byte(stmdev_ctx_t *ctx, uint16_t add,
2224 uint8_t *val)
2225{
2226 ism330dhcx_page_rw_t page_rw;
2227 ism330dhcx_page_sel_t page_sel;
2228 ism330dhcx_page_address_t page_address;
2229 int32_t ret;
2231
2232 if (ret == 0)
2233 {
2235 (uint8_t *)&page_rw, 1);
2236 }
2237
2238 if (ret == 0)
2239 {
2240 page_rw.page_rw = 0x01U; /* page_read enable*/
2242 (uint8_t *)&page_rw, 1);
2243 }
2244
2245 if (ret == 0)
2246 {
2248 (uint8_t *)&page_sel, 1);
2249 }
2250
2251 if (ret == 0)
2252 {
2253 page_sel.page_sel = (uint8_t)((add / 256U) & 0x0FU);
2254 page_sel.not_used_01 = 1;
2256 (uint8_t *)&page_sel, 1);
2257 }
2258
2259 if (ret == 0)
2260 {
2261 page_address.page_addr = (uint8_t)(add - (page_sel.page_sel * 256U));
2263 (uint8_t *)&page_address, 1);
2264 }
2265
2266 if (ret == 0)
2267 {
2268 ret = ism330dhcx_read_reg(ctx, ISM330DHCX_PAGE_VALUE, val, 2);
2269 }
2270
2271 if (ret == 0)
2272 {
2274 (uint8_t *)&page_rw, 1);
2275 }
2276
2277 if (ret == 0)
2278 {
2279 page_rw.page_rw = 0x00U; /* page_read disable */
2281 (uint8_t *)&page_rw, 1);
2282 }
2283
2284 if (ret == 0)
2285 {
2287 }
2288
2289 return ret;
2290}
2291
2292/**
2293 * @brief Data-ready pulsed / letched mode.[set]
2294 *
2295 * @param ctx Read / write interface definitions.(ptr)
2296 * @param val Change the values of dataready_pulsed in
2297 * reg COUNTER_BDR_REG1
2298 * @retval Interface status (MANDATORY: return 0 -> no Error).
2299 *
2300 */
2303{
2304 ism330dhcx_counter_bdr_reg1_t counter_bdr_reg1;
2305 int32_t ret;
2307 (uint8_t *)&counter_bdr_reg1, 1);
2308
2309 if (ret == 0)
2310 {
2311 counter_bdr_reg1.dataready_pulsed = (uint8_t)val;
2313 (uint8_t *)&counter_bdr_reg1, 1);
2314 }
2315
2316 return ret;
2317}
2318
2319/**
2320 * @brief Data-ready pulsed / letched mode.[get]
2321 *
2322 * @param ctx Read / write interface definitions.(ptr)
2323 * @param val Get the values of dataready_pulsed in
2324 * reg COUNTER_BDR_REG1
2325 * @retval Interface status (MANDATORY: return 0 -> no Error).
2326 *
2327 */
2330{
2331 ism330dhcx_counter_bdr_reg1_t counter_bdr_reg1;
2332 int32_t ret;
2334 (uint8_t *)&counter_bdr_reg1, 1);
2335
2336 switch (counter_bdr_reg1.dataready_pulsed)
2337 {
2340 break;
2341
2344 break;
2345
2346 default:
2348 break;
2349 }
2350
2351 return ret;
2352}
2353
2354/**
2355 * @brief Device Who am I.[get]
2356 *
2357 * @param ctx Read / write interface definitions.(ptr)
2358 * @param buff Buffer that stores data read
2359 * @retval Interface status (MANDATORY: return 0 -> no Error).
2360 *
2361 */
2362int32_t ism330dhcx_device_id_get(stmdev_ctx_t *ctx, uint8_t *buff)
2363{
2364 int32_t ret;
2365 ret = ism330dhcx_read_reg(ctx, ISM330DHCX_WHO_AM_I, buff, 1);
2366
2367 return ret;
2368}
2369
2370/**
2371 * @brief Software reset. Restore the default values in user registers.[set]
2372 *
2373 * @param ctx Read / write interface definitions.(ptr)
2374 * @param val Change the values of sw_reset in reg CTRL3_C
2375 * @retval Interface status (MANDATORY: return 0 -> no Error).
2376 *
2377 */
2378int32_t ism330dhcx_reset_set(stmdev_ctx_t *ctx, uint8_t val)
2379{
2380 ism330dhcx_ctrl3_c_t ctrl3_c;
2381 int32_t ret;
2383 (uint8_t *)&ctrl3_c, 1);
2384
2385 if (ret == 0)
2386 {
2387 ctrl3_c.sw_reset = (uint8_t)val;
2389 (uint8_t *)&ctrl3_c, 1);
2390 }
2391
2392 return ret;
2393}
2394
2395/**
2396 * @brief Software reset. Restore the default values in user registers.[get]
2397 *
2398 * @param ctx Read / write interface definitions.(ptr)
2399 * @param val Change the values of sw_reset in reg CTRL3_C
2400 * @retval Interface status (MANDATORY: return 0 -> no Error).
2401 *
2402 */
2403int32_t ism330dhcx_reset_get(stmdev_ctx_t *ctx, uint8_t *val)
2404{
2405 ism330dhcx_ctrl3_c_t ctrl3_c;
2406 int32_t ret;
2408 (uint8_t *)&ctrl3_c, 1);
2409 *val = ctrl3_c.sw_reset;
2410
2411 return ret;
2412}
2413
2414/**
2415 * @brief Register address automatically incremented during a multiple byte
2416 * access with a serial interface.[set]
2417 *
2418 * @param ctx Read / write interface definitions.(ptr)
2419 * @param val Change the values of if_inc in reg CTRL3_C
2420 * @retval Interface status (MANDATORY: return 0 -> no Error).
2421 *
2422 */
2424{
2425 ism330dhcx_ctrl3_c_t ctrl3_c;
2426 int32_t ret;
2428 (uint8_t *)&ctrl3_c, 1);
2429
2430 if (ret == 0)
2431 {
2432 ctrl3_c.if_inc = (uint8_t)val;
2434 (uint8_t *)&ctrl3_c, 1);
2435 }
2436
2437 return ret;
2438}
2439
2440/**
2441 * @brief Register address automatically incremented during a multiple byte
2442 * access with a serial interface.[get]
2443 *
2444 * @param ctx Read / write interface definitions.(ptr)
2445 * @param val Change the values of if_inc in reg CTRL3_C
2446 * @retval Interface status (MANDATORY: return 0 -> no Error).
2447 *
2448 */
2450{
2451 ism330dhcx_ctrl3_c_t ctrl3_c;
2452 int32_t ret;
2454 (uint8_t *)&ctrl3_c, 1);
2455 *val = ctrl3_c.if_inc;
2456
2457 return ret;
2458}
2459
2460/**
2461 * @brief Reboot memory content. Reload the calibration parameters.[set]
2462 *
2463 * @param ctx Read / write interface definitions.(ptr)
2464 * @param val Change the values of boot in reg CTRL3_C
2465 * @retval Interface status (MANDATORY: return 0 -> no Error).
2466 *
2467 */
2468int32_t ism330dhcx_boot_set(stmdev_ctx_t *ctx, uint8_t val)
2469{
2470 ism330dhcx_ctrl3_c_t ctrl3_c;
2471 int32_t ret;
2473 (uint8_t *)&ctrl3_c, 1);
2474
2475 if (ret == 0)
2476 {
2477 ctrl3_c.boot = (uint8_t)val;
2479 (uint8_t *)&ctrl3_c, 1);
2480 }
2481
2482 return ret;
2483}
2484
2485/**
2486 * @brief Reboot memory content. Reload the calibration parameters.[get]
2487 *
2488 * @param ctx Read / write interface definitions.(ptr)
2489 * @param val Change the values of boot in reg CTRL3_C
2490 * @retval Interface status (MANDATORY: return 0 -> no Error).
2491 *
2492 */
2493int32_t ism330dhcx_boot_get(stmdev_ctx_t *ctx, uint8_t *val)
2494{
2495 ism330dhcx_ctrl3_c_t ctrl3_c;
2496 int32_t ret;
2498 (uint8_t *)&ctrl3_c, 1);
2499 *val = ctrl3_c.boot;
2500
2501 return ret;
2502}
2503
2504
2505
2506/**
2507 * @brief Linear acceleration sensor self-test enable.[set]
2508 *
2509 * @param ctx Read / write interface definitions.(ptr)
2510 * @param val Change the values of st_xl in reg CTRL5_C
2511 * @retval Interface status (MANDATORY: return 0 -> no Error).
2512 *
2513 */
2516{
2517 ism330dhcx_ctrl5_c_t ctrl5_c;
2518 int32_t ret;
2520 (uint8_t *)&ctrl5_c, 1);
2521
2522 if (ret == 0)
2523 {
2524 ctrl5_c.st_xl = (uint8_t)val;
2526 (uint8_t *)&ctrl5_c, 1);
2527 }
2528
2529 return ret;
2530}
2531
2532/**
2533 * @brief Linear acceleration sensor self-test enable.[get]
2534 *
2535 * @param ctx Read / write interface definitions.(ptr)
2536 * @param val Get the values of st_xl in reg CTRL5_C
2537 * @retval Interface status (MANDATORY: return 0 -> no Error).
2538 *
2539 */
2541 ism330dhcx_st_xl_t *val)
2542{
2543 ism330dhcx_ctrl5_c_t ctrl5_c;
2544 int32_t ret;
2546 (uint8_t *)&ctrl5_c, 1);
2547
2548 switch (ctrl5_c.st_xl)
2549 {
2552 break;
2553
2556 break;
2557
2560 break;
2561
2562 default:
2564 break;
2565 }
2566
2567 return ret;
2568}
2569
2570/**
2571 * @brief Angular rate sensor self-test enable.[set]
2572 *
2573 * @param ctx Read / write interface definitions.(ptr)
2574 * @param val Change the values of st_g in reg CTRL5_C
2575 * @retval Interface status (MANDATORY: return 0 -> no Error).
2576 *
2577 */
2580{
2581 ism330dhcx_ctrl5_c_t ctrl5_c;
2582 int32_t ret;
2584 (uint8_t *)&ctrl5_c, 1);
2585
2586 if (ret == 0)
2587 {
2588 ctrl5_c.st_g = (uint8_t)val;
2590 (uint8_t *)&ctrl5_c, 1);
2591 }
2592
2593 return ret;
2594}
2595
2596/**
2597 * @brief Angular rate sensor self-test enable.[get]
2598 *
2599 * @param ctx Read / write interface definitions.(ptr)
2600 * @param val Get the values of st_g in reg CTRL5_C
2601 * @retval Interface status (MANDATORY: return 0 -> no Error).
2602 *
2603 */
2605 ism330dhcx_st_g_t *val)
2606{
2607 ism330dhcx_ctrl5_c_t ctrl5_c;
2608 int32_t ret;
2610 (uint8_t *)&ctrl5_c, 1);
2611
2612 switch (ctrl5_c.st_g)
2613 {
2616 break;
2617
2620 break;
2621
2624 break;
2625
2626 default:
2628 break;
2629 }
2630
2631 return ret;
2632}
2633
2634/**
2635 * @}
2636 *
2637 */
2638
2639/**
2640 * @defgroup ISM330DHCX_filters
2641 * @brief This section group all the functions concerning the
2642 * filters configuration
2643 * @{
2644 *
2645 */
2646
2647/**
2648 * @brief Accelerometer output from LPF2 filtering stage selection.[set]
2649 *
2650 * @param ctx Read / write interface definitions.(ptr)
2651 * @param val Change the values of lpf2_xl_en in reg CTRL1_XL
2652 * @retval Interface status (MANDATORY: return 0 -> no Error).
2653 *
2654 */
2656{
2657 ism330dhcx_ctrl1_xl_t ctrl1_xl;
2658 int32_t ret;
2660 (uint8_t *)&ctrl1_xl, 1);
2661
2662 if (ret == 0)
2663 {
2664 ctrl1_xl.lpf2_xl_en = (uint8_t)val;
2666 (uint8_t *)&ctrl1_xl, 1);
2667 }
2668
2669 return ret;
2670}
2671
2672/**
2673 * @brief Accelerometer output from LPF2 filtering stage selection.[get]
2674 *
2675 * @param ctx Read / write interface definitions.(ptr)
2676 * @param val Change the values of lpf2_xl_en in reg CTRL1_XL
2677 * @retval Interface status (MANDATORY: return 0 -> no Error).
2678 *
2679 */
2681{
2682 ism330dhcx_ctrl1_xl_t ctrl1_xl;
2683 int32_t ret;
2685 (uint8_t *)&ctrl1_xl, 1);
2686 *val = ctrl1_xl.lpf2_xl_en;
2687
2688 return ret;
2689}
2690
2691/**
2692 * @brief Enables gyroscope digital LPF1 if auxiliary SPI is disabled;
2693 * the bandwidth can be selected through FTYPE [2:0] in CTRL6_C.[set]
2694 *
2695 * @param ctx Read / write interface definitions.(ptr)
2696 * @param val Change the values of lpf1_sel_g in reg CTRL4_C
2697 * @retval Interface status (MANDATORY: return 0 -> no Error).
2698 *
2699 */
2701{
2702 ism330dhcx_ctrl4_c_t ctrl4_c;
2703 int32_t ret;
2705 (uint8_t *)&ctrl4_c, 1);
2706
2707 if (ret == 0)
2708 {
2709 ctrl4_c.lpf1_sel_g = (uint8_t)val;
2711 (uint8_t *)&ctrl4_c, 1);
2712 }
2713
2714 return ret;
2715}
2716
2717/**
2718 * @brief Enables gyroscope digital LPF1 if auxiliary SPI is disabled;
2719 * the bandwidth can be selected through FTYPE [2:0] in CTRL6_C.[get]
2720 *
2721 * @param ctx Read / write interface definitions.(ptr)
2722 * @param val Change the values of lpf1_sel_g in reg CTRL4_C
2723 * @retval Interface status (MANDATORY: return 0 -> no Error).
2724 *
2725 */
2727{
2728 ism330dhcx_ctrl4_c_t ctrl4_c;
2729 int32_t ret;
2731 (uint8_t *)&ctrl4_c, 1);
2732 *val = ctrl4_c.lpf1_sel_g;
2733
2734 return ret;
2735}
2736
2737/**
2738 * @brief Mask DRDY on pin (both XL & Gyro) until filter settling ends
2739 * (XL and Gyro independently masked).[set]
2740 *
2741 * @param ctx Read / write interface definitions.(ptr)
2742 * @param val Change the values of drdy_mask in reg CTRL4_C
2743 * @retval Interface status (MANDATORY: return 0 -> no Error).
2744 *
2745 */
2747 uint8_t val)
2748{
2749 ism330dhcx_ctrl4_c_t ctrl4_c;
2750 int32_t ret;
2752 (uint8_t *)&ctrl4_c, 1);
2753
2754 if (ret == 0)
2755 {
2756 ctrl4_c.drdy_mask = (uint8_t)val;
2758 (uint8_t *)&ctrl4_c, 1);
2759 }
2760
2761 return ret;
2762}
2763
2764/**
2765 * @brief Mask DRDY on pin (both XL & Gyro) until filter settling ends
2766 * (XL and Gyro independently masked).[get]
2767 *
2768 * @param ctx Read / write interface definitions.(ptr)
2769 * @param val Change the values of drdy_mask in reg CTRL4_C
2770 * @retval Interface status (MANDATORY: return 0 -> no Error).
2771 *
2772 */
2774 uint8_t *val)
2775{
2776 ism330dhcx_ctrl4_c_t ctrl4_c;
2777 int32_t ret;
2779 (uint8_t *)&ctrl4_c, 1);
2780 *val = ctrl4_c.drdy_mask;
2781
2782 return ret;
2783}
2784
2785/**
2786 * @brief Gyroscope low pass filter 1 bandwidth.[set]
2787 *
2788 * @param ctx Read / write interface definitions.(ptr)
2789 * @param val Change the values of ftype in reg CTRL6_C
2790 * @retval Interface status (MANDATORY: return 0 -> no Error).
2791 *
2792 */
2795{
2796 ism330dhcx_ctrl6_c_t ctrl6_c;
2797 int32_t ret;
2799 (uint8_t *)&ctrl6_c, 1);
2800
2801 if (ret == 0)
2802 {
2803 ctrl6_c.ftype = (uint8_t)val;
2805 (uint8_t *)&ctrl6_c, 1);
2806 }
2807
2808 return ret;
2809}
2810
2811/**
2812 * @brief Gyroscope low pass filter 1 bandwidth.[get]
2813 *
2814 * @param ctx Read / write interface definitions.(ptr)
2815 * @param val Get the values of ftype in reg CTRL6_C
2816 * @retval Interface status (MANDATORY: return 0 -> no Error).
2817 *
2818 */
2820 ism330dhcx_ftype_t *val)
2821{
2822 ism330dhcx_ctrl6_c_t ctrl6_c;
2823 int32_t ret;
2825 (uint8_t *)&ctrl6_c, 1);
2826
2827 switch (ctrl6_c.ftype)
2828 {
2831 break;
2832
2834 *val = ISM330DHCX_VERY_LIGHT;
2835 break;
2836
2837 case ISM330DHCX_LIGHT:
2838 *val = ISM330DHCX_LIGHT;
2839 break;
2840
2841 case ISM330DHCX_MEDIUM:
2842 *val = ISM330DHCX_MEDIUM;
2843 break;
2844
2845 case ISM330DHCX_STRONG:
2846 *val = ISM330DHCX_STRONG;
2847 break;
2848
2851 break;
2852
2854 *val = ISM330DHCX_AGGRESSIVE;
2855 break;
2856
2857 case ISM330DHCX_XTREME:
2858 *val = ISM330DHCX_XTREME;
2859 break;
2860
2861 default:
2863 break;
2864 }
2865
2866 return ret;
2867}
2868
2869/**
2870 * @brief Low pass filter 2 on 6D function selection.[set]
2871 *
2872 * @param ctx Read / write interface definitions.(ptr)
2873 * @param val Change the values of low_pass_on_6d in reg CTRL8_XL
2874 * @retval Interface status (MANDATORY: return 0 -> no Error).
2875 *
2876 */
2878{
2879 ism330dhcx_ctrl8_xl_t ctrl8_xl;
2880 int32_t ret;
2882 (uint8_t *)&ctrl8_xl, 1);
2883
2884 if (ret == 0)
2885 {
2886 ctrl8_xl.low_pass_on_6d = (uint8_t)val;
2888 (uint8_t *)&ctrl8_xl, 1);
2889 }
2890
2891 return ret;
2892}
2893
2894/**
2895 * @brief Low pass filter 2 on 6D function selection.[get]
2896 *
2897 * @param ctx Read / write interface definitions.(ptr)
2898 * @param val Change the values of low_pass_on_6d in reg CTRL8_XL
2899 * @retval Interface status (MANDATORY: return 0 -> no Error).
2900 *
2901 */
2903{
2904 ism330dhcx_ctrl8_xl_t ctrl8_xl;
2905 int32_t ret;
2907 (uint8_t *)&ctrl8_xl, 1);
2908 *val = ctrl8_xl.low_pass_on_6d;
2909
2910 return ret;
2911}
2912
2913/**
2914 * @brief Accelerometer slope filter / high-pass filter selection
2915 * on output.[set]
2916 *
2917 * @param ctx Read / write interface definitions.(ptr)
2918 * @param val Change the values of hp_slope_xl_en in reg CTRL8_XL
2919 * @retval Interface status (MANDATORY: return 0 -> no Error).
2920 *
2921 */
2924{
2925 ism330dhcx_ctrl8_xl_t ctrl8_xl;
2926 int32_t ret;
2928 (uint8_t *)&ctrl8_xl, 1);
2929
2930 if (ret == 0)
2931 {
2932 ctrl8_xl.hp_slope_xl_en = (((uint8_t)val & 0x10U) >> 4);
2933 ctrl8_xl.hp_ref_mode_xl = (((uint8_t)val & 0x20U) >> 5);
2934 ctrl8_xl.hpcf_xl = (uint8_t)val & 0x07U;
2936 (uint8_t *)&ctrl8_xl, 1);
2937 }
2938
2939 return ret;
2940}
2941
2942/**
2943 * @brief Accelerometer slope filter / high-pass filter selection on
2944 * output.[get]
2945 *
2946 * @param ctx Read / write interface definitions.(ptr)
2947 * @param val Get the values of hp_slope_xl_en in reg CTRL8_XL
2948 * @retval Interface status (MANDATORY: return 0 -> no Error).
2949 *
2950 */
2953{
2954 ism330dhcx_ctrl8_xl_t ctrl8_xl;
2955 int32_t ret;
2957 (uint8_t *)&ctrl8_xl, 1);
2958
2959 switch (((ctrl8_xl.hp_ref_mode_xl << 5) + (ctrl8_xl.hp_slope_xl_en <<
2960 4) +
2961 ctrl8_xl.hpcf_xl))
2962 {
2965 break;
2966
2969 break;
2970
2973 break;
2974
2977 break;
2978
2981 break;
2982
2985 break;
2986
2989 break;
2990
2993 break;
2994
2997 break;
2998
3001 break;
3002
3005 break;
3006
3009 break;
3010
3013 break;
3014
3017 break;
3018
3021 break;
3022
3025 break;
3026
3029 break;
3030
3033 break;
3034
3037 break;
3038
3041 break;
3042
3045 break;
3046
3049 break;
3050
3053 break;
3054
3055 default:
3057 break;
3058 }
3059
3060 return ret;
3061}
3062
3063/**
3064 * @brief Enables accelerometer LPF2 and HPF fast-settling mode.
3065 * The filter sets the second samples after writing this bit.
3066 * Active only during device exit from powerdown mode.[set]
3067 *
3068 * @param ctx Read / write interface definitions.(ptr)
3069 * @param val Change the values of fastsettl_mode_xl in reg CTRL8_XL
3070 * @retval Interface status (MANDATORY: return 0 -> no Error).
3071 *
3072 */
3074 uint8_t val)
3075{
3076 ism330dhcx_ctrl8_xl_t ctrl8_xl;
3077 int32_t ret;
3079 (uint8_t *)&ctrl8_xl, 1);
3080
3081 if (ret == 0)
3082 {
3083 ctrl8_xl.fastsettl_mode_xl = (uint8_t)val;
3085 (uint8_t *)&ctrl8_xl, 1);
3086 }
3087
3088 return ret;
3089}
3090
3091/**
3092 * @brief Enables accelerometer LPF2 and HPF fast-settling mode.
3093 * The filter sets the second samples after writing
3094 * this bit. Active only during device exit from powerdown mode.[get]
3095 *
3096 * @param ctx Read / write interface definitions.(ptr)
3097 * @param val Change the values of fastsettl_mode_xl in reg CTRL8_XL
3098 * @retval Interface status (MANDATORY: return 0 -> no Error).
3099 *
3100 */
3102 uint8_t *val)
3103{
3104 ism330dhcx_ctrl8_xl_t ctrl8_xl;
3105 int32_t ret;
3107 (uint8_t *)&ctrl8_xl, 1);
3108 *val = ctrl8_xl.fastsettl_mode_xl;
3109
3110 return ret;
3111}
3112
3113/**
3114 * @brief HPF or SLOPE filter selection on wake-up and Activity/Inactivity
3115 * functions.[set]
3116 *
3117 * @param ctx Read / write interface definitions.(ptr)
3118 * @param val Change the values of slope_fds in reg TAP_CFG0
3119 * @retval Interface status (MANDATORY: return 0 -> no Error).
3120 *
3121 */
3124{
3125 ism330dhcx_tap_cfg0_t tap_cfg0;
3126 int32_t ret;
3128 (uint8_t *)&tap_cfg0, 1);
3129
3130 if (ret == 0)
3131 {
3132 tap_cfg0.slope_fds = (uint8_t)val;
3134 (uint8_t *)&tap_cfg0, 1);
3135 }
3136
3137 return ret;
3138}
3139
3140/**
3141 * @brief HPF or SLOPE filter selection on wake-up and Activity/Inactivity
3142 * functions.[get]
3143 *
3144 * @param ctx Read / write interface definitions.(ptr)
3145 * @param val Get the values of slope_fds in reg TAP_CFG0
3146 * @retval Interface status (MANDATORY: return 0 -> no Error).
3147 *
3148 */
3151{
3152 ism330dhcx_tap_cfg0_t tap_cfg0;
3153 int32_t ret;
3155 (uint8_t *)&tap_cfg0, 1);
3156
3157 switch (tap_cfg0.slope_fds)
3158 {
3160 *val = ISM330DHCX_USE_SLOPE;
3161 break;
3162
3163 case ISM330DHCX_USE_HPF:
3164 *val = ISM330DHCX_USE_HPF;
3165 break;
3166
3167 default:
3168 *val = ISM330DHCX_USE_SLOPE;
3169 break;
3170 }
3171
3172 return ret;
3173}
3174
3175/**
3176 * @brief Enables gyroscope digital high-pass filter. The filter is enabled
3177 * only if the gyro is in HP mode.[set]
3178 *
3179 * @param ctx Read / write interface definitions.(ptr)
3180 * @param val Get the values of hp_en_g and hp_en_g in reg CTRL7_G
3181 * @retval Interface status (MANDATORY: return 0 -> no Error).
3182 *
3183 */
3186{
3187 ism330dhcx_ctrl7_g_t ctrl7_g;
3188 int32_t ret;
3190 (uint8_t *)&ctrl7_g, 1);
3191
3192 if (ret == 0)
3193 {
3194 ctrl7_g.hp_en_g = (((uint8_t)val & 0x80U) >> 7);
3195 ctrl7_g.hpm_g = (uint8_t)val & 0x03U;
3197 (uint8_t *)&ctrl7_g, 1);
3198 }
3199
3200 return ret;
3201}
3202
3203/**
3204 * @brief Enables gyroscope digital high-pass filter. The filter is
3205 * enabled only if the gyro is in HP mode.[get]
3206 *
3207 * @param ctx Read / write interface definitions.(ptr)
3208 * @param val Get the values of hp_en_g and hp_en_g in reg CTRL7_G
3209 * @retval Interface status (MANDATORY: return 0 -> no Error).
3210 *
3211 */
3213 ism330dhcx_hpm_g_t *val)
3214{
3215 ism330dhcx_ctrl7_g_t ctrl7_g;
3216 int32_t ret;
3218 (uint8_t *)&ctrl7_g, 1);
3219
3220 switch ((ctrl7_g.hp_en_g << 7) + ctrl7_g.hpm_g)
3221 {
3224 break;
3225
3228 break;
3229
3232 break;
3233
3236 break;
3237
3240 break;
3241
3242 default:
3244 break;
3245 }
3246
3247 return ret;
3248}
3249
3250/**
3251 * @}
3252 *
3253 */
3254
3255/**
3256 * @defgroup ISM330DHCX_ Auxiliary_interface
3257 * @brief This section groups all the functions concerning
3258 * auxiliary interface.
3259 * @{
3260 *
3261 */
3262
3263/**
3264 * @brief On auxiliary interface connect/disconnect SDO and OCS
3265 * internal pull-up.[set]
3266 *
3267 * @param ctx Read / write interface definitions.(ptr)
3268 * @param val Change the values of ois_pu_dis in reg PIN_CTRL
3269 * @retval Interface status (MANDATORY: return 0 -> no Error).
3270 *
3271 */
3274{
3275 ism330dhcx_pin_ctrl_t pin_ctrl;
3276 int32_t ret;
3278 (uint8_t *)&pin_ctrl, 1);
3279
3280 if (ret == 0)
3281 {
3282 pin_ctrl.ois_pu_dis = (uint8_t)val;
3284 (uint8_t *)&pin_ctrl, 1);
3285 }
3286
3287 return ret;
3288}
3289
3290/**
3291 * @brief On auxiliary interface connect/disconnect SDO and OCS
3292 * internal pull-up.[get]
3293 *
3294 * @param ctx Read / write interface definitions.(ptr)
3295 * @param val Get the values of ois_pu_dis in reg PIN_CTRL
3296 * @retval Interface status (MANDATORY: return 0 -> no Error).
3297 *
3298 */
3301{
3302 ism330dhcx_pin_ctrl_t pin_ctrl;
3303 int32_t ret;
3305 (uint8_t *)&pin_ctrl, 1);
3306
3307 switch (pin_ctrl.ois_pu_dis)
3308 {
3311 break;
3312
3315 break;
3316
3317 default:
3319 break;
3320 }
3321
3322 return ret;
3323}
3324
3325/**
3326 * @brief OIS chain on aux interface power on mode.[set]
3327 *
3328 * @param ctx Read / write interface definitions.(ptr)
3329 * @param val Change the values of ois_on in reg CTRL7_G
3330 * @retval Interface status (MANDATORY: return 0 -> no Error).
3331 *
3332 */
3335{
3336 ism330dhcx_ctrl7_g_t ctrl7_g;
3337 int32_t ret;
3339 (uint8_t *)&ctrl7_g, 1);
3340
3341 if (ret == 0)
3342 {
3343 ctrl7_g.ois_on_en = (uint8_t)val & 0x01U;
3344 ctrl7_g.ois_on = (uint8_t)val & 0x01U;
3346 (uint8_t *)&ctrl7_g, 1);
3347 }
3348
3349 return ret;
3350}
3351
3352/**
3353 * @brief OIS chain on aux interface power on mode[get]
3354 *
3355 * @param ctx Read / write interface definitions.(ptr)
3356 * @param val Get the values of ois_on in reg CTRL7_G
3357 * @retval Interface status (MANDATORY: return 0 -> no Error).
3358 *
3359 */
3362{
3363 ism330dhcx_ctrl7_g_t ctrl7_g;
3364 int32_t ret;
3366 (uint8_t *)&ctrl7_g, 1);
3367
3368 switch (ctrl7_g.ois_on)
3369 {
3370 case ISM330DHCX_AUX_ON:
3371 *val = ISM330DHCX_AUX_ON;
3372 break;
3373
3376 break;
3377
3378 default:
3379 *val = ISM330DHCX_AUX_ON;
3380 break;
3381 }
3382
3383 return ret;
3384}
3385
3386/**
3387 * @brief The STATUS_SPIAux register is read by the auxiliary SPI.[get]
3388 *
3389 * @param ctx Read / write interface definitions.(ptr)
3390 * @param ism330dhcx_status_spiaux_t: registers STATUS_SPIAUX
3391 * @retval Interface status (MANDATORY: return 0 -> no Error).
3392 *
3393 */
3396{
3397 int32_t ret;
3399 (uint8_t *)val, 1);
3400
3401 return ret;
3402}
3403
3404/**
3405 * @brief AUX accelerometer data available.[get]
3406 *
3407 * @param ctx Read / write interface definitions.(ptr)
3408 * @param val Change the values of xlda in reg STATUS_SPIAUX
3409 * @retval Interface status (MANDATORY: return 0 -> no Error).
3410 *
3411 */
3413 uint8_t *val)
3414{
3415 ism330dhcx_status_spiaux_t status_spiaux;
3416 int32_t ret;
3418 (uint8_t *)&status_spiaux, 1);
3419 *val = status_spiaux.xlda;
3420
3421 return ret;
3422}
3423
3424/**
3425 * @brief AUX gyroscope data available.[get]
3426 *
3427 * @param ctx Read / write interface definitions.(ptr)
3428 * @param val Change the values of gda in reg STATUS_SPIAUX
3429 * @retval Interface status (MANDATORY: return 0 -> no Error).
3430 *
3431 */
3433 uint8_t *val)
3434{
3435 ism330dhcx_status_spiaux_t status_spiaux;
3436 int32_t ret;
3438 (uint8_t *)&status_spiaux, 1);
3439 *val = status_spiaux.gda;
3440
3441 return ret;
3442}
3443
3444/**
3445 * @brief High when the gyroscope output is in the settling phase.[get]
3446 *
3447 * @param ctx Read / write interface definitions.(ptr)
3448 * @param val Change the values of gyro_settling in reg STATUS_SPIAUX
3449 * @retval Interface status (MANDATORY: return 0 -> no Error).
3450 *
3451 */
3453 uint8_t *val)
3454{
3455 ism330dhcx_status_spiaux_t status_spiaux;
3456 int32_t ret;
3458 (uint8_t *)&status_spiaux, 1);
3459 *val = status_spiaux.gyro_settling;
3460
3461 return ret;
3462}
3463
3464/**
3465 * @brief Selects accelerometer self-test. Effective only if XL OIS chain is
3466 * enabled.[set]
3467 *
3468 * @param ctx Read / write interface definitions.(ptr)
3469 * @param val Change the values of st_xl_ois in reg INT_OIS
3470 * @retval Interface status (MANDATORY: return 0 -> no Error).
3471 *
3472 */
3475{
3476 ism330dhcx_int_ois_t int_ois;
3477 int32_t ret;
3479 (uint8_t *)&int_ois, 1);
3480
3481 if (ret == 0)
3482 {
3483 int_ois.st_xl_ois = (uint8_t)val;
3485 (uint8_t *)&int_ois, 1);
3486 }
3487
3488 return ret;
3489}
3490
3491/**
3492 * @brief Selects accelerometer self-test. Effective only if XL OIS chain
3493 * is enabled.[get]
3494 *
3495 * @param ctx Read / write interface definitions.(ptr)
3496 * @param val Get the values of st_xl_ois in reg INT_OIS
3497 * @retval Interface status (MANDATORY: return 0 -> no Error).
3498 *
3499 */
3502{
3503 ism330dhcx_int_ois_t int_ois;
3504 int32_t ret;
3506 (uint8_t *)&int_ois, 1);
3507
3508 switch (int_ois.st_xl_ois)
3509 {
3512 break;
3513
3515 *val = ISM330DHCX_AUX_XL_POS;
3516 break;
3517
3519 *val = ISM330DHCX_AUX_XL_NEG;
3520 break;
3521
3522 default:
3524 break;
3525 }
3526
3527 return ret;
3528}
3529
3530/**
3531 * @brief Indicates polarity of DEN signal on OIS chain.[set]
3532 *
3533 * @param ctx Read / write interface definitions.(ptr)
3534 * @param val Change the values of den_lh_ois in reg INT_OIS
3535 * @retval Interface status (MANDATORY: return 0 -> no Error).
3536 *
3537 */
3540{
3541 ism330dhcx_int_ois_t int_ois;
3542 int32_t ret;
3544 (uint8_t *)&int_ois, 1);
3545
3546 if (ret == 0)
3547 {
3548 int_ois.den_lh_ois = (uint8_t)val;
3550 (uint8_t *)&int_ois, 1);
3551 }
3552
3553 return ret;
3554}
3555
3556/**
3557 * @brief Indicates polarity of DEN signal on OIS chain.[get]
3558 *
3559 * @param ctx Read / write interface definitions.(ptr)
3560 * @param val Get the values of den_lh_ois in reg INT_OIS
3561 * @retval Interface status (MANDATORY: return 0 -> no Error).
3562 *
3563 */
3566{
3567 ism330dhcx_int_ois_t int_ois;
3568 int32_t ret;
3570 (uint8_t *)&int_ois, 1);
3571
3572 switch (int_ois.den_lh_ois)
3573 {
3576 break;
3577
3580 break;
3581
3582 default:
3584 break;
3585 }
3586
3587 return ret;
3588}
3589
3590/**
3591 * @brief Configure DEN mode on the OIS chain.[set]
3592 *
3593 * @param ctx Read / write interface definitions.(ptr)
3594 * @param val Change the values of lvl2_ois in reg INT_OIS
3595 * @retval Interface status (MANDATORY: return 0 -> no Error).
3596 *
3597 */
3600{
3601 ism330dhcx_int_ois_t int_ois;
3602 ism330dhcx_ctrl1_ois_t ctrl1_ois;
3603 int32_t ret;
3605 (uint8_t *)&int_ois, 1);
3606
3607 if (ret == 0)
3608 {
3609 int_ois.lvl2_ois = (uint8_t)val & 0x01U;
3611 (uint8_t *)&int_ois, 1);
3612 }
3613
3614 if (ret == 0)
3615 {
3617 (uint8_t *)&ctrl1_ois, 1);
3618 }
3619
3620 if (ret == 0)
3621 {
3622 ctrl1_ois.lvl1_ois = ((uint8_t)val & 0x02U) >> 1;
3624 (uint8_t *)&ctrl1_ois, 1);
3625 }
3626
3627 return ret;
3628}
3629
3630/**
3631 * @brief Configure DEN mode on the OIS chain.[get]
3632 *
3633 * @param ctx Read / write interface definitions.(ptr)
3634 * @param val Get the values of lvl2_ois in reg INT_OIS
3635 * @retval Interface status (MANDATORY: return 0 -> no Error).
3636 *
3637 */
3640{
3641 ism330dhcx_int_ois_t int_ois;
3642 ism330dhcx_ctrl1_ois_t ctrl1_ois;
3643 int32_t ret;
3645 (uint8_t *)&int_ois, 1);
3646
3647 if (ret == 0)
3648 {
3650 (uint8_t *)&ctrl1_ois, 1);
3651 }
3652
3653 switch ((ctrl1_ois.lvl1_ois << 1) + int_ois.lvl2_ois)
3654 {
3657 break;
3658
3661 break;
3662
3665 break;
3666
3667 default:
3669 break;
3670 }
3671
3672 return ret;
3673}
3674
3675/**
3676 * @brief Enables/Disable OIS chain DRDY on INT2 pin. This setting has
3677 * priority over all other INT2 settings.[set]
3678 *
3679 * @param ctx Read / write interface definitions.(ptr)
3680 * @param val Change the values of int2_drdy_ois in reg INT_OIS
3681 * @retval Interface status (MANDATORY: return 0 -> no Error).
3682 *
3683 */
3685 uint8_t val)
3686{
3687 ism330dhcx_int_ois_t int_ois;
3688 int32_t ret;
3690 (uint8_t *)&int_ois, 1);
3691
3692 if (ret == 0)
3693 {
3694 int_ois.int2_drdy_ois = (uint8_t)val;
3696 (uint8_t *)&int_ois, 1);
3697 }
3698
3699 return ret;
3700}
3701
3702/**
3703 * @brief Enables/Disable OIS chain DRDY on INT2 pin. This setting has
3704 * priority over all other INT2 settings.[get]
3705 *
3706 * @param ctx Read / write interface definitions.(ptr)
3707 * @param val Change the values of int2_drdy_ois in reg INT_OIS
3708 * @retval Interface status (MANDATORY: return 0 -> no Error).
3709 *
3710 */
3712 uint8_t *val)
3713{
3714 ism330dhcx_int_ois_t int_ois;
3715 int32_t ret;
3717 (uint8_t *)&int_ois, 1);
3718 *val = int_ois.int2_drdy_ois;
3719
3720 return ret;
3721}
3722
3723/**
3724 * @brief Enables OIS chain data processing for gyro in Mode 3 and Mode 4
3725 * (mode4_en = 1) and accelerometer data in and Mode 4 (mode4_en = 1).
3726 * When the OIS chain is enabled, the OIS outputs are available
3727 * through the SPI2 in registers OUTX_L_G (22h) through OUTZ_H_G(27h)
3728 * and STATUS_REG (1Eh) / STATUS_SPIAux, and LPF1 is dedicated to
3729 * this chain.[set]
3730 *
3731 * @param ctx Read / write interface definitions.(ptr)
3732 * @param val Change the values of ois_en_spi2 in reg CTRL1_OIS
3733 * @retval Interface status (MANDATORY: return 0 -> no Error).
3734 *
3735 */
3738{
3739 ism330dhcx_ctrl1_ois_t ctrl1_ois;
3740 int32_t ret;
3742 (uint8_t *)&ctrl1_ois, 1);
3743
3744 if (ret == 0)
3745 {
3746 ctrl1_ois.ois_en_spi2 = (uint8_t)val & 0x01U;
3747 ctrl1_ois.mode4_en = ((uint8_t)val & 0x02U) >> 1;
3749 (uint8_t *)&ctrl1_ois, 1);
3750 }
3751
3752 return ret;
3753}
3754
3755/**
3756 * @brief Enables OIS chain data processing for gyro in Mode 3 and Mode 4
3757 * (mode4_en = 1) and accelerometer data in and Mode 4 (mode4_en = 1).
3758 * When the OIS chain is enabled, the OIS outputs are available
3759 * through the SPI2 in registers OUTX_L_G (22h) through OUTZ_H_G(27h)
3760 * and STATUS_REG (1Eh) / STATUS_SPIAux, and LPF1 is dedicated to
3761 * this chain.[get]
3762 *
3763 * @param ctx Read / write interface definitions.(ptr)
3764 * @param val Get the values of ois_en_spi2 in
3765 * reg CTRL1_OIS
3766 * @retval Interface status (MANDATORY: return 0 -> no Error).
3767 *
3768 */
3771{
3772 ism330dhcx_ctrl1_ois_t ctrl1_ois;
3773 int32_t ret;
3775 (uint8_t *)&ctrl1_ois, 1);
3776
3777 switch (((ctrl1_ois.mode4_en << 1) + ctrl1_ois.ois_en_spi2))
3778 {
3781 break;
3782
3784 *val = ISM330DHCX_MODE_3_GY;
3785 break;
3786
3789 break;
3790
3791 default:
3793 break;
3794 }
3795
3796 return ret;
3797}
3798
3799/**
3800 * @brief Selects gyroscope OIS chain full-scale.[set]
3801 *
3802 * @param ctx Read / write interface definitions.(ptr)
3803 * @param val Change the values of fs_g_ois in reg CTRL1_OIS
3804 * @retval Interface status (MANDATORY: return 0 -> no Error).
3805 *
3806 */
3809{
3810 ism330dhcx_ctrl1_ois_t ctrl1_ois;
3811 int32_t ret;
3813 (uint8_t *)&ctrl1_ois, 1);
3814
3815 if (ret == 0)
3816 {
3817 ctrl1_ois.fs_g_ois = (uint8_t)val & 0x03U;
3818 ctrl1_ois.fs_125_ois = ((uint8_t)val & 0x04U) >> 2;
3820 (uint8_t *)&ctrl1_ois, 1);
3821 }
3822
3823 return ret;
3824}
3825
3826/**
3827 * @brief Selects gyroscope OIS chain full-scale.[get]
3828 *
3829 * @param ctx Read / write interface definitions.(ptr)
3830 * @param val Get the values of fs_g_ois in reg CTRL1_OIS
3831 * @retval Interface status (MANDATORY: return 0 -> no Error).
3832 *
3833 */
3836{
3837 ism330dhcx_ctrl1_ois_t ctrl1_ois;
3838 int32_t ret;
3840 (uint8_t *)&ctrl1_ois, 1);
3841
3842 switch ((ctrl1_ois.fs_125_ois << 2) + ctrl1_ois.fs_g_ois)
3843 {
3845 *val = ISM330DHCX_250dps_AUX;
3846 break;
3847
3849 *val = ISM330DHCX_125dps_AUX;
3850 break;
3851
3853 *val = ISM330DHCX_500dps_AUX;
3854 break;
3855
3858 break;
3859
3862 break;
3863
3864 default:
3865 *val = ISM330DHCX_250dps_AUX;
3866 break;
3867 }
3868
3869 return ret;
3870}
3871
3872/**
3873 * @brief SPI2 3- or 4-wire interface.[set]
3874 *
3875 * @param ctx Read / write interface definitions.(ptr)
3876 * @param val Change the values of sim_ois in reg CTRL1_OIS
3877 * @retval Interface status (MANDATORY: return 0 -> no Error).
3878 *
3879 */
3882{
3883 ism330dhcx_ctrl1_ois_t ctrl1_ois;
3884 int32_t ret;
3886 (uint8_t *)&ctrl1_ois, 1);
3887
3888 if (ret == 0)
3889 {
3890 ctrl1_ois.sim_ois = (uint8_t)val;
3892 (uint8_t *)&ctrl1_ois, 1);
3893 }
3894
3895 return ret;
3896}
3897
3898/**
3899 * @brief SPI2 3- or 4-wire interface.[get]
3900 *
3901 * @param ctx Read / write interface definitions.(ptr)
3902 * @param val Get the values of sim_ois in reg CTRL1_OIS
3903 * @retval Interface status (MANDATORY: return 0 -> no Error).
3904 *
3905 */
3908{
3909 ism330dhcx_ctrl1_ois_t ctrl1_ois;
3910 int32_t ret;
3912 (uint8_t *)&ctrl1_ois, 1);
3913
3914 switch (ctrl1_ois.sim_ois)
3915 {
3918 break;
3919
3922 break;
3923
3924 default:
3926 break;
3927 }
3928
3929 return ret;
3930}
3931
3932/**
3933 * @brief Selects gyroscope digital LPF1 filter bandwidth.[set]
3934 *
3935 * @param ctx Read / write interface definitions.(ptr)
3936 * @param val Change the values of ftype_ois in reg CTRL2_OIS
3937 * @retval Interface status (MANDATORY: return 0 -> no Error).
3938 *
3939 */
3942{
3943 ism330dhcx_ctrl2_ois_t ctrl2_ois;
3944 int32_t ret;
3946 (uint8_t *)&ctrl2_ois, 1);
3947
3948 if (ret == 0)
3949 {
3950 ctrl2_ois.ftype_ois = (uint8_t)val;
3952 (uint8_t *)&ctrl2_ois, 1);
3953 }
3954
3955 return ret;
3956}
3957
3958/**
3959 * @brief Selects gyroscope digital LPF1 filter bandwidth.[get]
3960 *
3961 * @param ctx Read / write interface definitions.(ptr)
3962 * @param val Get the values of ftype_ois in reg CTRL2_OIS
3963 * @retval Interface status (MANDATORY: return 0 -> no Error).
3964 *
3965 */
3968{
3969 ism330dhcx_ctrl2_ois_t ctrl2_ois;
3970 int32_t ret;
3972 (uint8_t *)&ctrl2_ois, 1);
3973
3974 switch (ctrl2_ois.ftype_ois)
3975 {
3976 case ISM330DHCX_351Hz39:
3977 *val = ISM330DHCX_351Hz39;
3978 break;
3979
3980 case ISM330DHCX_236Hz63:
3981 *val = ISM330DHCX_236Hz63;
3982 break;
3983
3984 case ISM330DHCX_172Hz70:
3985 *val = ISM330DHCX_172Hz70;
3986 break;
3987
3988 case ISM330DHCX_937Hz91:
3989 *val = ISM330DHCX_937Hz91;
3990 break;
3991
3992 default:
3993 *val = ISM330DHCX_351Hz39;
3994 break;
3995 }
3996
3997 return ret;
3998}
3999
4000/**
4001 * @brief Selects gyroscope OIS chain digital high-pass filter cutoff.[set]
4002 *
4003 * @param ctx Read / write interface definitions.(ptr)
4004 * @param val Change the values of hpm_ois in reg CTRL2_OIS
4005 * @retval Interface status (MANDATORY: return 0 -> no Error).
4006 *
4007 */
4010{
4011 ism330dhcx_ctrl2_ois_t ctrl2_ois;
4012 int32_t ret;
4014 (uint8_t *)&ctrl2_ois, 1);
4015
4016 if (ret == 0)
4017 {
4018 ctrl2_ois.hpm_ois = (uint8_t)val & 0x03U;
4019 ctrl2_ois.hp_en_ois = ((uint8_t)val & 0x10U) >> 4;
4021 (uint8_t *)&ctrl2_ois, 1);
4022 }
4023
4024 return ret;
4025}
4026
4027/**
4028 * @brief Selects gyroscope OIS chain digital high-pass filter cutoff.[get]
4029 *
4030 * @param ctx Read / write interface definitions.(ptr)
4031 * @param val Get the values of hpm_ois in reg CTRL2_OIS
4032 * @retval Interface status (MANDATORY: return 0 -> no Error).
4033 *
4034 */
4037{
4038 ism330dhcx_ctrl2_ois_t ctrl2_ois;
4039 int32_t ret;
4041 (uint8_t *)&ctrl2_ois, 1);
4042
4043 switch ((ctrl2_ois.hp_en_ois << 4) + ctrl2_ois.hpm_ois)
4044 {
4047 break;
4048
4051 break;
4052
4055 break;
4056
4059 break;
4060
4063 break;
4064
4065 default:
4067 break;
4068 }
4069
4070 return ret;
4071}
4072
4073/**
4074 * @brief Enable / Disables OIS chain clamp. Enable: All OIS chain
4075 * outputs = 8000h during self-test; Disable: OIS chain self-test
4076 * outputs dependent from the aux gyro full scale selected.[set]
4077 *
4078 * @param ctx Read / write interface definitions.(ptr)
4079 * @param val Change the values of st_ois_clampdis in reg CTRL3_OIS
4080 * @retval Interface status (MANDATORY: return 0 -> no Error).
4081 *
4082 */
4085{
4086 ism330dhcx_ctrl3_ois_t ctrl3_ois;
4087 int32_t ret;
4089 (uint8_t *)&ctrl3_ois, 1);
4090
4091 if (ret == 0)
4092 {
4093 ctrl3_ois.st_ois_clampdis = (uint8_t)val;
4095 (uint8_t *)&ctrl3_ois, 1);
4096 }
4097
4098 return ret;
4099}
4100
4101/**
4102 * @brief Enable / Disables OIS chain clamp. Enable: All OIS chain
4103 * outputs = 8000h during self-test; Disable: OIS chain self-test
4104 * outputs dependent from the aux gyro full scale selected.[get]
4105 *
4106 * @param ctx Read / write interface definitions.(ptr)
4107 * @param val Get the values of st_ois_clampdis in reg CTRL3_OIS
4108 * @retval Interface status (MANDATORY: return 0 -> no Error).
4109 *
4110 */
4113{
4114 ism330dhcx_ctrl3_ois_t ctrl3_ois;
4115 int32_t ret;
4117 (uint8_t *)&ctrl3_ois, 1);
4118
4119 switch (ctrl3_ois.st_ois_clampdis)
4120 {
4123 break;
4124
4127 break;
4128
4129 default:
4131 break;
4132 }
4133
4134 return ret;
4135}
4136
4137/**
4138 * @brief Selects gyroscope OIS chain self-test.[set]
4139 *
4140 * @param ctx Read / write interface definitions.(ptr)
4141 * @param val Change the values of st_ois in reg CTRL3_OIS
4142 * @retval Interface status (MANDATORY: return 0 -> no Error).
4143 *
4144 */
4147{
4148 ism330dhcx_ctrl3_ois_t ctrl3_ois;
4149 int32_t ret;
4151 (uint8_t *)&ctrl3_ois, 1);
4152
4153 if (ret == 0)
4154 {
4155 ctrl3_ois.st_ois = (uint8_t)val;
4157 (uint8_t *)&ctrl3_ois, 1);
4158 }
4159
4160 return ret;
4161}
4162
4163/**
4164 * @brief Selects gyroscope OIS chain self-test.[get]
4165 *
4166 * @param ctx Read / write interface definitions.(ptr)
4167 * @param val Get the values of st_ois in reg CTRL3_OIS
4168 * @retval Interface status (MANDATORY: return 0 -> no Error).
4169 *
4170 */
4173{
4174 ism330dhcx_ctrl3_ois_t ctrl3_ois;
4175 int32_t ret;
4177 (uint8_t *)&ctrl3_ois, 1);
4178
4179 switch (ctrl3_ois.st_ois)
4180 {
4183 break;
4184
4186 *val = ISM330DHCX_AUX_GY_POS;
4187 break;
4188
4190 *val = ISM330DHCX_AUX_GY_NEG;
4191 break;
4192
4193 default:
4195 break;
4196 }
4197
4198 return ret;
4199}
4200
4201/**
4202 * @brief Selects accelerometer OIS channel bandwidth.[set]
4203 *
4204 * @param ctx Read / write interface definitions.(ptr)
4205 * @param val Change the values of filter_xl_conf_ois in reg CTRL3_OIS
4206 * @retval Interface status (MANDATORY: return 0 -> no Error).
4207 *
4208 */
4211{
4212 ism330dhcx_ctrl3_ois_t ctrl3_ois;
4213 int32_t ret;
4215 (uint8_t *)&ctrl3_ois, 1);
4216
4217 if (ret == 0)
4218 {
4219 ctrl3_ois.filter_xl_conf_ois = (uint8_t)val;
4221 (uint8_t *)&ctrl3_ois, 1);
4222 }
4223
4224 return ret;
4225}
4226
4227/**
4228 * @brief Selects accelerometer OIS channel bandwidth.[get]
4229 *
4230 * @param ctx Read / write interface definitions.(ptr)
4231 * @param val Get the values of filter_xl_conf_ois in reg CTRL3_OIS
4232 * @retval Interface status (MANDATORY: return 0 -> no Error).
4233 *
4234 */
4237{
4238 ism330dhcx_ctrl3_ois_t ctrl3_ois;
4239 int32_t ret;
4241 (uint8_t *)&ctrl3_ois, 1);
4242
4243 switch (ctrl3_ois.filter_xl_conf_ois)
4244 {
4245 case ISM330DHCX_631Hz:
4246 *val = ISM330DHCX_631Hz;
4247 break;
4248
4249 case ISM330DHCX_295Hz:
4250 *val = ISM330DHCX_295Hz;
4251 break;
4252
4253 case ISM330DHCX_140Hz:
4254 *val = ISM330DHCX_140Hz;
4255 break;
4256
4257 case ISM330DHCX_68Hz2:
4258 *val = ISM330DHCX_68Hz2;
4259 break;
4260
4261 case ISM330DHCX_33Hz6:
4262 *val = ISM330DHCX_33Hz6;
4263 break;
4264
4265 case ISM330DHCX_16Hz7:
4266 *val = ISM330DHCX_16Hz7;
4267 break;
4268
4269 case ISM330DHCX_8Hz3:
4270 *val = ISM330DHCX_8Hz3;
4271 break;
4272
4273 case ISM330DHCX_4Hz11:
4274 *val = ISM330DHCX_4Hz11;
4275 break;
4276
4277 default:
4278 *val = ISM330DHCX_631Hz;
4279 break;
4280 }
4281
4282 return ret;
4283}
4284
4285/**
4286 * @brief Selects accelerometer OIS channel full-scale.[set]
4287 *
4288 * @param ctx Read / write interface definitions.(ptr)
4289 * @param val Change the values of fs_xl_ois in reg CTRL3_OIS
4290 * @retval Interface status (MANDATORY: return 0 -> no Error).
4291 *
4292 */
4295{
4296 ism330dhcx_ctrl3_ois_t ctrl3_ois;
4297 int32_t ret;
4299 (uint8_t *)&ctrl3_ois, 1);
4300
4301 if (ret == 0)
4302 {
4303 ctrl3_ois.fs_xl_ois = (uint8_t)val;
4305 (uint8_t *)&ctrl3_ois, 1);
4306 }
4307
4308 return ret;
4309}
4310
4311/**
4312 * @brief Selects accelerometer OIS channel full-scale.[get]
4313 *
4314 * @param ctx Read / write interface definitions.(ptr)
4315 * @param val Get the values of fs_xl_ois in reg CTRL3_OIS
4316 * @retval Interface status (MANDATORY: return 0 -> no Error).
4317 *
4318 */
4321{
4322 ism330dhcx_ctrl3_ois_t ctrl3_ois;
4323 int32_t ret;
4325 (uint8_t *)&ctrl3_ois, 1);
4326
4327 switch (ctrl3_ois.fs_xl_ois)
4328 {
4329 case ISM330DHCX_AUX_2g:
4330 *val = ISM330DHCX_AUX_2g;
4331 break;
4332
4333 case ISM330DHCX_AUX_16g:
4334 *val = ISM330DHCX_AUX_16g;
4335 break;
4336
4337 case ISM330DHCX_AUX_4g:
4338 *val = ISM330DHCX_AUX_4g;
4339 break;
4340
4341 case ISM330DHCX_AUX_8g:
4342 *val = ISM330DHCX_AUX_8g;
4343 break;
4344
4345 default:
4346 *val = ISM330DHCX_AUX_2g;
4347 break;
4348 }
4349
4350 return ret;
4351}
4352
4353/**
4354 * @}
4355 *
4356 */
4357
4358/**
4359 * @defgroup ISM330DHCX_ main_serial_interface
4360 * @brief This section groups all the functions concerning main
4361 * serial interface management (not auxiliary)
4362 * @{
4363 *
4364 */
4365
4366/**
4367 * @brief Connect/Disconnect SDO/SA0 internal pull-up.[set]
4368 *
4369 * @param ctx Read / write interface definitions.(ptr)
4370 * @param val Change the values of sdo_pu_en in reg PIN_CTRL
4371 * @retval Interface status (MANDATORY: return 0 -> no Error).
4372 *
4373 */
4376{
4377 ism330dhcx_pin_ctrl_t pin_ctrl;
4378 int32_t ret;
4380 (uint8_t *)&pin_ctrl, 1);
4381
4382 if (ret == 0)
4383 {
4384 pin_ctrl.sdo_pu_en = (uint8_t)val;
4386 (uint8_t *)&pin_ctrl, 1);
4387 }
4388
4389 return ret;
4390}
4391
4392/**
4393 * @brief Connect/Disconnect SDO/SA0 internal pull-up.[get]
4394 *
4395 * @param ctx Read / write interface definitions.(ptr)
4396 * @param val Get the values of sdo_pu_en in reg PIN_CTRL
4397 * @retval Interface status (MANDATORY: return 0 -> no Error).
4398 *
4399 */
4402{
4403 ism330dhcx_pin_ctrl_t pin_ctrl;
4404 int32_t ret;
4406 (uint8_t *)&pin_ctrl, 1);
4407
4408 switch (pin_ctrl.sdo_pu_en)
4409 {
4412 break;
4413
4416 break;
4417
4418 default:
4420 break;
4421 }
4422
4423 return ret;
4424}
4425
4426/**
4427 * @brief SPI Serial Interface Mode selection.[set]
4428 *
4429 * @param ctx Read / write interface definitions.(ptr)
4430 * @param val Change the values of sim in reg CTRL3_C
4431 * @retval Interface status (MANDATORY: return 0 -> no Error).
4432 *
4433 */
4435 ism330dhcx_sim_t val)
4436{
4437 ism330dhcx_ctrl3_c_t ctrl3_c;
4438 int32_t ret;
4440 (uint8_t *)&ctrl3_c, 1);
4441
4442 if (ret == 0)
4443 {
4444 ctrl3_c.sim = (uint8_t)val;
4446 (uint8_t *)&ctrl3_c, 1);
4447 }
4448
4449 return ret;
4450}
4451
4452/**
4453 * @brief SPI Serial Interface Mode selection.[get]
4454 *
4455 * @param ctx Read / write interface definitions.(ptr)
4456 * @param val Get the values of sim in reg CTRL3_C
4457 * @retval Interface status (MANDATORY: return 0 -> no Error).
4458 *
4459 */
4461 ism330dhcx_sim_t *val)
4462{
4463 ism330dhcx_ctrl3_c_t ctrl3_c;
4464 int32_t ret;
4466 (uint8_t *)&ctrl3_c, 1);
4467
4468 switch (ctrl3_c.sim)
4469 {
4471 *val = ISM330DHCX_SPI_4_WIRE;
4472 break;
4473
4475 *val = ISM330DHCX_SPI_3_WIRE;
4476 break;
4477
4478 default:
4479 *val = ISM330DHCX_SPI_4_WIRE;
4480 break;
4481 }
4482
4483 return ret;
4484}
4485
4486/**
4487 * @brief Disable / Enable I2C interface.[set]
4488 *
4489 * @param ctx Read / write interface definitions.(ptr)
4490 * @param val Change the values of i2c_disable in reg CTRL4_C
4491 * @retval Interface status (MANDATORY: return 0 -> no Error).
4492 *
4493 */
4496{
4497 ism330dhcx_ctrl4_c_t ctrl4_c;
4498 int32_t ret;
4500 (uint8_t *)&ctrl4_c, 1);
4501
4502 if (ret == 0)
4503 {
4504 ctrl4_c.i2c_disable = (uint8_t)val;
4506 (uint8_t *)&ctrl4_c, 1);
4507 }
4508
4509 return ret;
4510}
4511
4512/**
4513 * @brief Disable / Enable I2C interface.[get]
4514 *
4515 * @param ctx Read / write interface definitions.(ptr)
4516 * @param val Get the values of i2c reg CTRL4_C
4517 * @retval Interface status (MANDATORY: return 0 -> no Error).
4518 *
4519 */
4522{
4523 ism330dhcx_ctrl4_c_t ctrl4_c;
4524 int32_t ret;
4526 (uint8_t *)&ctrl4_c, 1);
4527
4528 switch (ctrl4_c.i2c_disable)
4529 {
4531 *val = ISM330DHCX_I2C_ENABLE;
4532 break;
4533
4536 break;
4537
4538 default:
4539 *val = ISM330DHCX_I2C_ENABLE;
4540 break;
4541 }
4542
4543 return ret;
4544}
4545
4546/**
4547 * @}
4548 *
4549 */
4550
4551/**
4552 * @defgroup ISM330DHCX_interrupt_pins
4553 * @brief This section groups all the functions that manage
4554 * interrupt pins
4555 * @{
4556 *
4557 */
4558
4559/**
4560 * @brief Select the signal that need to route on int1 pad[set]
4561 *
4562 * @param ctx Read / write interface definitions.(ptr)
4563 * @param val Structure of registers: INT1_CTRL,MD1_CFG,
4564 * EMB_FUNC_INT1, FSM_INT1_A, FSM_INT1_B
4565 * @retval Interface status (MANDATORY: return 0 -> no Error).
4566 *
4567 */
4570{
4571 ism330dhcx_tap_cfg2_t tap_cfg2;
4572 int32_t ret;
4574
4575 if (ret == 0)
4576 {
4578 (uint8_t *)&val->mlc_int1, 1);
4579 }
4580
4581 if (ret == 0)
4582 {
4584 (uint8_t *)&val->emb_func_int1, 1);
4585 }
4586
4587 if (ret == 0)
4588 {
4590 (uint8_t *)&val->fsm_int1_a, 1);
4591 }
4592
4593 if (ret == 0)
4594 {
4596 (uint8_t *)&val->fsm_int1_b, 1);
4597 }
4598
4599 if (ret == 0)
4600 {
4602 }
4603
4604 if (ret == 0)
4605 {
4606 if ((val->emb_func_int1.int1_fsm_lc |
4610 val->fsm_int1_a.int1_fsm1 |
4611 val->fsm_int1_a.int1_fsm2 |
4612 val->fsm_int1_a.int1_fsm3 |
4613 val->fsm_int1_a.int1_fsm4 |
4614 val->fsm_int1_a.int1_fsm5 |
4615 val->fsm_int1_a.int1_fsm6 |
4616 val->fsm_int1_a.int1_fsm7 |
4617 val->fsm_int1_a.int1_fsm8 |
4618 val->fsm_int1_b.int1_fsm9 |
4619 val->fsm_int1_b.int1_fsm10 |
4620 val->fsm_int1_b.int1_fsm11 |
4621 val->fsm_int1_b.int1_fsm12 |
4622 val->fsm_int1_b.int1_fsm13 |
4623 val->fsm_int1_b.int1_fsm14 |
4624 val->fsm_int1_b.int1_fsm15 |
4625 val->fsm_int1_b.int1_fsm16 |
4626 val->mlc_int1.int1_mlc1 |
4627 val->mlc_int1.int1_mlc2 |
4628 val->mlc_int1.int1_mlc3 |
4629 val->mlc_int1.int1_mlc4 |
4630 val->mlc_int1.int1_mlc5 |
4631 val->mlc_int1.int1_mlc6 |
4632 val->mlc_int1.int1_mlc7 |
4634 {
4636 }
4637
4638 else
4639 {
4641 }
4642
4644 (uint8_t *)&val->int1_ctrl, 1);
4645 }
4646
4647 if (ret == 0)
4648 {
4650 (uint8_t *)&val->md1_cfg, 1);
4651 }
4652
4653 if (ret == 0)
4654 {
4656 (uint8_t *)&tap_cfg2, 1);
4657
4658 if ((val->int1_ctrl.den_drdy_flag |
4659 val->int1_ctrl.int1_boot |
4660 val->int1_ctrl.int1_cnt_bdr |
4661 val->int1_ctrl.int1_drdy_g |
4662 val->int1_ctrl.int1_drdy_xl |
4665 val->int1_ctrl.int1_fifo_th |
4666 val->md1_cfg.int1_shub |
4667 val->md1_cfg.int1_6d |
4669 val->md1_cfg.int1_ff |
4670 val->md1_cfg.int1_wu |
4673 {
4674 tap_cfg2.interrupts_enable = PROPERTY_ENABLE;
4675 }
4676
4677 else
4678 {
4679 tap_cfg2.interrupts_enable = PROPERTY_DISABLE;
4680 }
4681 }
4682
4683 if (ret == 0)
4684 {
4686 (uint8_t *)&tap_cfg2, 1);
4687 }
4688
4689 return ret;
4690}
4691
4692/**
4693 * @brief Select the signal that need to route on int1 pad.[get]
4694 *
4695 * @param ctx Read / write interface definitions.(ptr)
4696 * @param val Structure of registers: INT1_CTRL, MD1_CFG,
4697 * EMB_FUNC_INT1, FSM_INT1_A, FSM_INT1_B.(ptr)
4698 * @retval Interface status (MANDATORY: return 0 -> no Error).
4699 *
4700 */
4703{
4704 int32_t ret;
4706
4707 if (ret == 0)
4708 {
4710 (uint8_t *)&val->mlc_int1, 1);
4711 }
4712
4713 if (ret == 0)
4714 {
4716 (uint8_t *)&val->emb_func_int1, 1);
4717 }
4718
4719 if (ret == 0)
4720 {
4722 (uint8_t *)&val->fsm_int1_a, 1);
4723 }
4724
4725 if (ret == 0)
4726 {
4728 (uint8_t *)&val->fsm_int1_b, 1);
4729 }
4730
4731 if (ret == 0)
4732 {
4734 }
4735
4736 if (ret == 0)
4737 {
4739 (uint8_t *)&val->int1_ctrl, 1);
4740 }
4741
4742 if (ret == 0)
4743 {
4745 (uint8_t *)&val->md1_cfg, 1);
4746 }
4747
4748 return ret;
4749}
4750
4751/**
4752 * @brief Select the signal that need to route on int2 pad[set]
4753 *
4754 * @param ctx Read / write interface definitions.(ptr)
4755 * @param val Structure of registers INT2_CTRL, MD2_CFG,
4756 * EMB_FUNC_INT2, FSM_INT2_A, FSM_INT2_B
4757 * @retval Interface status (MANDATORY: return 0 -> no Error).
4758 *
4759 */
4762{
4763 ism330dhcx_tap_cfg2_t tap_cfg2;
4764 int32_t ret;
4766
4767 if (ret == 0)
4768 {
4770 (uint8_t *)&val->mlc_int2, 1);
4771 }
4772
4773 if (ret == 0)
4774 {
4776 (uint8_t *)&val->emb_func_int2, 1);
4777 }
4778
4779 if (ret == 0)
4780 {
4782 (uint8_t *)&val->fsm_int2_a, 1);
4783 }
4784
4785 if (ret == 0)
4786 {
4788 (uint8_t *)&val->fsm_int2_b, 1);
4789 }
4790
4791 if (ret == 0)
4792 {
4794 }
4795
4796 if (ret == 0)
4797 {
4802 val->fsm_int2_a.int2_fsm1 |
4803 val->fsm_int2_a.int2_fsm2 |
4804 val->fsm_int2_a.int2_fsm3 |
4805 val->fsm_int2_a.int2_fsm4 |
4806 val->fsm_int2_a.int2_fsm5 |
4807 val->fsm_int2_a.int2_fsm6 |
4808 val->fsm_int2_a.int2_fsm7 |
4809 val->fsm_int2_a.int2_fsm8 |
4810 val->fsm_int2_b.int2_fsm9 |
4811 val->fsm_int2_b.int2_fsm10 |
4812 val->fsm_int2_b.int2_fsm11 |
4813 val->fsm_int2_b.int2_fsm12 |
4814 val->fsm_int2_b.int2_fsm13 |
4815 val->fsm_int2_b.int2_fsm14 |
4816 val->fsm_int2_b.int2_fsm15 |
4817 val->fsm_int2_b.int2_fsm16 |
4818 val->mlc_int2.int2_mlc1 |
4819 val->mlc_int2.int2_mlc2 |
4820 val->mlc_int2.int2_mlc3 |
4821 val->mlc_int2.int2_mlc4 |
4822 val->mlc_int2.int2_mlc5 |
4823 val->mlc_int2.int2_mlc6 |
4824 val->mlc_int2.int2_mlc7 |
4826 {
4828 }
4829
4830 else
4831 {
4833 }
4834
4836 (uint8_t *)&val->int2_ctrl, 1);
4837 }
4838
4839 if (ret == 0)
4840 {
4842 (uint8_t *)&val->md2_cfg, 1);
4843 }
4844
4845 if (ret == 0)
4846 {
4848 (uint8_t *)&tap_cfg2, 1);
4849 }
4850
4851 if (ret == 0)
4852 {
4853 if ((val->int2_ctrl.int2_drdy_xl |
4854 val->int2_ctrl.int2_drdy_g |
4856 val->int2_ctrl.int2_fifo_th |
4859 val->int2_ctrl.int2_cnt_bdr |
4860 val->md2_cfg.int2_6d |
4862 val->md2_cfg.int2_ff |
4863 val->md2_cfg.int2_wu |
4866 {
4868 }
4869
4870 else
4871 {
4873 }
4874
4876 (uint8_t *)&tap_cfg2, 1);
4877 }
4878
4879 return ret;
4880}
4881
4882/**
4883 * @brief Select the signal that need to route on int2 pad.[get]
4884 *
4885 * @param ctx Read / write interface definitions.(ptr)
4886 * @param val Structure of registers INT2_CTRL, MD2_CFG,
4887 * EMB_FUNC_INT2, FSM_INT2_A, FSM_INT2_B.[get]
4888 * @retval Interface status (MANDATORY: return 0 -> no Error).
4889 *
4890 */
4893{
4894 int32_t ret;
4896
4897 if (ret == 0)
4898 {
4900 (uint8_t *)&val->mlc_int2, 1);
4901 }
4902
4903 if (ret == 0)
4904 {
4906 (uint8_t *)&val->emb_func_int2, 1);
4907 }
4908
4909 if (ret == 0)
4910 {
4912 (uint8_t *)&val->fsm_int2_a, 1);
4913 }
4914
4915 if (ret == 0)
4916 {
4918 (uint8_t *)&val->fsm_int2_b, 1);
4919 }
4920
4921 if (ret == 0)
4922 {
4924 }
4925
4926 if (ret == 0)
4927 {
4929 (uint8_t *)&val->int2_ctrl, 1);
4930 }
4931
4932 if (ret == 0)
4933 {
4935 (uint8_t *)&val->md2_cfg, 1);
4936 }
4937
4938 return ret;
4939}
4940
4941/**
4942 * @brief Push-pull/open drain selection on interrupt pads.[set]
4943 *
4944 * @param ctx Read / write interface definitions.(ptr)
4945 * @param val Change the values of pp_od in reg CTRL3_C
4946 * @retval Interface status (MANDATORY: return 0 -> no Error).
4947 *
4948 */
4951{
4952 ism330dhcx_ctrl3_c_t ctrl3_c;
4953 int32_t ret;
4955 (uint8_t *)&ctrl3_c, 1);
4956
4957 if (ret == 0)
4958 {
4959 ctrl3_c.pp_od = (uint8_t)val;
4961 (uint8_t *)&ctrl3_c, 1);
4962 }
4963
4964 return ret;
4965}
4966
4967/**
4968 * @brief Push-pull/open drain selection on interrupt pads.[get]
4969 *
4970 * @param ctx Read / write interface definitions.(ptr)
4971 * @param val Get the values of pp_od in reg CTRL3_C
4972 * @retval Interface status (MANDATORY: return 0 -> no Error).
4973 *
4974 */
4976 ism330dhcx_pp_od_t *val)
4977{
4978 ism330dhcx_ctrl3_c_t ctrl3_c;
4979 int32_t ret;
4981 (uint8_t *)&ctrl3_c, 1);
4982
4983 switch (ctrl3_c.pp_od)
4984 {
4986 *val = ISM330DHCX_PUSH_PULL;
4987 break;
4988
4990 *val = ISM330DHCX_OPEN_DRAIN;
4991 break;
4992
4993 default:
4994 *val = ISM330DHCX_PUSH_PULL;
4995 break;
4996 }
4997
4998 return ret;
4999}
5000
5001/**
5002 * @brief Interrupt active-high/low.[set]
5003 *
5004 * @param ctx Read / write interface definitions.(ptr)
5005 * @param val Change the values of h_lactive in reg CTRL3_C
5006 * @retval Interface status (MANDATORY: return 0 -> no Error).
5007 *
5008 */
5011{
5012 ism330dhcx_ctrl3_c_t ctrl3_c;
5013 int32_t ret;
5015 (uint8_t *)&ctrl3_c, 1);
5016
5017 if (ret == 0)
5018 {
5019 ctrl3_c.h_lactive = (uint8_t)val;
5021 (uint8_t *)&ctrl3_c, 1);
5022 }
5023
5024 return ret;
5025}
5026
5027/**
5028 * @brief Interrupt active-high/low.[get]
5029 *
5030 * @param ctx Read / write interface definitions.(ptr)
5031 * @param val Get the values of h_lactive in reg CTRL3_C
5032 * @retval Interface status (MANDATORY: return 0 -> no Error).
5033 *
5034 */
5037{
5038 ism330dhcx_ctrl3_c_t ctrl3_c;
5039 int32_t ret;
5041 (uint8_t *)&ctrl3_c, 1);
5042
5043 switch (ctrl3_c.h_lactive)
5044 {
5047 break;
5048
5050 *val = ISM330DHCX_ACTIVE_LOW;
5051 break;
5052
5053 default:
5055 break;
5056 }
5057
5058 return ret;
5059}
5060
5061/**
5062 * @brief All interrupt signals become available on INT1 pin.[set]
5063 *
5064 * @param ctx Read / write interface definitions.(ptr)
5065 * @param val Change the values of int2_on_int1 in reg CTRL4_C
5066 * @retval Interface status (MANDATORY: return 0 -> no Error).
5067 *
5068 */
5070{
5071 ism330dhcx_ctrl4_c_t ctrl4_c;
5072 int32_t ret;
5074 (uint8_t *)&ctrl4_c, 1);
5075
5076 if (ret == 0)
5077 {
5078 ctrl4_c.int2_on_int1 = (uint8_t)val;
5080 (uint8_t *)&ctrl4_c, 1);
5081 }
5082
5083 return ret;
5084}
5085
5086/**
5087 * @brief All interrupt signals become available on INT1 pin.[get]
5088 *
5089 * @param ctx Read / write interface definitions.(ptr)
5090 * @param val Change the values of int2_on_int1 in reg CTRL4_C
5091 * @retval Interface status (MANDATORY: return 0 -> no Error).
5092 *
5093 */
5094int32_t ism330dhcx_all_on_int1_get(stmdev_ctx_t *ctx, uint8_t *val)
5095{
5096 ism330dhcx_ctrl4_c_t ctrl4_c;
5097 int32_t ret;
5099 (uint8_t *)&ctrl4_c, 1);
5100 *val = ctrl4_c.int2_on_int1;
5101
5102 return ret;
5103}
5104
5105/**
5106 * @brief All interrupt signals notification mode.[set]
5107 *
5108 * @param ctx Read / write interface definitions.(ptr)
5109 * @param val Change the values of lir in reg TAP_CFG0
5110 * @retval Interface status (MANDATORY: return 0 -> no Error).
5111 *
5112 */
5114 ism330dhcx_lir_t val)
5115{
5116 ism330dhcx_tap_cfg0_t tap_cfg0;
5117 ism330dhcx_page_rw_t page_rw;
5118 int32_t ret;
5120 (uint8_t *)&tap_cfg0, 1);
5121
5122 if (ret == 0)
5123 {
5124 tap_cfg0.lir = (uint8_t)val & 0x01U;
5125 tap_cfg0.int_clr_on_read = (uint8_t)val & 0x01U;
5127 (uint8_t *)&tap_cfg0, 1);
5128 }
5129
5130 if (ret == 0)
5131 {
5133 }
5134
5135 if (ret == 0)
5136 {
5138 (uint8_t *)&page_rw, 1);
5139 }
5140
5141 if (ret == 0)
5142 {
5143 page_rw.emb_func_lir = ((uint8_t)val & 0x02U) >> 1;
5145 (uint8_t *)&page_rw, 1);
5146 }
5147
5148 if (ret == 0)
5149 {
5151 }
5152
5153 return ret;
5154}
5155
5156/**
5157 * @brief All interrupt signals notification mode.[get]
5158 *
5159 * @param ctx Read / write interface definitions.(ptr)
5160 * @param val Get the values of lir in reg TAP_CFG0
5161 * @retval Interface status (MANDATORY: return 0 -> no Error).
5162 *
5163 */
5165 ism330dhcx_lir_t *val)
5166{
5167 ism330dhcx_tap_cfg0_t tap_cfg0;
5168 ism330dhcx_page_rw_t page_rw;
5169 int32_t ret;
5172 (uint8_t *)&tap_cfg0, 1);
5173
5174 if (ret == 0)
5175 {
5177 }
5178
5179 if (ret == 0)
5180 {
5182 (uint8_t *)&page_rw, 1);
5183 }
5184
5185 if (ret == 0)
5186 {
5188 }
5189
5190 switch ((page_rw.emb_func_lir << 1) + tap_cfg0.lir)
5191 {
5194 break;
5195
5198 break;
5199
5202 break;
5203
5206 break;
5207
5208 default:
5210 break;
5211 }
5212
5213 return ret;
5214}
5215
5216/**
5217 * @}
5218 *
5219 */
5220
5221/**
5222 * @defgroup ISM330DHCX_Wake_Up_event
5223 * @brief This section groups all the functions that manage the
5224 * Wake Up event generation.
5225 * @{
5226 *
5227 */
5228
5229/**
5230 * @brief Weight of 1 LSB of wakeup threshold.[set]
5231 * 0: 1 LSB =FS_XL / 64
5232 * 1: 1 LSB = FS_XL / 256
5233 *
5234 * @param ctx Read / write interface definitions.(ptr)
5235 * @param val Change the values of wake_ths_w in reg WAKE_UP_DUR
5236 * @retval Interface status (MANDATORY: return 0 -> no Error).
5237 *
5238 */
5241{
5242 ism330dhcx_wake_up_dur_t wake_up_dur;
5243 int32_t ret;
5245 (uint8_t *)&wake_up_dur, 1);
5246
5247 if (ret == 0)
5248 {
5249 wake_up_dur.wake_ths_w = (uint8_t)val;
5251 (uint8_t *)&wake_up_dur, 1);
5252 }
5253
5254 return ret;
5255}
5256
5257/**
5258 * @brief Weight of 1 LSB of wakeup threshold.[get]
5259 * 0: 1 LSB =FS_XL / 64
5260 * 1: 1 LSB = FS_XL / 256
5261 *
5262 * @param ctx Read / write interface definitions.(ptr)
5263 * @param val Get the values of wake_ths_w in reg WAKE_UP_DUR
5264 * @retval Interface status (MANDATORY: return 0 -> no Error).
5265 *
5266 */
5269{
5270 ism330dhcx_wake_up_dur_t wake_up_dur;
5271 int32_t ret;
5273 (uint8_t *)&wake_up_dur, 1);
5274
5275 switch (wake_up_dur.wake_ths_w)
5276 {
5279 break;
5280
5283 break;
5284
5285 default:
5287 break;
5288 }
5289
5290 return ret;
5291}
5292
5293/**
5294 * @brief Threshold for wakeup: 1 LSB weight depends on WAKE_THS_W in
5295 * WAKE_UP_DUR.[set]
5296 *
5297 * @param ctx Read / write interface definitions.(ptr)
5298 * @param val Change the values of wk_ths in reg WAKE_UP_THS
5299 * @retval Interface status (MANDATORY: return 0 -> no Error).
5300 *
5301 */
5303{
5304 ism330dhcx_wake_up_ths_t wake_up_ths;
5305 int32_t ret;
5307 (uint8_t *)&wake_up_ths, 1);
5308
5309 if (ret == 0)
5310 {
5311 wake_up_ths.wk_ths = (uint8_t)val;
5313 (uint8_t *)&wake_up_ths, 1);
5314 }
5315
5316 return ret;
5317}
5318
5319/**
5320 * @brief Threshold for wakeup: 1 LSB weight depends on WAKE_THS_W in
5321 * WAKE_UP_DUR.[get]
5322 *
5323 * @param ctx Read / write interface definitions.(ptr)
5324 * @param val Change the values of wk_ths in reg WAKE_UP_THS
5325 * @retval Interface status (MANDATORY: return 0 -> no Error).
5326 *
5327 */
5329{
5330 ism330dhcx_wake_up_ths_t wake_up_ths;
5331 int32_t ret;
5333 (uint8_t *)&wake_up_ths, 1);
5334 *val = wake_up_ths.wk_ths;
5335
5336 return ret;
5337}
5338
5339/**
5340 * @brief Wake up duration event( 1LSb = 1 / ODR ).[set]
5341 *
5342 * @param ctx Read / write interface definitions.(ptr)
5343 * @param val Change the values of usr_off_on_wu in reg WAKE_UP_THS
5344 * @retval Interface status (MANDATORY: return 0 -> no Error).
5345 *
5346 */
5348 uint8_t val)
5349{
5350 ism330dhcx_wake_up_ths_t wake_up_ths;
5351 int32_t ret;
5353 (uint8_t *)&wake_up_ths, 1);
5354
5355 if (ret == 0)
5356 {
5357 wake_up_ths.usr_off_on_wu = (uint8_t)val;
5359 (uint8_t *)&wake_up_ths, 1);
5360 }
5361
5362 return ret;
5363}
5364
5365/**
5366 * @brief Wake up duration event( 1LSb = 1 / ODR ).[get]
5367 *
5368 * @param ctx Read / write interface definitions.(ptr)
5369 * @param val Change the values of usr_off_on_wu in reg WAKE_UP_THS
5370 * @retval Interface status (MANDATORY: return 0 -> no Error).
5371 *
5372 */
5374 uint8_t *val)
5375{
5376 ism330dhcx_wake_up_ths_t wake_up_ths;
5377 int32_t ret;
5379 (uint8_t *)&wake_up_ths, 1);
5380 *val = wake_up_ths.usr_off_on_wu;
5381
5382 return ret;
5383}
5384
5385/**
5386 * @brief Wake up duration event(1LSb = 1 / ODR).[set]
5387 *
5388 * @param ctx Read / write interface definitions.(ptr)
5389 * @param val Change the values of wake_dur in reg WAKE_UP_DUR
5390 * @retval Interface status (MANDATORY: return 0 -> no Error).
5391 *
5392 */
5393int32_t ism330dhcx_wkup_dur_set(stmdev_ctx_t *ctx, uint8_t val)
5394{
5395 ism330dhcx_wake_up_dur_t wake_up_dur;
5396 int32_t ret;
5398 (uint8_t *)&wake_up_dur, 1);
5399
5400 if (ret == 0)
5401 {
5402 wake_up_dur.wake_dur = (uint8_t)val;
5404 (uint8_t *)&wake_up_dur, 1);
5405 }
5406
5407 return ret;
5408}
5409
5410/**
5411 * @brief Wake up duration event(1LSb = 1 / ODR).[get]
5412 *
5413 * @param ctx Read / write interface definitions.(ptr)
5414 * @param val Change the values of wake_dur in reg WAKE_UP_DUR
5415 * @retval Interface status (MANDATORY: return 0 -> no Error).
5416 *
5417 */
5418int32_t ism330dhcx_wkup_dur_get(stmdev_ctx_t *ctx, uint8_t *val)
5419{
5420 ism330dhcx_wake_up_dur_t wake_up_dur;
5421 int32_t ret;
5423 (uint8_t *)&wake_up_dur, 1);
5424 *val = wake_up_dur.wake_dur;
5425
5426 return ret;
5427}
5428
5429/**
5430 * @}
5431 *
5432 */
5433
5434/**
5435 * @defgroup ISM330DHCX_ Activity/Inactivity_detection
5436 * @brief This section groups all the functions concerning
5437 * activity/inactivity detection.
5438 * @{
5439 *
5440 */
5441
5442/**
5443 * @brief Enables gyroscope Sleep mode.[set]
5444 *
5445 * @param ctx Read / write interface definitions.(ptr)
5446 * @param val Change the values of sleep_g in reg CTRL4_C
5447 * @retval Interface status (MANDATORY: return 0 -> no Error).
5448 *
5449 */
5451{
5452 ism330dhcx_ctrl4_c_t ctrl4_c;
5453 int32_t ret;
5455 (uint8_t *)&ctrl4_c, 1);
5456
5457 if (ret == 0)
5458 {
5459 ctrl4_c.sleep_g = (uint8_t)val;
5461 (uint8_t *)&ctrl4_c, 1);
5462 }
5463
5464 return ret;
5465}
5466
5467/**
5468 * @brief Enables gyroscope Sleep mode.[get]
5469 *
5470 * @param ctx Read / write interface definitions.(ptr)
5471 * @param val Change the values of sleep_g in reg CTRL4_C
5472 * @retval Interface status (MANDATORY: return 0 -> no Error).
5473 *
5474 */
5476{
5477 ism330dhcx_ctrl4_c_t ctrl4_c;
5478 int32_t ret;
5480 (uint8_t *)&ctrl4_c, 1);
5481 *val = ctrl4_c.sleep_g;
5482
5483 return ret;
5484}
5485
5486/**
5487 * @brief Drives the sleep status instead of sleep change on INT pins
5488 * (only if INT1_SLEEP_CHANGE or INT2_SLEEP_CHANGE bits
5489 * are enabled).[set]
5490 *
5491 * @param ctx Read / write interface definitions.(ptr)
5492 * @param val Change the values of sleep_status_on_int in reg TAP_CFG0
5493 * @retval Interface status (MANDATORY: return 0 -> no Error).
5494 *
5495 */
5498{
5499 ism330dhcx_tap_cfg0_t tap_cfg0;
5500 int32_t ret;
5502 (uint8_t *)&tap_cfg0, 1);
5503
5504 if (ret == 0)
5505 {
5506 tap_cfg0. sleep_status_on_int = (uint8_t)val;
5508 (uint8_t *)&tap_cfg0, 1);
5509 }
5510
5511 return ret;
5512}
5513
5514/**
5515 * @brief Drives the sleep status instead of sleep change on INT pins
5516 * (only if INT1_SLEEP_CHANGE or INT2_SLEEP_CHANGE bits
5517 * are enabled).[get]
5518 *
5519 * @param ctx Read / write interface definitions.(ptr)
5520 * @param val Get the values of sleep_status_on_int in reg TAP_CFG0
5521 * @retval Interface status (MANDATORY: return 0 -> no Error).
5522 *
5523 */
5526{
5527 ism330dhcx_tap_cfg0_t tap_cfg0;
5528 int32_t ret;
5530 (uint8_t *)&tap_cfg0, 1);
5531
5532 switch (tap_cfg0. sleep_status_on_int)
5533 {
5536 break;
5537
5540 break;
5541
5542 default:
5544 break;
5545 }
5546
5547 return ret;
5548}
5549
5550/**
5551 * @brief Enable inactivity function.[set]
5552 *
5553 * @param ctx Read / write interface definitions.(ptr)
5554 * @param val Change the values of inact_en in reg TAP_CFG2
5555 * @retval Interface status (MANDATORY: return 0 -> no Error).
5556 *
5557 */
5560{
5561 ism330dhcx_tap_cfg2_t tap_cfg2;
5562 int32_t ret;
5564 (uint8_t *)&tap_cfg2, 1);
5565
5566 if (ret == 0)
5567 {
5568 tap_cfg2.inact_en = (uint8_t)val;
5570 (uint8_t *)&tap_cfg2, 1);
5571 }
5572
5573 return ret;
5574}
5575
5576/**
5577 * @brief Enable inactivity function.[get]
5578 *
5579 * @param ctx Read / write interface definitions.(ptr)
5580 * @param val Get the values of inact_en in reg TAP_CFG2
5581 * @retval Interface status (MANDATORY: return 0 -> no Error).
5582 *
5583 */
5586{
5587 ism330dhcx_tap_cfg2_t tap_cfg2;
5588 int32_t ret;
5590 (uint8_t *)&tap_cfg2, 1);
5591
5592 switch (tap_cfg2.inact_en)
5593 {
5596 break;
5597
5600 break;
5601
5604 break;
5605
5608 break;
5609
5610 default:
5612 break;
5613 }
5614
5615 return ret;
5616}
5617
5618/**
5619 * @brief Duration to go in sleep mode (1 LSb = 512 / ODR).[set]
5620 *
5621 * @param ctx Read / write interface definitions.(ptr)
5622 * @param val Change the values of sleep_dur in reg WAKE_UP_DUR
5623 * @retval Interface status (MANDATORY: return 0 -> no Error).
5624 *
5625 */
5627{
5628 ism330dhcx_wake_up_dur_t wake_up_dur;
5629 int32_t ret;
5631 (uint8_t *)&wake_up_dur, 1);
5632
5633 if (ret == 0)
5634 {
5635 wake_up_dur.sleep_dur = (uint8_t)val;
5637 (uint8_t *)&wake_up_dur, 1);
5638 }
5639
5640 return ret;
5641}
5642
5643/**
5644 * @brief Duration to go in sleep mode.(1 LSb = 512 / ODR).[get]
5645 *
5646 * @param ctx Read / write interface definitions.(ptr)
5647 * @param val Change the values of sleep_dur in reg WAKE_UP_DUR
5648 * @retval Interface status (MANDATORY: return 0 -> no Error).
5649 *
5650 */
5652{
5653 ism330dhcx_wake_up_dur_t wake_up_dur;
5654 int32_t ret;
5656 (uint8_t *)&wake_up_dur, 1);
5657 *val = wake_up_dur.sleep_dur;
5658
5659 return ret;
5660}
5661
5662/**
5663 * @}
5664 *
5665 */
5666
5667/**
5668 * @defgroup ISM330DHCX_tap_generator
5669 * @brief This section groups all the functions that manage the
5670 * tap and double tap event generation.
5671 * @{
5672 *
5673 */
5674
5675/**
5676 * @brief Enable Z direction in tap recognition.[set]
5677 *
5678 * @param ctx Read / write interface definitions.(ptr)
5679 * @param val Change the values of tap_z_en in reg TAP_CFG0
5680 * @retval Interface status (MANDATORY: return 0 -> no Error).
5681 *
5682 */
5684 uint8_t val)
5685{
5686 ism330dhcx_tap_cfg0_t tap_cfg0;
5687 int32_t ret;
5689 (uint8_t *)&tap_cfg0, 1);
5690
5691 if (ret == 0)
5692 {
5693 tap_cfg0.tap_z_en = (uint8_t)val;
5695 (uint8_t *)&tap_cfg0, 1);
5696 }
5697
5698 return ret;
5699}
5700
5701/**
5702 * @brief Enable Z direction in tap recognition.[get]
5703 *
5704 * @param ctx Read / write interface definitions.(ptr)
5705 * @param val Change the values of tap_z_en in reg TAP_CFG0
5706 * @retval Interface status (MANDATORY: return 0 -> no Error).
5707 *
5708 */
5710 uint8_t *val)
5711{
5712 ism330dhcx_tap_cfg0_t tap_cfg0;
5713 int32_t ret;
5715 (uint8_t *)&tap_cfg0, 1);
5716 *val = tap_cfg0.tap_z_en;
5717
5718 return ret;
5719}
5720
5721/**
5722 * @brief Enable Y direction in tap recognition.[set]
5723 *
5724 * @param ctx Read / write interface definitions.(ptr)
5725 * @param val Change the values of tap_y_en in reg TAP_CFG0
5726 * @retval Interface status (MANDATORY: return 0 -> no Error).
5727 *
5728 */
5730 uint8_t val)
5731{
5732 ism330dhcx_tap_cfg0_t tap_cfg0;
5733 int32_t ret;
5735 (uint8_t *)&tap_cfg0, 1);
5736
5737 if (ret == 0)
5738 {
5739 tap_cfg0.tap_y_en = (uint8_t)val;
5741 (uint8_t *)&tap_cfg0, 1);
5742 }
5743
5744 return ret;
5745}
5746
5747/**
5748 * @brief Enable Y direction in tap recognition.[get]
5749 *
5750 * @param ctx Read / write interface definitions.(ptr)
5751 * @param val Change the values of tap_y_en in reg TAP_CFG0
5752 * @retval Interface status (MANDATORY: return 0 -> no Error).
5753 *
5754 */
5756 uint8_t *val)
5757{
5758 ism330dhcx_tap_cfg0_t tap_cfg0;
5759 int32_t ret;
5761 (uint8_t *)&tap_cfg0, 1);
5762 *val = tap_cfg0.tap_y_en;
5763
5764 return ret;
5765}
5766
5767/**
5768 * @brief Enable X direction in tap recognition.[set]
5769 *
5770 * @param ctx Read / write interface definitions.(ptr)
5771 * @param val Change the values of tap_x_en in reg TAP_CFG0
5772 * @retval Interface status (MANDATORY: return 0 -> no Error).
5773 *
5774 */
5776 uint8_t val)
5777{
5778 ism330dhcx_tap_cfg0_t tap_cfg0;
5779 int32_t ret;
5781 (uint8_t *)&tap_cfg0, 1);
5782
5783 if (ret == 0)
5784 {
5785 tap_cfg0.tap_x_en = (uint8_t)val;
5787 (uint8_t *)&tap_cfg0, 1);
5788 }
5789
5790 return ret;
5791}
5792
5793/**
5794 * @brief Enable X direction in tap recognition.[get]
5795 *
5796 * @param ctx Read / write interface definitions.(ptr)
5797 * @param val Change the values of tap_x_en in reg TAP_CFG0
5798 * @retval Interface status (MANDATORY: return 0 -> no Error).
5799 *
5800 */
5802 uint8_t *val)
5803{
5804 ism330dhcx_tap_cfg0_t tap_cfg0;
5805 int32_t ret;
5807 (uint8_t *)&tap_cfg0, 1);
5808 *val = tap_cfg0.tap_x_en;
5809
5810 return ret;
5811}
5812
5813/**
5814 * @brief X-axis tap recognition threshold.[set]
5815 *
5816 * @param ctx Read / write interface definitions.(ptr)
5817 * @param val Change the values of tap_ths_x in reg TAP_CFG1
5818 * @retval Interface status (MANDATORY: return 0 -> no Error).
5819 *
5820 */
5822{
5823 ism330dhcx_tap_cfg1_t tap_cfg1;
5824 int32_t ret;
5826 (uint8_t *)&tap_cfg1, 1);
5827
5828 if (ret == 0)
5829 {
5830 tap_cfg1.tap_ths_x = (uint8_t)val;
5832 (uint8_t *)&tap_cfg1, 1);
5833 }
5834
5835 return ret;
5836}
5837
5838/**
5839 * @brief X-axis tap recognition threshold.[get]
5840 *
5841 * @param ctx Read / write interface definitions.(ptr)
5842 * @param val Change the values of tap_ths_x in reg TAP_CFG1
5843 * @retval Interface status (MANDATORY: return 0 -> no Error).
5844 *
5845 */
5847 uint8_t *val)
5848{
5849 ism330dhcx_tap_cfg1_t tap_cfg1;
5850 int32_t ret;
5852 (uint8_t *)&tap_cfg1, 1);
5853 *val = tap_cfg1.tap_ths_x;
5854
5855 return ret;
5856}
5857
5858/**
5859 * @brief Selection of axis priority for TAP detection.[set]
5860 *
5861 * @param ctx Read / write interface definitions.(ptr)
5862 * @param val Change the values of tap_priority in reg TAP_CFG1
5863 * @retval Interface status (MANDATORY: return 0 -> no Error).
5864 *
5865 */
5868{
5869 ism330dhcx_tap_cfg1_t tap_cfg1;
5870 int32_t ret;
5872 (uint8_t *)&tap_cfg1, 1);
5873
5874 if (ret == 0)
5875 {
5876 tap_cfg1.tap_priority = (uint8_t)val;
5878 (uint8_t *)&tap_cfg1, 1);
5879 }
5880
5881 return ret;
5882}
5883
5884/**
5885 * @brief Selection of axis priority for TAP detection[get]
5886 *
5887 * @param ctx Read / write interface definitions.(ptr)
5888 * @param val Get the values of tap_priority in reg TAP_CFG1
5889 * @retval Interface status (MANDATORY: return 0 -> no Error).
5890 *
5891 */
5894{
5895 ism330dhcx_tap_cfg1_t tap_cfg1;
5896 int32_t ret;
5898 (uint8_t *)&tap_cfg1, 1);
5899
5900 switch (tap_cfg1.tap_priority)
5901 {
5902 case ISM330DHCX_XYZ:
5903 *val = ISM330DHCX_XYZ;
5904 break;
5905
5906 case ISM330DHCX_YXZ:
5907 *val = ISM330DHCX_YXZ;
5908 break;
5909
5910 case ISM330DHCX_XZY:
5911 *val = ISM330DHCX_XZY;
5912 break;
5913
5914 case ISM330DHCX_ZYX:
5915 *val = ISM330DHCX_ZYX;
5916 break;
5917
5918 case ISM330DHCX_YZX:
5919 *val = ISM330DHCX_YZX;
5920 break;
5921
5922 case ISM330DHCX_ZXY:
5923 *val = ISM330DHCX_ZXY;
5924 break;
5925
5926 default:
5927 *val = ISM330DHCX_XYZ;
5928 break;
5929 }
5930
5931 return ret;
5932}
5933
5934/**
5935 * @brief Y-axis tap recognition threshold.[set]
5936 *
5937 * @param ctx Read / write interface definitions.(ptr)
5938 * @param val Change the values of tap_ths_y in reg TAP_CFG2
5939 * @retval Interface status (MANDATORY: return 0 -> no Error).
5940 *
5941 */
5943{
5944 ism330dhcx_tap_cfg2_t tap_cfg2;
5945 int32_t ret;
5947 (uint8_t *)&tap_cfg2, 1);
5948
5949 if (ret == 0)
5950 {
5951 tap_cfg2.tap_ths_y = (uint8_t)val;
5953 (uint8_t *)&tap_cfg2, 1);
5954 }
5955
5956 return ret;
5957}
5958
5959/**
5960 * @brief Y-axis tap recognition threshold.[get]
5961 *
5962 * @param ctx Read / write interface definitions.(ptr)
5963 * @param val Change the values of tap_ths_y in reg TAP_CFG2
5964 * @retval Interface status (MANDATORY: return 0 -> no Error).
5965 *
5966 */
5968 uint8_t *val)
5969{
5970 ism330dhcx_tap_cfg2_t tap_cfg2;
5971 int32_t ret;
5973 (uint8_t *)&tap_cfg2, 1);
5974 *val = tap_cfg2.tap_ths_y;
5975
5976 return ret;
5977}
5978
5979/**
5980 * @brief Z-axis recognition threshold.[set]
5981 *
5982 * @param ctx Read / write interface definitions.(ptr)
5983 * @param val Change the values of tap_ths_z in reg TAP_THS_6D
5984 * @retval Interface status (MANDATORY: return 0 -> no Error).
5985 *
5986 */
5988{
5989 ism330dhcx_tap_ths_6d_t tap_ths_6d;
5990 int32_t ret;
5992 (uint8_t *)&tap_ths_6d, 1);
5993
5994 if (ret == 0)
5995 {
5996 tap_ths_6d.tap_ths_z = (uint8_t)val;
5998 (uint8_t *)&tap_ths_6d, 1);
5999 }
6000
6001 return ret;
6002}
6003
6004/**
6005 * @brief Z-axis recognition threshold.[get]
6006 *
6007 * @param ctx Read / write interface definitions.(ptr)
6008 * @param val Change the values of tap_ths_z in reg TAP_THS_6D
6009 * @retval Interface status (MANDATORY: return 0 -> no Error).
6010 *
6011 */
6013 uint8_t *val)
6014{
6015 ism330dhcx_tap_ths_6d_t tap_ths_6d;
6016 int32_t ret;
6018 (uint8_t *)&tap_ths_6d, 1);
6019 *val = tap_ths_6d.tap_ths_z;
6020
6021 return ret;
6022}
6023
6024/**
6025 * @brief Maximum duration is the maximum time of an overthreshold signal
6026 * detection to be recognized as a tap event. The default value of
6027 * these bits is 00b which corresponds to 4*ODR_XL time.
6028 * If the SHOCK[1:0] bits are set to a different value, 1LSB
6029 * corresponds to 8*ODR_XL time.[set]
6030 *
6031 * @param ctx Read / write interface definitions.(ptr)
6032 * @param val Change the values of shock in reg INT_DUR2
6033 * @retval Interface status (MANDATORY: return 0 -> no Error).
6034 *
6035 */
6036int32_t ism330dhcx_tap_shock_set(stmdev_ctx_t *ctx, uint8_t val)
6037{
6038 ism330dhcx_int_dur2_t int_dur2;
6039 int32_t ret;
6041 (uint8_t *)&int_dur2, 1);
6042
6043 if (ret == 0)
6044 {
6045 int_dur2.shock = (uint8_t)val;
6047 (uint8_t *)&int_dur2, 1);
6048 }
6049
6050 return ret;
6051}
6052
6053/**
6054 * @brief Maximum duration is the maximum time of an overthreshold signal
6055 * detection to be recognized as a tap event. The default value of
6056 * these bits is 00b which corresponds to 4*ODR_XL time.
6057 * If the SHOCK[1:0] bits are set to a different value, 1LSB
6058 * corresponds to 8*ODR_XL time.[get]
6059 *
6060 * @param ctx Read / write interface definitions.(ptr)
6061 * @param val Change the values of shock in reg INT_DUR2
6062 * @retval Interface status (MANDATORY: return 0 -> no Error).
6063 *
6064 */
6065int32_t ism330dhcx_tap_shock_get(stmdev_ctx_t *ctx, uint8_t *val)
6066{
6067 ism330dhcx_int_dur2_t int_dur2;
6068 int32_t ret;
6070 (uint8_t *)&int_dur2, 1);
6071 *val = int_dur2.shock;
6072
6073 return ret;
6074}
6075
6076/**
6077 * @brief Quiet time is the time after the first detected tap in which
6078 * there must not be any overthreshold event.
6079 * The default value of these bits is 00b which corresponds to
6080 * 2*ODR_XL time. If the QUIET[1:0] bits are set to a different
6081 * value, 1LSB corresponds to 4*ODR_XL time.[set]
6082 *
6083 * @param ctx Read / write interface definitions.(ptr)
6084 * @param val Change the values of quiet in reg INT_DUR2
6085 * @retval Interface status (MANDATORY: return 0 -> no Error).
6086 *
6087 */
6088int32_t ism330dhcx_tap_quiet_set(stmdev_ctx_t *ctx, uint8_t val)
6089{
6090 ism330dhcx_int_dur2_t int_dur2;
6091 int32_t ret;
6093 (uint8_t *)&int_dur2, 1);
6094
6095 if (ret == 0)
6096 {
6097 int_dur2.quiet = (uint8_t)val;
6099 (uint8_t *)&int_dur2, 1);
6100 }
6101
6102 return ret;
6103}
6104
6105/**
6106 * @brief Quiet time is the time after the first detected tap in which
6107 * there must not be any overthreshold event.
6108 * The default value of these bits is 00b which corresponds to
6109 * 2*ODR_XL time. If the QUIET[1:0] bits are set to a different
6110 * value, 1LSB corresponds to 4*ODR_XL time.[get]
6111 *
6112 * @param ctx Read / write interface definitions.(ptr)
6113 * @param val Change the values of quiet in reg INT_DUR2
6114 * @retval Interface status (MANDATORY: return 0 -> no Error).
6115 *
6116 */
6117int32_t ism330dhcx_tap_quiet_get(stmdev_ctx_t *ctx, uint8_t *val)
6118{
6119 ism330dhcx_int_dur2_t int_dur2;
6120 int32_t ret;
6122 (uint8_t *)&int_dur2, 1);
6123 *val = int_dur2.quiet;
6124
6125 return ret;
6126}
6127
6128/**
6129 * @brief When double tap recognition is enabled, this register expresses
6130 * the maximum time between two consecutive detected taps to
6131 * determine a double tap event.
6132 * The default value of these bits is 0000b which corresponds to
6133 * 16*ODR_XL time.
6134 * If the DUR[3:0] bits are set to a different value, 1LSB
6135 * corresponds to 32*ODR_XL time.[set]
6136 *
6137 * @param ctx Read / write interface definitions.(ptr)
6138 * @param val Change the values of dur in reg INT_DUR2
6139 * @retval Interface status (MANDATORY: return 0 -> no Error).
6140 *
6141 */
6142int32_t ism330dhcx_tap_dur_set(stmdev_ctx_t *ctx, uint8_t val)
6143{
6144 ism330dhcx_int_dur2_t int_dur2;
6145 int32_t ret;
6147 (uint8_t *)&int_dur2, 1);
6148
6149 if (ret == 0)
6150 {
6151 int_dur2.dur = (uint8_t)val;
6153 (uint8_t *)&int_dur2, 1);
6154 }
6155
6156 return ret;
6157}
6158
6159/**
6160 * @brief When double tap recognition is enabled, this register expresses the
6161 * maximum time between two consecutive detected taps to determine
6162 * a double tap event. The default value of these bits is 0000b which
6163 * corresponds to 16*ODR_XL time. If the DUR[3:0] bits are set to
6164 * a different value, 1LSB corresponds to 32*ODR_XL time.[get]
6165 *
6166 * @param ctx Read / write interface definitions.(ptr)
6167 * @param val Change the values of dur in reg INT_DUR2
6168 * @retval Interface status (MANDATORY: return 0 -> no Error).
6169 *
6170 */
6171int32_t ism330dhcx_tap_dur_get(stmdev_ctx_t *ctx, uint8_t *val)
6172{
6173 ism330dhcx_int_dur2_t int_dur2;
6174 int32_t ret;
6176 (uint8_t *)&int_dur2, 1);
6177 *val = int_dur2.dur;
6178
6179 return ret;
6180}
6181
6182/**
6183 * @brief Single/double-tap event enable.[set]
6184 *
6185 * @param ctx Read / write interface definitions.(ptr)
6186 * @param val Change the values of single_double_tap in reg WAKE_UP_THS
6187 * @retval Interface status (MANDATORY: return 0 -> no Error).
6188 *
6189 */
6192{
6193 ism330dhcx_wake_up_ths_t wake_up_ths;
6194 int32_t ret;
6196 (uint8_t *)&wake_up_ths, 1);
6197
6198 if (ret == 0)
6199 {
6200 wake_up_ths.single_double_tap = (uint8_t)val;
6202 (uint8_t *)&wake_up_ths, 1);
6203 }
6204
6205 return ret;
6206}
6207
6208/**
6209 * @brief Single/double-tap event enable.[get]
6210 *
6211 * @param ctx Read / write interface definitions.(ptr)
6212 * @param val Get the values of single_double_tap in reg WAKE_UP_THS
6213 * @retval Interface status (MANDATORY: return 0 -> no Error).
6214 *
6215 */
6218{
6219 ism330dhcx_wake_up_ths_t wake_up_ths;
6220 int32_t ret;
6222 (uint8_t *)&wake_up_ths, 1);
6223
6224 switch (wake_up_ths.single_double_tap)
6225 {
6228 break;
6229
6232 break;
6233
6234 default:
6236 break;
6237 }
6238
6239 return ret;
6240}
6241
6242/**
6243 * @}
6244 *
6245 */
6246
6247/**
6248 * @defgroup ISM330DHCX_ Six_position_detection(6D/4D)
6249 * @brief This section groups all the functions concerning six
6250 * position detection (6D).
6251 * @{
6252 *
6253 */
6254
6255/**
6256 * @brief Threshold for 4D/6D function.[set]
6257 *
6258 * @param ctx Read / write interface definitions.(ptr)
6259 * @param val Change the values of sixd_ths in reg TAP_THS_6D
6260 * @retval Interface status (MANDATORY: return 0 -> no Error).
6261 *
6262 */
6265{
6266 ism330dhcx_tap_ths_6d_t tap_ths_6d;
6267 int32_t ret;
6269 (uint8_t *)&tap_ths_6d, 1);
6270
6271 if (ret == 0)
6272 {
6273 tap_ths_6d.sixd_ths = (uint8_t)val;
6275 (uint8_t *)&tap_ths_6d, 1);
6276 }
6277
6278 return ret;
6279}
6280
6281/**
6282 * @brief Threshold for 4D/6D function.[get]
6283 *
6284 * @param ctx Read / write interface definitions.(ptr)
6285 * @param val Get the values of sixd_ths in reg TAP_THS_6D
6286 * @retval Interface status (MANDATORY: return 0 -> no Error).
6287 *
6288 */
6291{
6292 ism330dhcx_tap_ths_6d_t tap_ths_6d;
6293 int32_t ret;
6295 (uint8_t *)&tap_ths_6d, 1);
6296
6297 switch (tap_ths_6d.sixd_ths)
6298 {
6299 case ISM330DHCX_DEG_80:
6300 *val = ISM330DHCX_DEG_80;
6301 break;
6302
6303 case ISM330DHCX_DEG_70:
6304 *val = ISM330DHCX_DEG_70;
6305 break;
6306
6307 case ISM330DHCX_DEG_60:
6308 *val = ISM330DHCX_DEG_60;
6309 break;
6310
6311 case ISM330DHCX_DEG_50:
6312 *val = ISM330DHCX_DEG_50;
6313 break;
6314
6315 default:
6316 *val = ISM330DHCX_DEG_80;
6317 break;
6318 }
6319
6320 return ret;
6321}
6322
6323/**
6324 * @brief 4D orientation detection enable.[set]
6325 *
6326 * @param ctx Read / write interface definitions.(ptr)
6327 * @param val Change the values of d4d_en in reg TAP_THS_6D
6328 * @retval Interface status (MANDATORY: return 0 -> no Error).
6329 *
6330 */
6331int32_t ism330dhcx_4d_mode_set(stmdev_ctx_t *ctx, uint8_t val)
6332{
6333 ism330dhcx_tap_ths_6d_t tap_ths_6d;
6334 int32_t ret;
6336 (uint8_t *)&tap_ths_6d, 1);
6337
6338 if (ret == 0)
6339 {
6340 tap_ths_6d.d4d_en = (uint8_t)val;
6342 (uint8_t *)&tap_ths_6d, 1);
6343 }
6344
6345 return ret;
6346}
6347
6348/**
6349 * @brief 4D orientation detection enable.[get]
6350 *
6351 * @param ctx Read / write interface definitions.(ptr)
6352 * @param val Change the values of d4d_en in reg TAP_THS_6D
6353 * @retval Interface status (MANDATORY: return 0 -> no Error).
6354 *
6355 */
6356int32_t ism330dhcx_4d_mode_get(stmdev_ctx_t *ctx, uint8_t *val)
6357{
6358 ism330dhcx_tap_ths_6d_t tap_ths_6d;
6359 int32_t ret;
6361 (uint8_t *)&tap_ths_6d, 1);
6362 *val = tap_ths_6d.d4d_en;
6363
6364 return ret;
6365}
6366
6367/**
6368 * @}
6369 *
6370 */
6371
6372/**
6373 * @defgroup ISM330DHCX_free_fall
6374 * @brief This section group all the functions concerning the free
6375 * fall detection.
6376 * @{
6377 *
6378 */
6379
6380/**
6381 * @brief Free fall threshold setting.[set]
6382 *
6383 * @param ctx Read / write interface definitions.(ptr)
6384 * @param val Change the values of ff_ths in reg FREE_FALL
6385 * @retval Interface status (MANDATORY: return 0 -> no Error).
6386 *
6387 */
6390{
6391 ism330dhcx_free_fall_t free_fall;
6392 int32_t ret;
6394 (uint8_t *)&free_fall, 1);
6395
6396 if (ret == 0)
6397 {
6398 free_fall.ff_ths = (uint8_t)val;
6400 (uint8_t *)&free_fall, 1);
6401 }
6402
6403 return ret;
6404}
6405
6406/**
6407 * @brief Free fall threshold setting.[get]
6408 *
6409 * @param ctx Read / write interface definitions.(ptr)
6410 * @param val Get the values of ff_ths in reg FREE_FALL
6411 * @retval Interface status (MANDATORY: return 0 -> no Error).
6412 *
6413 */
6416{
6417 ism330dhcx_free_fall_t free_fall;
6418 int32_t ret;
6420 (uint8_t *)&free_fall, 1);
6421
6422 switch (free_fall.ff_ths)
6423 {
6426 break;
6427
6430 break;
6431
6434 break;
6435
6438 break;
6439
6442 break;
6443
6446 break;
6447
6450 break;
6451
6454 break;
6455
6456 default:
6458 break;
6459 }
6460
6461 return ret;
6462}
6463
6464/**
6465 * @brief Free-fall duration event(1LSb = 1 / ODR).[set]
6466 *
6467 * @param ctx Read / write interface definitions.(ptr)
6468 * @param val Change the values of ff_dur in reg FREE_FALL
6469 * @retval Interface status (MANDATORY: return 0 -> no Error).
6470 *
6471 */
6472int32_t ism330dhcx_ff_dur_set(stmdev_ctx_t *ctx, uint8_t val)
6473{
6474 ism330dhcx_wake_up_dur_t wake_up_dur;
6475 ism330dhcx_free_fall_t free_fall;
6476 int32_t ret;
6478 (uint8_t *)&wake_up_dur, 1);
6479
6480 if (ret == 0)
6481 {
6482 wake_up_dur.ff_dur = (val & 0x20U) >> 5;
6484 (uint8_t *)&wake_up_dur, 1);
6485 }
6486
6487 if (ret == 0)
6488 {
6490 (uint8_t *)&free_fall, 1);
6491 }
6492
6493 if (ret == 0)
6494 {
6495 free_fall.ff_dur = val & 0x1FU;
6497 (uint8_t *)&free_fall, 1);
6498 }
6499
6500 return ret;
6501}
6502
6503/**
6504 * @brief Free-fall duration event(1LSb = 1 / ODR).[get]
6505 *
6506 * @param ctx Read / write interface definitions.(ptr)
6507 * @param val Change the values of ff_dur in reg FREE_FALL
6508 * @retval Interface status (MANDATORY: return 0 -> no Error).
6509 *
6510 */
6511int32_t ism330dhcx_ff_dur_get(stmdev_ctx_t *ctx, uint8_t *val)
6512{
6513 ism330dhcx_wake_up_dur_t wake_up_dur;
6514 ism330dhcx_free_fall_t free_fall;
6515 int32_t ret;
6517 (uint8_t *)&wake_up_dur, 1);
6518
6519 if (ret == 0)
6520 {
6522 (uint8_t *)&free_fall, 1);
6523 }
6524
6525 *val = (wake_up_dur.ff_dur << 5) + free_fall.ff_dur;
6526
6527 return ret;
6528}
6529
6530/**
6531 * @}
6532 *
6533 */
6534
6535/**
6536 * @defgroup ISM330DHCX_fifo
6537 * @brief This section group all the functions concerning
6538 * the fifo usage
6539 * @{
6540 *
6541 */
6542
6543/**
6544 * @brief FIFO watermark level selection.[set]
6545 *
6546 * @param ctx Read / write interface definitions.(ptr)
6547 * @param val Change the values of wtm in reg FIFO_CTRL1
6548 * @retval Interface status (MANDATORY: return 0 -> no Error).
6549 *
6550 */
6552{
6553 ism330dhcx_fifo_ctrl1_t fifo_ctrl1;
6554 ism330dhcx_fifo_ctrl2_t fifo_ctrl2;
6555 int32_t ret;
6557 (uint8_t *)&fifo_ctrl2, 1);
6558
6559 if (ret == 0)
6560 {
6561 fifo_ctrl2.wtm = (uint8_t)(val / 256U) & 0x01U;
6563 (uint8_t *)&fifo_ctrl2, 1);
6564 }
6565
6566 if (ret == 0)
6567 {
6568 fifo_ctrl1.wtm = (uint8_t)(val - (fifo_ctrl2.wtm * 256U));
6570 (uint8_t *)&fifo_ctrl1, 1);
6571 }
6572
6573 return ret;
6574}
6575
6576/**
6577 * @brief FIFO watermark level selection.[get]
6578 *
6579 * @param ctx Read / write interface definitions.(ptr)
6580 * @param val Change the values of wtm in reg FIFO_CTRL1
6581 * @retval Interface status (MANDATORY: return 0 -> no Error).
6582 *
6583 */
6585 uint16_t *val)
6586{
6587 ism330dhcx_fifo_ctrl1_t fifo_ctrl1;
6588 ism330dhcx_fifo_ctrl2_t fifo_ctrl2;
6589 int32_t ret;
6591 (uint8_t *)&fifo_ctrl2, 1);
6592
6593 if (ret == 0)
6594 {
6596 (uint8_t *)&fifo_ctrl1, 1);
6597 }
6598
6599 *val = fifo_ctrl2.wtm;
6600 *val = (*val * 256U) + fifo_ctrl1.wtm;;
6601
6602 return ret;
6603}
6604
6605/**
6606 * @brief FIFO compression feature initialization request.[set].
6607 *
6608 * @param ctx Read / write interface definitions.(ptr)
6609 * @param val Change the values of FIFO_COMPR_INIT in reg EMB_FUNC_INIT_B
6610 * @retval Interface status (MANDATORY: return 0 -> no Error).
6611 *
6612 */
6614 uint8_t val)
6615{
6616 ism330dhcx_emb_func_init_b_t emb_func_init_b;
6617 int32_t ret;
6619
6620 if (ret == 0)
6621 {
6623 (uint8_t *)&emb_func_init_b, 1);
6624 }
6625
6626 if (ret == 0)
6627 {
6628 emb_func_init_b.fifo_compr_init = (uint8_t)val;
6630 (uint8_t *)&emb_func_init_b, 1);
6631 }
6632
6633 if (ret == 0)
6634 {
6636 }
6637
6638 return ret;
6639}
6640
6641/**
6642 * @brief FIFO compression feature initialization request.[get].
6643 *
6644 * @param ctx Read / write interface definitions.(ptr)
6645 * @param val change the values of FIFO_COMPR_INIT in
6646 * reg EMB_FUNC_INIT_B
6647 * @retval Interface status (MANDATORY: return 0 -> no Error).
6648 *
6649 */
6651 uint8_t *val)
6652{
6653 ism330dhcx_emb_func_init_b_t emb_func_init_b;
6654 int32_t ret;
6656
6657 if (ret == 0)
6658 {
6660 (uint8_t *)&emb_func_init_b, 1);
6661 }
6662
6663 if (ret == 0)
6664 {
6665 *val = emb_func_init_b.fifo_compr_init;
6667 }
6668
6669 return ret;
6670}
6671
6672/**
6673 * @brief Enable and configure compression algo.[set]
6674 *
6675 * @param ctx Read / write interface definitions.(ptr)
6676 * @param val Change the values of uncoptr_rate in reg FIFO_CTRL2
6677 * @retval Interface status (MANDATORY: return 0 -> no Error).
6678 *
6679 */
6682{
6683 ism330dhcx_fifo_ctrl2_t fifo_ctrl2;
6684 ism330dhcx_emb_func_en_b_t emb_func_en_b;
6685 int32_t ret;
6687
6688 if (ret == 0)
6689 {
6691 (uint8_t *)&emb_func_en_b, 1);
6692 }
6693
6694 if (ret == 0)
6695 {
6696 emb_func_en_b.fifo_compr_en = ((uint8_t)val & 0x04U) >> 2;
6698 (uint8_t *)&emb_func_en_b, 1);
6699 }
6700
6701 if (ret == 0)
6702 {
6704 }
6705
6706 if (ret == 0)
6707 {
6709 (uint8_t *)&fifo_ctrl2, 1);
6710 }
6711
6712 if (ret == 0)
6713 {
6714 fifo_ctrl2.fifo_compr_rt_en = ((uint8_t)val & 0x04U) >> 2;
6715 fifo_ctrl2.uncoptr_rate = (uint8_t)val & 0x03U;
6716 }
6717
6718 if (ret == 0)
6719 {
6721 (uint8_t *)&fifo_ctrl2, 1);
6722 }
6723
6724 return ret;
6725}
6726
6727/**
6728 * @brief Enable and configure compression algo.[get]
6729 *
6730 * @param ctx Read / write interface definitions.(ptr)
6731 * @param val Get the values of uncoptr_rate in reg FIFO_CTRL2
6732 * @retval Interface status (MANDATORY: return 0 -> no Error).
6733 *
6734 */
6737{
6738 ism330dhcx_fifo_ctrl2_t fifo_ctrl2;
6739 int32_t ret;
6741 (uint8_t *)&fifo_ctrl2, 1);
6742
6743 switch ((fifo_ctrl2.fifo_compr_rt_en << 2) +
6744 fifo_ctrl2.uncoptr_rate)
6745 {
6748 break;
6749
6751 *val = ISM330DHCX_CMP_ALWAYS;
6752 break;
6753
6755 *val = ISM330DHCX_CMP_8_TO_1;
6756 break;
6757
6760 break;
6761
6764 break;
6765
6766 default:
6768 break;
6769 }
6770
6771 return ret;
6772}
6773
6774/**
6775 * @brief Enables ODR CHANGE virtual sensor to be batched in FIFO.[set]
6776 *
6777 * @param ctx Read / write interface definitions.(ptr)
6778 * @param val Change the values of odrchg_en in reg FIFO_CTRL2
6779 * @retval Interface status (MANDATORY: return 0 -> no Error).
6780 *
6781 */
6783 uint8_t val)
6784{
6785 ism330dhcx_fifo_ctrl2_t fifo_ctrl2;
6786 int32_t ret;
6788 (uint8_t *)&fifo_ctrl2, 1);
6789
6790 if (ret == 0)
6791 {
6792 fifo_ctrl2.odrchg_en = (uint8_t)val;
6794 (uint8_t *)&fifo_ctrl2, 1);
6795 }
6796
6797 return ret;
6798}
6799
6800/**
6801 * @brief Enables ODR CHANGE virtual sensor to be batched in FIFO.[get]
6802 *
6803 * @param ctx Read / write interface definitions.(ptr)
6804 * @param val Change the values of odrchg_en in reg FIFO_CTRL2
6805 * @retval Interface status (MANDATORY: return 0 -> no Error).
6806 *
6807 */
6809 uint8_t *val)
6810{
6811 ism330dhcx_fifo_ctrl2_t fifo_ctrl2;
6812 int32_t ret;
6814 (uint8_t *)&fifo_ctrl2, 1);
6815 *val = fifo_ctrl2.odrchg_en;
6816
6817 return ret;
6818}
6819
6820/**
6821 * @brief Enables/Disables compression algorithm runtime[set]
6822 *
6823 * @param ctx Read / write interface definitions.(ptr)
6824 * @param val Change the values of fifo_compr_rt_en in reg FIFO_CTRL2
6825 * @retval Interface status (MANDATORY: return 0 -> no Error).
6826 *
6827 */
6829 uint8_t val)
6830{
6831 ism330dhcx_fifo_ctrl2_t fifo_ctrl2;
6832 int32_t ret;
6834 (uint8_t *)&fifo_ctrl2, 1);
6835
6836 if (ret == 0)
6837 {
6838 fifo_ctrl2.fifo_compr_rt_en = (uint8_t)val;
6840 (uint8_t *)&fifo_ctrl2, 1);
6841 }
6842
6843 return ret;
6844}
6845
6846/**
6847 * @brief Enables/Disables compression algorithm runtime.[get]
6848 *
6849 * @param ctx Read / write interface definitions.(ptr)
6850 * @param val Change the values of fifo_compr_rt_en in reg FIFO_CTRL2
6851 * @retval Interface status (MANDATORY: return 0 -> no Error).
6852 *
6853 */
6855 uint8_t *val)
6856{
6857 ism330dhcx_fifo_ctrl2_t fifo_ctrl2;
6858 int32_t ret;
6860 (uint8_t *)&fifo_ctrl2, 1);
6861 *val = fifo_ctrl2.fifo_compr_rt_en;
6862
6863 return ret;
6864}
6865
6866/**
6867 * @brief Sensing chain FIFO stop values memorization at threshold
6868 * level.[set]
6869 *
6870 * @param ctx Read / write interface definitions.(ptr)
6871 * @param val Change the values of stop_on_wtm in reg FIFO_CTRL2
6872 * @retval Interface status (MANDATORY: return 0 -> no Error).
6873 *
6874 */
6876 uint8_t val)
6877{
6878 ism330dhcx_fifo_ctrl2_t fifo_ctrl2;
6879 int32_t ret;
6881 (uint8_t *)&fifo_ctrl2, 1);
6882
6883 if (ret == 0)
6884 {
6885 fifo_ctrl2.stop_on_wtm = (uint8_t)val;
6887 (uint8_t *)&fifo_ctrl2, 1);
6888 }
6889
6890 return ret;
6891}
6892
6893/**
6894 * @brief Sensing chain FIFO stop values memorization at threshold
6895 * level.[get]
6896 *
6897 * @param ctx Read / write interface definitions.(ptr)
6898 * @param val Change the values of stop_on_wtm in reg FIFO_CTRL2
6899 * @retval Interface status (MANDATORY: return 0 -> no Error).
6900 *
6901 */
6903 uint8_t *val)
6904{
6905 ism330dhcx_fifo_ctrl2_t fifo_ctrl2;
6906 int32_t ret;
6908 (uint8_t *)&fifo_ctrl2, 1);
6909 *val = fifo_ctrl2.stop_on_wtm;
6910
6911 return ret;
6912}
6913
6914/**
6915 * @brief Selects Batching Data Rate (writing frequency in FIFO)
6916 * for accelerometer data.[set]
6917 *
6918 * @param ctx Read / write interface definitions.(ptr)
6919 * @param val Change the values of bdr_xl in reg FIFO_CTRL3
6920 * @retval Interface status (MANDATORY: return 0 -> no Error).
6921 *
6922 */
6925{
6926 ism330dhcx_fifo_ctrl3_t fifo_ctrl3;
6927 int32_t ret;
6929 (uint8_t *)&fifo_ctrl3, 1);
6930
6931 if (ret == 0)
6932 {
6933 fifo_ctrl3.bdr_xl = (uint8_t)val;
6935 (uint8_t *)&fifo_ctrl3, 1);
6936 }
6937
6938 return ret;
6939}
6940
6941/**
6942 * @brief Selects Batching Data Rate (writing frequency in FIFO)
6943 * for accelerometer data.[get]
6944 *
6945 * @param ctx Read / write interface definitions.(ptr)
6946 * @param val Get the values of bdr_xl in reg FIFO_CTRL3
6947 * @retval Interface status (MANDATORY: return 0 -> no Error).
6948 *
6949 */
6952{
6953 ism330dhcx_fifo_ctrl3_t fifo_ctrl3;
6954 int32_t ret;
6956 (uint8_t *)&fifo_ctrl3, 1);
6957
6958 switch (fifo_ctrl3.bdr_xl)
6959 {
6962 break;
6963
6966 break;
6967
6970 break;
6971
6974 break;
6975
6978 break;
6979
6982 break;
6983
6986 break;
6987
6990 break;
6991
6994 break;
6995
6998 break;
6999
7002 break;
7003
7006 break;
7007
7008 default:
7010 break;
7011 }
7012
7013 return ret;
7014}
7015
7016/**
7017 * @brief Selects Batching Data Rate (writing frequency in FIFO)
7018 * for gyroscope data.[set]
7019 *
7020 * @param ctx Read / write interface definitions.(ptr)
7021 * @param val Change the values of bdr_gy in reg FIFO_CTRL3
7022 * @retval Interface status (MANDATORY: return 0 -> no Error).
7023 *
7024 */
7027{
7028 ism330dhcx_fifo_ctrl3_t fifo_ctrl3;
7029 int32_t ret;
7031 (uint8_t *)&fifo_ctrl3, 1);
7032
7033 if (ret == 0)
7034 {
7035 fifo_ctrl3.bdr_gy = (uint8_t)val;
7037 (uint8_t *)&fifo_ctrl3, 1);
7038 }
7039
7040 return ret;
7041}
7042
7043/**
7044 * @brief Selects Batching Data Rate (writing frequency in FIFO)
7045 * for gyroscope data.[get]
7046 *
7047 * @param ctx Read / write interface definitions.(ptr)
7048 * @param val Get the values of bdr_gy in reg FIFO_CTRL3
7049 * @retval Interface status (MANDATORY: return 0 -> no Error).
7050 *
7051 */
7054{
7055 ism330dhcx_fifo_ctrl3_t fifo_ctrl3;
7056 int32_t ret;
7058 (uint8_t *)&fifo_ctrl3, 1);
7059
7060 switch (fifo_ctrl3.bdr_gy)
7061 {
7064 break;
7065
7068 break;
7069
7072 break;
7073
7076 break;
7077
7080 break;
7081
7084 break;
7085
7088 break;
7089
7092 break;
7093
7096 break;
7097
7100 break;
7101
7104 break;
7105
7108 break;
7109
7110 default:
7112 break;
7113 }
7114
7115 return ret;
7116}
7117
7118/**
7119 * @brief FIFO mode selection.[set]
7120 *
7121 * @param ctx Read / write interface definitions.(ptr)
7122 * @param val Change the values of fifo_mode in reg FIFO_CTRL4
7123 * @retval Interface status (MANDATORY: return 0 -> no Error).
7124 *
7125 */
7128{
7129 ism330dhcx_fifo_ctrl4_t fifo_ctrl4;
7130 int32_t ret;
7132 (uint8_t *)&fifo_ctrl4, 1);
7133
7134 if (ret == 0)
7135 {
7136 fifo_ctrl4.fifo_mode = (uint8_t)val;
7138 (uint8_t *)&fifo_ctrl4, 1);
7139 }
7140
7141 return ret;
7142}
7143
7144/**
7145 * @brief FIFO mode selection.[get]
7146 *
7147 * @param ctx Read / write interface definitions.(ptr)
7148 * @param val Get the values of fifo_mode in reg FIFO_CTRL4
7149 * @retval Interface status (MANDATORY: return 0 -> no Error).
7150 *
7151 */
7154{
7155 ism330dhcx_fifo_ctrl4_t fifo_ctrl4;
7156 int32_t ret;
7158 (uint8_t *)&fifo_ctrl4, 1);
7159
7160 switch (fifo_ctrl4.fifo_mode)
7161 {
7164 break;
7165
7167 *val = ISM330DHCX_FIFO_MODE;
7168 break;
7169
7172 break;
7173
7176 break;
7177
7180 break;
7181
7184 break;
7185
7186 default:
7188 break;
7189 }
7190
7191 return ret;
7192}
7193
7194/**
7195 * @brief Selects Batching Data Rate (writing frequency in FIFO)
7196 * for temperature data.[set]
7197 *
7198 * @param ctx Read / write interface definitions.(ptr)
7199 * @param val Change the values of odr_t_batch in reg FIFO_CTRL4
7200 * @retval Interface status (MANDATORY: return 0 -> no Error).
7201 *
7202 */
7205{
7206 ism330dhcx_fifo_ctrl4_t fifo_ctrl4;
7207 int32_t ret;
7209 (uint8_t *)&fifo_ctrl4, 1);
7210
7211 if (ret == 0)
7212 {
7213 fifo_ctrl4.odr_t_batch = (uint8_t)val;
7215 (uint8_t *)&fifo_ctrl4, 1);
7216 }
7217
7218 return ret;
7219}
7220
7221/**
7222 * @brief Selects Batching Data Rate (writing frequency in FIFO)
7223 * for temperature data.[get]
7224 *
7225 * @param ctx Read / write interface definitions.(ptr)
7226 * @param val Get the values of odr_t_batch in reg FIFO_CTRL4
7227 * @retval Interface status (MANDATORY: return 0 -> no Error).
7228 *
7229 */
7232{
7233 ism330dhcx_fifo_ctrl4_t fifo_ctrl4;
7234 int32_t ret;
7236 (uint8_t *)&fifo_ctrl4, 1);
7237
7238 switch (fifo_ctrl4.odr_t_batch)
7239 {
7242 break;
7243
7246 break;
7247
7250 break;
7251
7254 break;
7255
7256 default:
7258 break;
7259 }
7260
7261 return ret;
7262}
7263
7264/**
7265 * @brief Selects decimation for timestamp batching in FIFO.
7266 * Writing rate will be the maximum rate between XL and
7267 * GYRO BDR divided by decimation decoder.[set]
7268 *
7269 * @param ctx Read / write interface definitions.(ptr)
7270 * @param val Change the values of odr_ts_batch in reg FIFO_CTRL4
7271 * @retval Interface status (MANDATORY: return 0 -> no Error).
7272 *
7273 */
7276{
7277 ism330dhcx_fifo_ctrl4_t fifo_ctrl4;
7278 int32_t ret;
7280 (uint8_t *)&fifo_ctrl4, 1);
7281
7282 if (ret == 0)
7283 {
7284 fifo_ctrl4.odr_ts_batch = (uint8_t)val;
7286 (uint8_t *)&fifo_ctrl4, 1);
7287 }
7288
7289 return ret;
7290}
7291
7292/**
7293 * @brief Selects decimation for timestamp batching in FIFO.
7294 * Writing rate will be the maximum rate between XL and
7295 * GYRO BDR divided by decimation decoder.[get]
7296 *
7297 * @param ctx Read / write interface definitions.(ptr)
7298 * @param val Get the values of odr_ts_batch in reg
7299 * FIFO_CTRL4
7300 * @retval Interface status (MANDATORY: return 0 -> no Error).
7301 *
7302 */
7305{
7306 ism330dhcx_fifo_ctrl4_t fifo_ctrl4;
7307 int32_t ret;
7309 (uint8_t *)&fifo_ctrl4, 1);
7310
7311 switch (fifo_ctrl4.odr_ts_batch)
7312 {
7315 break;
7316
7317 case ISM330DHCX_DEC_1:
7318 *val = ISM330DHCX_DEC_1;
7319 break;
7320
7321 case ISM330DHCX_DEC_8:
7322 *val = ISM330DHCX_DEC_8;
7323 break;
7324
7325 case ISM330DHCX_DEC_32:
7326 *val = ISM330DHCX_DEC_32;
7327 break;
7328
7329 default:
7331 break;
7332 }
7333
7334 return ret;
7335}
7336
7337/**
7338 * @brief Selects the trigger for the internal counter of batching events
7339 * between XL and gyro.[set]
7340 *
7341 * @param ctx Read / write interface definitions.(ptr)
7342 * @param val Change the values of trig_counter_bdr in
7343 * reg COUNTER_BDR_REG1
7344 * @retval Interface status (MANDATORY: return 0 -> no Error).
7345 *
7346 */
7349{
7350 ism330dhcx_counter_bdr_reg1_t counter_bdr_reg1;
7351 int32_t ret;
7353 (uint8_t *)&counter_bdr_reg1, 1);
7354
7355 if (ret == 0)
7356 {
7357 counter_bdr_reg1.trig_counter_bdr = (uint8_t)val;
7359 (uint8_t *)&counter_bdr_reg1, 1);
7360 }
7361
7362 return ret;
7363}
7364
7365/**
7366 * @brief Selects the trigger for the internal counter of batching events
7367 * between XL and gyro.[get]
7368 *
7369 * @param ctx Read / write interface definitions.(ptr)
7370 * @param val Get the values of trig_counter_bdr
7371 * in reg COUNTER_BDR_REG1
7372 * @retval Interface status (MANDATORY: return 0 -> no Error).
7373 *
7374 */
7377{
7378 ism330dhcx_counter_bdr_reg1_t counter_bdr_reg1;
7379 int32_t ret;
7381 (uint8_t *)&counter_bdr_reg1, 1);
7382
7383 switch (counter_bdr_reg1.trig_counter_bdr)
7384 {
7387 break;
7388
7391 break;
7392
7393 default:
7395 break;
7396 }
7397
7398 return ret;
7399}
7400
7401/**
7402 * @brief Resets the internal counter of batching events for a single sensor.
7403 * This bit is automatically reset to zero if it was set to '1'.[set]
7404 *
7405 * @param ctx Read / write interface definitions.(ptr)
7406 * @param val Change the values of rst_counter_bdr in reg COUNTER_BDR_REG1
7407 * @retval Interface status (MANDATORY: return 0 -> no Error).
7408 *
7409 */
7411 uint8_t val)
7412{
7413 ism330dhcx_counter_bdr_reg1_t counter_bdr_reg1;
7414 int32_t ret;
7416 (uint8_t *)&counter_bdr_reg1, 1);
7417
7418 if (ret == 0)
7419 {
7420 counter_bdr_reg1.rst_counter_bdr = (uint8_t)val;
7422 (uint8_t *)&counter_bdr_reg1, 1);
7423 }
7424
7425 return ret;
7426}
7427
7428/**
7429 * @brief Resets the internal counter of batching events for a single sensor.
7430 * This bit is automatically reset to zero if it was set to '1'.[get]
7431 *
7432 * @param ctx Read / write interface definitions.(ptr)
7433 * @param val Change the values of rst_counter_bdr in reg COUNTER_BDR_REG1
7434 * @retval Interface status (MANDATORY: return 0 -> no Error).
7435 *
7436 */
7438 uint8_t *val)
7439{
7440 ism330dhcx_counter_bdr_reg1_t counter_bdr_reg1;
7441 int32_t ret;
7443 (uint8_t *)&counter_bdr_reg1, 1);
7444 *val = counter_bdr_reg1.rst_counter_bdr;
7445
7446 return ret;
7447}
7448
7449/**
7450 * @brief Batch data rate counter.[set]
7451 *
7452 * @param ctx Read / write interface definitions.(ptr)
7453 * @param val Change the values of cnt_bdr_th in reg COUNTER_BDR_REG2
7454 * and COUNTER_BDR_REG1.
7455 * @retval Interface status (MANDATORY: return 0 -> no Error).
7456 *
7457 */
7459 uint16_t val)
7460{
7461 ism330dhcx_counter_bdr_reg2_t counter_bdr_reg1;
7462 ism330dhcx_counter_bdr_reg2_t counter_bdr_reg2;
7463 int32_t ret;
7465 (uint8_t *)&counter_bdr_reg1, 1);
7466
7467 if (ret == 0)
7468 {
7469 counter_bdr_reg1.cnt_bdr_th = (uint8_t)((val / 256U) & 0x07U);
7471 (uint8_t *)&counter_bdr_reg1, 1);
7472 }
7473
7474 if (ret == 0)
7475 {
7476 counter_bdr_reg2.cnt_bdr_th = (uint8_t)(val -
7477 (counter_bdr_reg1.cnt_bdr_th * 256U));
7479 (uint8_t *)&counter_bdr_reg2, 1);
7480 }
7481
7482 return ret;
7483}
7484
7485/**
7486 * @brief Batch data rate counter.[get]
7487 *
7488 * @param ctx Read / write interface definitions.(ptr)
7489 * @param val Change the values of cnt_bdr_th in reg COUNTER_BDR_REG2
7490 * and COUNTER_BDR_REG1.
7491 * @retval Interface status (MANDATORY: return 0 -> no Error).
7492 *
7493 */
7495 uint16_t *val)
7496{
7497 ism330dhcx_counter_bdr_reg1_t counter_bdr_reg1;
7498 ism330dhcx_counter_bdr_reg2_t counter_bdr_reg2;
7499 int32_t ret;
7501 (uint8_t *)&counter_bdr_reg1, 1);
7502
7503 if (ret == 0)
7504 {
7506 (uint8_t *)&counter_bdr_reg2, 1);
7507 }
7508
7509 *val = counter_bdr_reg1.cnt_bdr_th;
7510 *val = (*val * 256U) + counter_bdr_reg2.cnt_bdr_th;
7511
7512 return ret;
7513}
7514
7515/**
7516 * @brief Number of unread sensor data (TAG + 6 bytes) stored in FIFO.[get]
7517 *
7518 * @param ctx Read / write interface definitions.(ptr)
7519 * @param val Change the values of diff_fifo in reg FIFO_STATUS1
7520 * @retval Interface status (MANDATORY: return 0 -> no Error).
7521 *
7522 */
7524 uint16_t *val)
7525{
7526 ism330dhcx_fifo_status1_t fifo_status1;
7527 ism330dhcx_fifo_status2_t fifo_status2;
7528 int32_t ret;
7530 (uint8_t *)&fifo_status1, 1);
7531
7532 if (ret == 0)
7533 {
7535 (uint8_t *)&fifo_status2, 1);
7536 *val = fifo_status2.diff_fifo;
7537 *val = (*val * 256U) + fifo_status1.diff_fifo;
7538 }
7539
7540 return ret;
7541}
7542
7543/**
7544 * @brief Smart FIFO status.[get]
7545 *
7546 * @param ctx Read / write interface definitions.(ptr)
7547 * @param val Registers FIFO_STATUS2
7548 * @retval Interface status (MANDATORY: return 0 -> no Error).
7549 *
7550 */
7553{
7554 int32_t ret;
7556 (uint8_t *)val, 1);
7557
7558 return ret;
7559}
7560
7561/**
7562 * @brief Smart FIFO full status.[get]
7563 *
7564 * @param ctx Read / write interface definitions.(ptr)
7565 * @param val Change the values of fifo_full_ia in reg FIFO_STATUS2
7566 * @retval Interface status (MANDATORY: return 0 -> no Error).
7567 *
7568 */
7570{
7571 ism330dhcx_fifo_status2_t fifo_status2;
7572 int32_t ret;
7574 (uint8_t *)&fifo_status2, 1);
7575 *val = fifo_status2.fifo_full_ia;
7576
7577 return ret;
7578}
7579
7580/**
7581 * @brief FIFO overrun status.[get]
7582 *
7583 * @param ctx Read / write interface definitions.(ptr)
7584 * @param val Change the values of fifo_over_run_latched in
7585 * reg FIFO_STATUS2
7586 * @retval Interface status (MANDATORY: return 0 -> no Error).
7587 *
7588 */
7590{
7591 ism330dhcx_fifo_status2_t fifo_status2;
7592 int32_t ret;
7594 (uint8_t *)&fifo_status2, 1);
7595 *val = fifo_status2. fifo_ovr_ia;
7596
7597 return ret;
7598}
7599
7600/**
7601 * @brief FIFO watermark status.[get]
7602 *
7603 * @param ctx Read / write interface definitions.(ptr)
7604 * @param val Change the values of fifo_wtm_ia in reg FIFO_STATUS2
7605 * @retval Interface status (MANDATORY: return 0 -> no Error).
7606 *
7607 */
7609{
7610 ism330dhcx_fifo_status2_t fifo_status2;
7611 int32_t ret;
7613 (uint8_t *)&fifo_status2, 1);
7614 *val = fifo_status2.fifo_wtm_ia;
7615
7616 return ret;
7617}
7618
7619/**
7620 * @brief Identifies the sensor in FIFO_DATA_OUT.[get]
7621 *
7622 * @param ctx Read / write interface definitions.(ptr)
7623 * @param val Change the values of tag_sensor in reg FIFO_DATA_OUT_TAG
7624 * @retval Interface status (MANDATORY: return 0 -> no Error).
7625 *
7626 */
7629{
7630 ism330dhcx_fifo_data_out_tag_t fifo_data_out_tag;
7631 int32_t ret;
7633 (uint8_t *)&fifo_data_out_tag, 1);
7634
7635 switch (fifo_data_out_tag.tag_sensor)
7636 {
7639 break;
7640
7642 *val = ISM330DHCX_XL_NC_TAG;
7643 break;
7644
7647 break;
7648
7651 break;
7652
7655 break;
7656
7659 break;
7660
7663 break;
7664
7666 *val = ISM330DHCX_XL_2XC_TAG;
7667 break;
7668
7670 *val = ISM330DHCX_XL_3XC_TAG;
7671 break;
7672
7675 break;
7676
7679 break;
7680
7683 break;
7684
7687 break;
7688
7691 break;
7692
7695 break;
7696
7699 break;
7700
7703 break;
7704
7707 break;
7708
7711 break;
7712
7715 break;
7716
7719 break;
7720
7723 break;
7724
7725 default:
7727 break;
7728 }
7729
7730 return ret;
7731}
7732
7733/**
7734 * @brief Enable FIFO batching of pedometer embedded function values.[set]
7735 *
7736 * @param ctx Read / write interface definitions.(ptr)
7737 * @param val Change the values of gbias_fifo_en in
7738 * reg ISM330DHCX_EMB_FUNC_FIFO_CFG
7739 * @retval Interface status (MANDATORY: return 0 -> no Error).
7740 *
7741 */
7743{
7744 ism330dhcx_emb_func_fifo_cfg_t emb_func_fifo_cfg;
7745 int32_t ret;
7747
7748 if (ret == 0)
7749 {
7751 (uint8_t *)&emb_func_fifo_cfg, 1);
7752 }
7753
7754 if (ret == 0)
7755 {
7756 emb_func_fifo_cfg.pedo_fifo_en = (uint8_t)val;
7758 (uint8_t *)&emb_func_fifo_cfg, 1);
7759 }
7760
7761 if (ret == 0)
7762 {
7764 }
7765
7766 return ret;
7767}
7768
7769/**
7770 * @brief Enable FIFO batching of pedometer embedded function values.[get]
7771 *
7772 * @param ctx Read / write interface definitions.(ptr)
7773 * @param val Change the values of pedo_fifo_en in reg
7774 * ISM330DHCX_EMB_FUNC_FIFO_CFG
7775 * @retval Interface status (MANDATORY: return 0 -> no Error).
7776 *
7777 */
7779 uint8_t *val)
7780{
7781 ism330dhcx_emb_func_fifo_cfg_t emb_func_fifo_cfg;
7782 int32_t ret;
7784
7785 if (ret == 0)
7786 {
7788 (uint8_t *)&emb_func_fifo_cfg, 1);
7789 *val = emb_func_fifo_cfg.pedo_fifo_en;
7790 }
7791
7792 if (ret == 0)
7793 {
7795 }
7796
7797 return ret;
7798}
7799
7800/**
7801 * @brief Enable FIFO batching data of first slave.[set]
7802 *
7803 * @param ctx Read / write interface definitions.(ptr)
7804 * @param val Change the values of batch_ext_sens_0_en in reg SLV0_CONFIG
7805 * @retval Interface status (MANDATORY: return 0 -> no Error).
7806 *
7807 */
7809 uint8_t val)
7810{
7811 ism330dhcx_slv0_config_t slv0_config;
7812 int32_t ret;
7814
7815 if (ret == 0)
7816 {
7818 (uint8_t *)&slv0_config, 1);
7819 }
7820
7821 if (ret == 0)
7822 {
7823 slv0_config. batch_ext_sens_0_en = (uint8_t)val;
7825 (uint8_t *)&slv0_config, 1);
7826 }
7827
7828 if (ret == 0)
7829 {
7831 }
7832
7833 return ret;
7834}
7835
7836/**
7837 * @brief Enable FIFO batching data of first slave.[get]
7838 *
7839 * @param ctx Read / write interface definitions.(ptr)
7840 * @param val Change the values of batch_ext_sens_0_en in
7841 * reg SLV0_CONFIG
7842 * @retval Interface status (MANDATORY: return 0 -> no Error).
7843 *
7844 */
7846 uint8_t *val)
7847{
7848 ism330dhcx_slv0_config_t slv0_config;
7849 int32_t ret;
7851
7852 if (ret == 0)
7853 {
7855 (uint8_t *)&slv0_config, 1);
7856 }
7857
7858 if (ret == 0)
7859 {
7860 *val = slv0_config. batch_ext_sens_0_en;
7862 }
7863
7864 return ret;
7865}
7866
7867/**
7868 * @brief Enable FIFO batching data of second slave.[set]
7869 *
7870 * @param ctx Read / write interface definitions.(ptr)
7871 * @param val Change the values of batch_ext_sens_1_en in
7872 * reg SLV1_CONFIG
7873 * @retval Interface status (MANDATORY: return 0 -> no Error).
7874 *
7875 */
7877 uint8_t val)
7878{
7879 ism330dhcx_slv1_config_t slv1_config;
7880 int32_t ret;
7882
7883 if (ret == 0)
7884 {
7886 (uint8_t *)&slv1_config, 1);
7887 }
7888
7889 if (ret == 0)
7890 {
7891 slv1_config. batch_ext_sens_1_en = (uint8_t)val;
7893 (uint8_t *)&slv1_config, 1);
7894 }
7895
7896 if (ret == 0)
7897 {
7899 }
7900
7901 return ret;
7902}
7903
7904/**
7905 * @brief Enable FIFO batching data of second slave.[get]
7906 *
7907 * @param ctx Read / write interface definitions.(ptr)
7908 * @param val Change the values of batch_ext_sens_1_en in
7909 * reg SLV1_CONFIG
7910 * @retval Interface status (MANDATORY: return 0 -> no Error).
7911 *
7912 */
7914 uint8_t *val)
7915{
7916 ism330dhcx_slv1_config_t slv1_config;
7917 int32_t ret;
7919
7920 if (ret == 0)
7921 {
7923 (uint8_t *)&slv1_config, 1);
7924 *val = slv1_config. batch_ext_sens_1_en;
7925 }
7926
7927 if (ret == 0)
7928 {
7930 }
7931
7932 return ret;
7933}
7934
7935/**
7936 * @brief Enable FIFO batching data of third slave.[set]
7937 *
7938 * @param ctx Read / write interface definitions.(ptr)
7939 * @param val Change the values of batch_ext_sens_2_en in
7940 * reg SLV2_CONFIG
7941 * @retval Interface status (MANDATORY: return 0 -> no Error).
7942 *
7943 */
7945 uint8_t val)
7946{
7947 ism330dhcx_slv2_config_t slv2_config;
7948 int32_t ret;
7950
7951 if (ret == 0)
7952 {
7954 (uint8_t *)&slv2_config, 1);
7955 }
7956
7957 if (ret == 0)
7958 {
7959 slv2_config. batch_ext_sens_2_en = (uint8_t)val;
7961 (uint8_t *)&slv2_config, 1);
7962 }
7963
7964 if (ret == 0)
7965 {
7967 }
7968
7969 return ret;
7970}
7971
7972/**
7973 * @brief Enable FIFO batching data of third slave.[get]
7974 *
7975 * @param ctx Read / write interface definitions.(ptr)
7976 * @param val Change the values of batch_ext_sens_2_en in
7977 * reg SLV2_CONFIG
7978 * @retval Interface status (MANDATORY: return 0 -> no Error).
7979 *
7980 */
7982 uint8_t *val)
7983{
7984 ism330dhcx_slv2_config_t slv2_config;
7985 int32_t ret;
7987
7988 if (ret == 0)
7989 {
7991 (uint8_t *)&slv2_config, 1);
7992 }
7993
7994 if (ret == 0)
7995 {
7996 *val = slv2_config. batch_ext_sens_2_en;
7998 }
7999
8000 return ret;
8001}
8002
8003/**
8004 * @brief Enable FIFO batching data of fourth slave.[set]
8005 *
8006 * @param ctx Read / write interface definitions.(ptr)
8007 * @param val Change the values of batch_ext_sens_3_en in
8008 * reg SLV3_CONFIG
8009 * @retval Interface status (MANDATORY: return 0 -> no Error).
8010 *
8011 */
8013 uint8_t val)
8014{
8015 ism330dhcx_slv3_config_t slv3_config;
8016 int32_t ret;
8018
8019 if (ret == 0)
8020 {
8022 (uint8_t *)&slv3_config, 1);
8023 }
8024
8025 if (ret == 0)
8026 {
8027 slv3_config. batch_ext_sens_3_en = (uint8_t)val;
8029 (uint8_t *)&slv3_config, 1);
8030 }
8031
8032 if (ret == 0)
8033 {
8035 }
8036
8037 return ret;
8038}
8039
8040/**
8041 * @brief Enable FIFO batching data of fourth slave.[get]
8042 *
8043 * @param ctx Read / write interface definitions.(ptr)
8044 * @param val Change the values of batch_ext_sens_3_en in
8045 * reg SLV3_CONFIG
8046 * @retval Interface status (MANDATORY: return 0 -> no Error).
8047 *
8048 */
8050 uint8_t *val)
8051{
8052 ism330dhcx_slv3_config_t slv3_config;
8053 int32_t ret;
8055
8056 if (ret == 0)
8057 {
8059 (uint8_t *)&slv3_config, 1);
8060 *val = slv3_config. batch_ext_sens_3_en;
8061 }
8062
8063 if (ret == 0)
8064 {
8066 }
8067
8068 return ret;
8069}
8070
8071/**
8072 * @}
8073 *
8074 */
8075
8076/**
8077 * @defgroup ISM330DHCX_DEN_functionality
8078 * @brief This section groups all the functions concerning
8079 * DEN functionality.
8080 * @{
8081 *
8082 */
8083
8084/**
8085 * @brief DEN functionality marking mode.[set]
8086 *
8087 * @param ctx Read / write interface definitions.(ptr)
8088 * @param val Change the values of den_mode in reg CTRL6_C
8089 * @retval Interface status (MANDATORY: return 0 -> no Error).
8090 *
8091 */
8094{
8095 ism330dhcx_ctrl6_c_t ctrl6_c;
8096 int32_t ret;
8098 (uint8_t *)&ctrl6_c, 1);
8099
8100 if (ret == 0)
8101 {
8102 ctrl6_c.den_mode = (uint8_t)val;
8104 (uint8_t *)&ctrl6_c, 1);
8105 }
8106
8107 return ret;
8108}
8109
8110/**
8111 * @brief DEN functionality marking mode.[get]
8112 *
8113 * @param ctx Read / write interface definitions.(ptr)
8114 * @param val Get the values of den_mode in reg CTRL6_C
8115 * @retval Interface status (MANDATORY: return 0 -> no Error).
8116 *
8117 */
8120{
8121 ism330dhcx_ctrl6_c_t ctrl6_c;
8122 int32_t ret;
8124 (uint8_t *)&ctrl6_c, 1);
8125
8126 switch (ctrl6_c.den_mode)
8127 {
8130 break;
8131
8133 *val = ISM330DHCX_LEVEL_FIFO;
8134 break;
8135
8138 break;
8139
8142 break;
8143
8146 break;
8147
8148 default:
8150 break;
8151 }
8152
8153 return ret;
8154}
8155
8156/**
8157 * @brief DEN active level configuration.[set]
8158 *
8159 * @param ctx Read / write interface definitions.(ptr)
8160 * @param val Change the values of den_lh in reg CTRL9_XL
8161 * @retval Interface status (MANDATORY: return 0 -> no Error).
8162 *
8163 */
8166{
8167 ism330dhcx_ctrl9_xl_t ctrl9_xl;
8168 int32_t ret;
8170 (uint8_t *)&ctrl9_xl, 1);
8171
8172 if (ret == 0)
8173 {
8174 ctrl9_xl.den_lh = (uint8_t)val;
8176 (uint8_t *)&ctrl9_xl, 1);
8177 }
8178
8179 return ret;
8180}
8181
8182/**
8183 * @brief DEN active level configuration.[get]
8184 *
8185 * @param ctx Read / write interface definitions.(ptr)
8186 * @param val Get the values of den_lh in reg CTRL9_XL
8187 * @retval Interface status (MANDATORY: return 0 -> no Error).
8188 *
8189 */
8192{
8193 ism330dhcx_ctrl9_xl_t ctrl9_xl;
8194 int32_t ret;
8196 (uint8_t *)&ctrl9_xl, 1);
8197
8198 switch (ctrl9_xl.den_lh)
8199 {
8202 break;
8203
8206 break;
8207
8208 default:
8210 break;
8211 }
8212
8213 return ret;
8214}
8215
8216/**
8217 * @brief DEN configuration.[set]
8218 *
8219 * @param ctx Read / write interface definitions.(ptr)
8220 * @param val Change the values of den_xl_g in reg CTRL9_XL
8221 * @retval Interface status (MANDATORY: return 0 -> no Error).
8222 *
8223 */
8226{
8227 ism330dhcx_ctrl9_xl_t ctrl9_xl;
8228 int32_t ret;
8230 (uint8_t *)&ctrl9_xl, 1);
8231
8232 if (ret == 0)
8233 {
8234 ctrl9_xl.den_xl_g = (uint8_t)val;
8236 (uint8_t *)&ctrl9_xl, 1);
8237 }
8238
8239 return ret;
8240}
8241
8242/**
8243 * @brief DEN configuration.[get]
8244 *
8245 * @param ctx Read / write interface definitions.(ptr)
8246 * @param val Get the values of den_xl_g in reg CTRL9_XL
8247 * @retval Interface status (MANDATORY: return 0 -> no Error).
8248 *
8249 */
8252{
8253 ism330dhcx_ctrl9_xl_t ctrl9_xl;
8254 int32_t ret;
8256 (uint8_t *)&ctrl9_xl, 1);
8257
8258 switch (ctrl9_xl.den_xl_g)
8259 {
8262 break;
8263
8266 break;
8267
8270 break;
8271
8272 default:
8274 break;
8275 }
8276
8277 return ret;
8278}
8279
8280/**
8281 * @brief DEN value stored in LSB of X-axis.[set]
8282 *
8283 * @param ctx Read / write interface definitions.(ptr)
8284 * @param val Change the values of den_z in reg CTRL9_XL
8285 * @retval Interface status (MANDATORY: return 0 -> no Error).
8286 *
8287 */
8289{
8290 ism330dhcx_ctrl9_xl_t ctrl9_xl;
8291 int32_t ret;
8293 (uint8_t *)&ctrl9_xl, 1);
8294
8295 if (ret == 0)
8296 {
8297 ctrl9_xl.den_z = (uint8_t)val;
8299 (uint8_t *)&ctrl9_xl, 1);
8300 }
8301
8302 return ret;
8303}
8304
8305/**
8306 * @brief DEN value stored in LSB of X-axis.[get]
8307 *
8308 * @param ctx Read / write interface definitions.(ptr)
8309 * @param val Change the values of den_z in reg CTRL9_XL
8310 * @retval Interface status (MANDATORY: return 0 -> no Error).
8311 *
8312 */
8314 uint8_t *val)
8315{
8316 ism330dhcx_ctrl9_xl_t ctrl9_xl;
8317 int32_t ret;
8319 (uint8_t *)&ctrl9_xl, 1);
8320 *val = ctrl9_xl.den_z;
8321
8322 return ret;
8323}
8324
8325/**
8326 * @brief DEN value stored in LSB of Y-axis.[set]
8327 *
8328 * @param ctx Read / write interface definitions.(ptr)
8329 * @param val Change the values of den_y in reg CTRL9_XL
8330 * @retval Interface status (MANDATORY: return 0 -> no Error).
8331 *
8332 */
8334{
8335 ism330dhcx_ctrl9_xl_t ctrl9_xl;
8336 int32_t ret;
8338 (uint8_t *)&ctrl9_xl, 1);
8339
8340 if (ret == 0)
8341 {
8342 ctrl9_xl.den_y = (uint8_t)val;
8344 (uint8_t *)&ctrl9_xl, 1);
8345 }
8346
8347 return ret;
8348}
8349
8350/**
8351 * @brief DEN value stored in LSB of Y-axis.[get]
8352 *
8353 * @param ctx Read / write interface definitions.(ptr)
8354 * @param val Change the values of den_y in reg CTRL9_XL
8355 * @retval Interface status (MANDATORY: return 0 -> no Error).
8356 *
8357 */
8359 uint8_t *val)
8360{
8361 ism330dhcx_ctrl9_xl_t ctrl9_xl;
8362 int32_t ret;
8364 (uint8_t *)&ctrl9_xl, 1);
8365 *val = ctrl9_xl.den_y;
8366
8367 return ret;
8368}
8369
8370/**
8371 * @brief DEN value stored in LSB of Z-axis.[set]
8372 *
8373 * @param ctx Read / write interface definitions.(ptr)
8374 * @param val Change the values of den_x in reg CTRL9_XL
8375 * @retval Interface status (MANDATORY: return 0 -> no Error).
8376 *
8377 */
8379{
8380 ism330dhcx_ctrl9_xl_t ctrl9_xl;
8381 int32_t ret;
8383 (uint8_t *)&ctrl9_xl, 1);
8384
8385 if (ret == 0)
8386 {
8387 ctrl9_xl.den_x = (uint8_t)val;
8389 (uint8_t *)&ctrl9_xl, 1);
8390 }
8391
8392 return ret;
8393}
8394
8395/**
8396 * @brief DEN value stored in LSB of Z-axis.[get]
8397 *
8398 * @param ctx Read / write interface definitions.(ptr)
8399 * @param val Change the values of den_x in reg CTRL9_XL
8400 * @retval Interface status (MANDATORY: return 0 -> no Error).
8401 *
8402 */
8404 uint8_t *val)
8405{
8406 ism330dhcx_ctrl9_xl_t ctrl9_xl;
8407 int32_t ret;
8409 (uint8_t *)&ctrl9_xl, 1);
8410 *val = ctrl9_xl.den_x;
8411
8412 return ret;
8413}
8414
8415/**
8416 * @}
8417 *
8418 */
8419
8420/**
8421 * @defgroup ISM330DHCX_Pedometer
8422 * @brief This section groups all the functions that manage pedometer.
8423 * @{
8424 *
8425 */
8426
8427/**
8428 * @brief Enable pedometer algorithm.[set]
8429 *
8430 * @param ctx Read / write interface definitions.(ptr)
8431 * @param val Change the values of pedo_en in reg EMB_FUNC_EN_A
8432 * @retval Interface status (MANDATORY: return 0 -> no Error).
8433 *
8434 */
8435int32_t ism330dhcx_pedo_sens_set(stmdev_ctx_t *ctx, uint8_t val)
8436{
8437 ism330dhcx_emb_func_en_a_t emb_func_en_a;
8438 int32_t ret;
8440
8441 if (ret == 0)
8442 {
8444 (uint8_t *)&emb_func_en_a, 1);
8445 }
8446
8447 if (ret == 0)
8448 {
8449 emb_func_en_a.pedo_en = (uint8_t)val;
8451 (uint8_t *)&emb_func_en_a, 1);
8452 }
8453
8454 if (ret == 0)
8455 {
8457 }
8458
8459 return ret;
8460}
8461
8462/**
8463 * @brief Enable pedometer algorithm.[get]
8464 *
8465 * @param ctx Read / write interface definitions.(ptr)
8466 * @param val Change the values of pedo_en in reg EMB_FUNC_EN_A
8467 * @retval Interface status (MANDATORY: return 0 -> no Error).
8468 *
8469 */
8470int32_t ism330dhcx_pedo_sens_get(stmdev_ctx_t *ctx, uint8_t *val)
8471{
8472 ism330dhcx_emb_func_en_a_t emb_func_en_a;
8473 int32_t ret;
8475
8476 if (ret == 0)
8477 {
8479 (uint8_t *)&emb_func_en_a, 1);
8480 *val = emb_func_en_a.pedo_en;
8481 }
8482
8483 if (ret == 0)
8484 {
8486 }
8487
8488 return ret;
8489}
8490
8491/**
8492 * @brief Interrupt status bit for step detection.[get]
8493 *
8494 * @param ctx Read / write interface definitions.(ptr)
8495 * @param val Change the values of is_step_det in reg EMB_FUNC_STATUS
8496 * @retval Interface status (MANDATORY: return 0 -> no Error).
8497 *
8498 */
8500 uint8_t *val)
8501{
8502 ism330dhcx_emb_func_status_t emb_func_status;
8503 int32_t ret;
8505
8506 if (ret == 0)
8507 {
8509 (uint8_t *)&emb_func_status, 1);
8510 *val = emb_func_status.is_step_det;
8511 }
8512
8513 if (ret == 0)
8514 {
8516 }
8517
8518 return ret;
8519}
8520
8521/**
8522 * @brief Pedometer debounce configuration register (r/w).[set]
8523 *
8524 * @param ctx Read / write interface definitions.(ptr)
8525 * @param buff Buffer that contains data to write
8526 * @retval Interface status (MANDATORY: return 0 -> no Error).
8527 *
8528 */
8530 uint8_t *buff)
8531{
8532 int32_t ret;
8534 buff);
8535
8536 return ret;
8537}
8538
8539/**
8540 * @brief Pedometer debounce configuration register (r/w).[get]
8541 *
8542 * @param ctx Read / write interface definitions.(ptr)
8543 * @param buff Buffer that stores data read
8544 * @retval Interface status (MANDATORY: return 0 -> no Error).
8545 *
8546 */
8548 uint8_t *buff)
8549{
8550 int32_t ret;
8552 buff);
8553
8554 return ret;
8555}
8556
8557/**
8558 * @brief Time period register for step detection on delta time (r/w).[set]
8559 *
8560 * @param ctx Read / write interface definitions.(ptr)
8561 * @param buff Buffer that contains data to write
8562 * @retval Interface status (MANDATORY: return 0 -> no Error).
8563 *
8564 */
8566 uint16_t val)
8567{
8568 uint8_t buff[2];
8569 int32_t ret;
8570 buff[1] = (uint8_t)(val / 256U);
8571 buff[0] = (uint8_t)(val - (buff[1] * 256U));
8573 &buff[0]);
8574
8575 if (ret == 0)
8576 {
8578 &buff[1]);
8579 }
8580
8581 return ret;
8582}
8583
8584/**
8585 * @brief Time period register for step detection on delta time (r/w).[get]
8586 *
8587 * @param ctx Read / write interface definitions.(ptr)
8588 * @param buff Buffer that stores data read
8589 * @retval Interface status (MANDATORY: return 0 -> no Error).
8590 *
8591 */
8593 uint16_t *val)
8594{
8595 uint8_t buff[2];
8596 int32_t ret;
8598 &buff[0]);
8599
8600 if (ret == 0)
8601 {
8603 &buff[1]);
8604 *val = buff[1];
8605 *val = (*val * 256U) + buff[0];
8606 }
8607
8608 return ret;
8609}
8610
8611/**
8612 * @brief Set when user wants to generate interrupt on count overflow
8613 * event/every step.[set]
8614 *
8615 * @param ctx Read / write interface definitions.(ptr)
8616 * @param val Change the values of carry_count_en in reg PEDO_CMD_REG
8617 * @retval Interface status (MANDATORY: return 0 -> no Error).
8618 *
8619 */
8622{
8623 ism330dhcx_pedo_cmd_reg_t pedo_cmd_reg;
8624 int32_t ret;
8626 (uint8_t *)&pedo_cmd_reg);
8627
8628 if (ret == 0)
8629 {
8630 pedo_cmd_reg.carry_count_en = (uint8_t)val;
8632 (uint8_t *)&pedo_cmd_reg);
8633 }
8634
8635 return ret;
8636}
8637
8638/**
8639 * @brief Set when user wants to generate interrupt on count overflow
8640 * event/every step.[get]
8641 *
8642 * @param ctx Read / write interface definitions.(ptr)
8643 * @param val Get the values of carry_count_en in reg PEDO_CMD_REG
8644 * @retval Interface status (MANDATORY: return 0 -> no Error).
8645 *
8646 */
8649{
8650 ism330dhcx_pedo_cmd_reg_t pedo_cmd_reg;
8651 int32_t ret;
8653 (uint8_t *)&pedo_cmd_reg);
8654
8655 switch (pedo_cmd_reg.carry_count_en)
8656 {
8658 *val = ISM330DHCX_EVERY_STEP;
8659 break;
8660
8663 break;
8664
8665 default:
8666 *val = ISM330DHCX_EVERY_STEP;
8667 break;
8668 }
8669
8670 return ret;
8671}
8672
8673/**
8674 * @}
8675 *
8676 */
8677
8678/**
8679 * @defgroup ISM330DHCX_significant_motion
8680 * @brief This section groups all the functions that manage the
8681 * significant motion detection.
8682 * @{
8683 *
8684 */
8685
8686/**
8687 * @brief Enable significant motion detection function.[set]
8688 *
8689 * @param ctx Read / write interface definitions.(ptr)
8690 * @param val Change the values of sign_motion_en in reg EMB_FUNC_EN_A
8691 * @retval Interface status (MANDATORY: return 0 -> no Error).
8692 *
8693 */
8695{
8696 ism330dhcx_emb_func_en_a_t emb_func_en_a;
8697 int32_t ret;
8699
8700 if (ret == 0)
8701 {
8703 (uint8_t *)&emb_func_en_a, 1);
8704 }
8705
8706 if (ret == 0)
8707 {
8708 emb_func_en_a.sign_motion_en = (uint8_t)val;
8710 (uint8_t *)&emb_func_en_a, 1);
8711 }
8712
8713 if (ret == 0)
8714 {
8716 }
8717
8718 return ret;
8719}
8720
8721/**
8722 * @brief Enable significant motion detection function.[get]
8723 *
8724 * @param ctx Read / write interface definitions.(ptr)
8725 * @param val Change the values of sign_motion_en in reg EMB_FUNC_EN_A
8726 * @retval Interface status (MANDATORY: return 0 -> no Error).
8727 *
8728 */
8729int32_t ism330dhcx_motion_sens_get(stmdev_ctx_t *ctx, uint8_t *val)
8730{
8731 ism330dhcx_emb_func_en_a_t emb_func_en_a;
8732 int32_t ret;
8734
8735 if (ret == 0)
8736 {
8738 (uint8_t *)&emb_func_en_a, 1);
8739 }
8740
8741 if (ret == 0)
8742 {
8743 *val = emb_func_en_a.sign_motion_en;
8745 }
8746
8747 return ret;
8748}
8749
8750/**
8751 * @brief Interrupt status bit for significant motion detection.[get]
8752 *
8753 * @param ctx Read / write interface definitions.(ptr)
8754 * @param val Change the values of is_sigmot in reg EMB_FUNC_STATUS
8755 * @retval Interface status (MANDATORY: return 0 -> no Error).
8756 *
8757 */
8759 uint8_t *val)
8760{
8761 ism330dhcx_emb_func_status_t emb_func_status;
8762 int32_t ret;
8764
8765 if (ret == 0)
8766 {
8768 (uint8_t *)&emb_func_status, 1);
8769 }
8770
8771 if (ret == 0)
8772 {
8773 *val = emb_func_status.is_sigmot;
8775 }
8776
8777 return ret;
8778}
8779
8780/**
8781 * @}
8782 *
8783 */
8784
8785/**
8786 * @defgroup ISM330DHCX_tilt_detection
8787 * @brief This section groups all the functions that manage the tilt
8788 * event detection.
8789 * @{
8790 *
8791 */
8792
8793/**
8794 * @brief Enable tilt calculation.[set]
8795 *
8796 * @param ctx Read / write interface definitions.(ptr)
8797 * @param val Change the values of tilt_en in reg EMB_FUNC_EN_A
8798 * @retval Interface status (MANDATORY: return 0 -> no Error).
8799 *
8800 */
8801int32_t ism330dhcx_tilt_sens_set(stmdev_ctx_t *ctx, uint8_t val)
8802{
8803 ism330dhcx_emb_func_en_a_t emb_func_en_a;
8804 int32_t ret;
8806
8807 if (ret == 0)
8808 {
8810 (uint8_t *)&emb_func_en_a, 1);
8811 }
8812
8813 if (ret == 0)
8814 {
8815 emb_func_en_a.tilt_en = (uint8_t)val;
8817 (uint8_t *)&emb_func_en_a, 1);
8818 }
8819
8820 if (ret == 0)
8821 {
8823 }
8824
8825 return ret;
8826}
8827
8828/**
8829 * @brief Enable tilt calculation.[get]
8830 *
8831 * @param ctx Read / write interface definitions.(ptr)
8832 * @param val Change the values of tilt_en in reg EMB_FUNC_EN_A
8833 * @retval Interface status (MANDATORY: return 0 -> no Error).
8834 *
8835 */
8836int32_t ism330dhcx_tilt_sens_get(stmdev_ctx_t *ctx, uint8_t *val)
8837{
8838 ism330dhcx_emb_func_en_a_t emb_func_en_a;
8839 int32_t ret;
8841
8842 if (ret == 0)
8843 {
8845 (uint8_t *)&emb_func_en_a, 1);
8846 }
8847
8848 if (ret == 0)
8849 {
8850 *val = emb_func_en_a.tilt_en;
8852 }
8853
8854 return ret;
8855}
8856
8857/**
8858 * @brief Interrupt status bit for tilt detection.[get]
8859 *
8860 * @param ctx Read / write interface definitions.(ptr)
8861 * @param val Change the values of is_tilt in reg EMB_FUNC_STATUS
8862 * @retval Interface status (MANDATORY: return 0 -> no Error).
8863 *
8864 */
8866 uint8_t *val)
8867{
8868 ism330dhcx_emb_func_status_t emb_func_status;
8869 int32_t ret;
8871
8872 if (ret == 0)
8873 {
8875 (uint8_t *)&emb_func_status, 1);
8876 }
8877
8878 if (ret == 0)
8879 {
8880 *val = emb_func_status.is_tilt;
8882 }
8883
8884 return ret;
8885}
8886
8887/**
8888 * @}
8889 *
8890 */
8891
8892/**
8893 * @defgroup ISM330DHCX_ magnetometer_sensor
8894 * @brief This section groups all the functions that manage additional
8895 * magnetometer sensor.
8896 * @{
8897 *
8898 */
8899
8900/**
8901 * @brief External magnetometer sensitivity value register.[set]
8902 *
8903 * @param ctx Read / write interface definitions.(ptr)
8904 * @param buff Buffer that contains data to write
8905 * @retval Interface status (MANDATORY: return 0 -> no Error).
8906 *
8907 */
8909 uint16_t val)
8910{
8911 uint8_t buff[2];
8912 int32_t ret;
8913 buff[1] = (uint8_t)(val / 256U);
8914 buff[0] = (uint8_t)(val - (buff[1] * 256U));
8916 &buff[0]);
8917
8918 if (ret == 0)
8919 {
8921 &buff[1]);
8922 }
8923
8924 return ret;
8925}
8926
8927/**
8928 * @brief External magnetometer sensitivity value register.[get]
8929 *
8930 * @param ctx Read / write interface definitions.(ptr)
8931 * @param buff Buffer that stores data read
8932 * @retval Interface status (MANDATORY: return 0 -> no Error).
8933 *
8934 */
8936 uint16_t *val)
8937{
8938 uint8_t buff[2];
8939 int32_t ret;
8941 &buff[0]);
8942
8943 if (ret == 0)
8944 {
8946 &buff[1]);
8947 *val = buff[1];
8948 *val = (*val * 256U) + buff[0];
8949 }
8950
8951 return ret;
8952}
8953
8954/**
8955 * @brief Offset for hard-iron compensation register (r/w).[set]
8956 *
8957 * @param ctx Read / write interface definitions.(ptr)
8958 * @param buff Buffer that contains data to write
8959 * @retval Interface status (MANDATORY: return 0 -> no Error).
8960 *
8961 */
8962int32_t ism330dhcx_mag_offset_set(stmdev_ctx_t *ctx, int16_t *val)
8963{
8964 uint8_t buff[6];
8965 int32_t ret;
8966 uint8_t i;
8967 buff[1] = (uint8_t)((uint16_t)val[0] / 256U);
8968 buff[0] = (uint8_t)((uint16_t)val[0] - (buff[1] * 256U));
8969 buff[3] = (uint8_t)((uint16_t)val[1] / 256U);
8970 buff[2] = (uint8_t)((uint16_t)val[1] - (buff[3] * 256U));
8971 buff[5] = (uint8_t)((uint16_t)val[2] / 256U);
8972 buff[4] = (uint8_t)((uint16_t)val[2] - (buff[5] * 256U));
8973 i = 0x00U;
8975 &buff[i]);
8976
8977 if (ret == 0)
8978 {
8979 i++;
8981 &buff[i]);
8982 }
8983
8984 if (ret == 0)
8985 {
8986 i++;
8988 &buff[i]);
8989 }
8990
8991 if (ret == 0)
8992 {
8993 i++;
8995 &buff[i]);
8996 }
8997
8998 if (ret == 0)
8999 {
9000 i++;
9002 &buff[i]);
9003 }
9004
9005 if (ret == 0)
9006 {
9007 i++;
9009 &buff[i]);
9010 }
9011
9012 return ret;
9013}
9014
9015/**
9016 * @brief Offset for hard-iron compensation register (r/w).[get]
9017 *
9018 * @param ctx Read / write interface definitions.(ptr)
9019 * @param buff Buffer that stores data read
9020 * @retval Interface status (MANDATORY: return 0 -> no Error).
9021 *
9022 */
9023int32_t ism330dhcx_mag_offset_get(stmdev_ctx_t *ctx, int16_t *val)
9024{
9025 uint8_t buff[6];
9026 int32_t ret;
9027 uint8_t i;
9028 i = 0x00U;
9030 &buff[i]);
9031
9032 if (ret == 0)
9033 {
9034 i++;
9036 &buff[i]);
9037 }
9038
9039 if (ret == 0)
9040 {
9041 i++;
9043 &buff[i]);
9044 }
9045
9046 if (ret == 0)
9047 {
9048 i++;
9050 &buff[i]);
9051 }
9052
9053 if (ret == 0)
9054 {
9055 i++;
9057 &buff[i]);
9058 }
9059
9060 if (ret == 0)
9061 {
9062 i++;
9064 &buff[i]);
9065 }
9066
9067 val[0] = (int16_t)buff[1];
9068 val[0] = (val[0] * 256) + (int16_t)buff[0];
9069 val[1] = (int16_t)buff[3];
9070 val[1] = (val[1] * 256) + (int16_t)buff[2];
9071 val[2] = (int16_t)buff[5];
9072 val[2] = (val[2] * 256) + (int16_t)buff[4];
9073
9074 return ret;
9075}
9076
9077/**
9078 * @brief Soft-iron (3x3 symmetric) matrix correction register (r/w).
9079 * The value is expressed as half-precision floating-point format:
9080 * SEEEEEFFFFFFFFFF
9081 * S: 1 sign bit;
9082 * E: 5 exponent bits;
9083 * F: 10 fraction bits).[set]
9084 *
9085 * @param ctx Read / write interface definitions.(ptr)
9086 * @param buff Buffer that contains data to write
9087 * @retval Interface status (MANDATORY: return 0 -> no Error).
9088 *
9089 */
9090int32_t ism330dhcx_mag_soft_iron_set(stmdev_ctx_t *ctx, uint16_t *val)
9091{
9092 uint8_t buff[12];
9093 int32_t ret;
9094 uint8_t i;
9095 buff[1] = (uint8_t)(val[0] / 256U);
9096 buff[0] = (uint8_t)(val[0] - (buff[1] * 256U));
9097 buff[3] = (uint8_t)(val[1] / 256U);
9098 buff[2] = (uint8_t)(val[1] - (buff[3] * 256U));
9099 buff[5] = (uint8_t)(val[2] / 256U);
9100 buff[4] = (uint8_t)(val[2] - (buff[5] * 256U));
9101 buff[7] = (uint8_t)(val[3] / 256U);
9102 buff[6] = (uint8_t)(val[3] - (buff[1] * 256U));
9103 buff[9] = (uint8_t)(val[4] / 256U);
9104 buff[8] = (uint8_t)(val[4] - (buff[3] * 256U));
9105 buff[11] = (uint8_t)(val[5] / 256U);
9106 buff[10] = (uint8_t)(val[5] - (buff[5] * 256U));
9107 i = 0x00U;
9109 &buff[i]);
9110
9111 if (ret == 0)
9112 {
9113 i++;
9115 &buff[i]);
9116 }
9117
9118 if (ret == 0)
9119 {
9120 i++;
9122 &buff[i]);
9123 }
9124
9125 if (ret == 0)
9126 {
9127 i++;
9129 &buff[i]);
9130 }
9131
9132 if (ret == 0)
9133 {
9134 i++;
9136 &buff[i]);
9137 }
9138
9139 if (ret == 0)
9140 {
9141 i++;
9143 &buff[i]);
9144 }
9145
9146 if (ret == 0)
9147 {
9148 i++;
9150 &buff[i]);
9151 }
9152
9153 if (ret == 0)
9154 {
9155 i++;
9157 &buff[i]);
9158 }
9159
9160 if (ret == 0)
9161 {
9162 i++;
9164 &buff[i]);
9165 }
9166
9167 if (ret == 0)
9168 {
9169 i++;
9171 &buff[i]);
9172 }
9173
9174 if (ret == 0)
9175 {
9176 i++;
9178 &buff[i]);
9179 }
9180
9181 if (ret == 0)
9182 {
9183 i++;
9185 &buff[i]);
9186 }
9187
9188 return ret;
9189}
9190
9191/**
9192 * @brief Soft-iron (3x3 symmetric) matrix correction register (r/w).
9193 * The value is expressed as half-precision floating-point format:
9194 * SEEEEEFFFFFFFFFF
9195 * S: 1 sign bit;
9196 * E: 5 exponent bits;
9197 * F: 10 fraction bits).[get]
9198 *
9199 * @param ctx Read / write interface definitions.(ptr)
9200 * @param buff Buffer that stores data read
9201 * @retval Interface status (MANDATORY: return 0 -> no Error).
9202 *
9203 */
9204int32_t ism330dhcx_mag_soft_iron_get(stmdev_ctx_t *ctx, uint16_t *val)
9205{
9206 uint8_t buff[12];
9207 int32_t ret;
9208 uint8_t i;
9209 i = 0x00U;
9211 &buff[i]);
9212
9213 if (ret == 0)
9214 {
9215 i++;
9217 &buff[i]);
9218 }
9219
9220 if (ret == 0)
9221 {
9222 i++;
9224 &buff[i]);
9225 }
9226
9227 if (ret == 0)
9228 {
9229 i++;
9231 &buff[i]);
9232 }
9233
9234 if (ret == 0)
9235 {
9236 i++;
9238 &buff[i]);
9239 }
9240
9241 if (ret == 0)
9242 {
9243 i++;
9245 &buff[i]);
9246 }
9247
9248 if (ret == 0)
9249 {
9250 i++;
9252 &buff[i]);
9253 }
9254
9255 if (ret == 0)
9256 {
9257 i++;
9259 &buff[i]);
9260 }
9261
9262 if (ret == 0)
9263 {
9264 i++;
9266 &buff[i]);
9267 }
9268
9269 if (ret == 0)
9270 {
9271 i++;
9273 &buff[i]);
9274 }
9275
9276 if (ret == 0)
9277 {
9278 i++;
9280 &buff[i]);
9281 }
9282
9283 if (ret == 0)
9284 {
9285 i++;
9287 &buff[i]);
9288 }
9289
9290 val[0] = buff[1];
9291 val[0] = (val[0] * 256U) + buff[0];
9292 val[1] = buff[3];
9293 val[1] = (val[1] * 256U) + buff[2];
9294 val[2] = buff[5];
9295 val[2] = (val[2] * 256U) + buff[4];
9296 val[3] = buff[7];
9297 val[3] = (val[3] * 256U) + buff[6];
9298 val[4] = buff[9];
9299 val[4] = (val[4] * 256U) + buff[8];
9300 val[5] = buff[11];
9301 val[6] = (val[5] * 256U) + buff[10];
9302
9303 return ret;
9304}
9305
9306/**
9307 * @brief Magnetometer Z-axis coordinates rotation (to be aligned to
9308 * accelerometer/gyroscope axes orientation).[set]
9309 *
9310 * @param ctx Read / write interface definitions.(ptr)
9311 * @param val Change the values of mag_z_axis in reg MAG_CFG_A
9312 * @retval Interface status (MANDATORY: return 0 -> no Error).
9313 *
9314 */
9317{
9318 ism330dhcx_mag_cfg_a_t mag_cfg_a;
9319 int32_t ret;
9321 (uint8_t *)&mag_cfg_a);
9322
9323 if (ret == 0)
9324 {
9325 mag_cfg_a.mag_z_axis = (uint8_t)val;
9327 (uint8_t *)&mag_cfg_a);
9328 }
9329
9330 return ret;
9331}
9332
9333/**
9334 * @brief Magnetometer Z-axis coordinates rotation (to be aligned to
9335 * accelerometer/gyroscope axes orientation).[get]
9336 *
9337 * @param ctx Read / write interface definitions.(ptr)
9338 * @param val Get the values of mag_z_axis in reg MAG_CFG_A
9339 * @retval Interface status (MANDATORY: return 0 -> no Error).
9340 *
9341 */
9344{
9345 ism330dhcx_mag_cfg_a_t mag_cfg_a;
9346 int32_t ret;
9348 (uint8_t *)&mag_cfg_a);
9349
9350 switch (mag_cfg_a.mag_z_axis)
9351 {
9352 case ISM330DHCX_Z_EQ_Y:
9353 *val = ISM330DHCX_Z_EQ_Y;
9354 break;
9355
9357 *val = ISM330DHCX_Z_EQ_MIN_Y;
9358 break;
9359
9360 case ISM330DHCX_Z_EQ_X:
9361 *val = ISM330DHCX_Z_EQ_X;
9362 break;
9363
9365 *val = ISM330DHCX_Z_EQ_MIN_X;
9366 break;
9367
9369 *val = ISM330DHCX_Z_EQ_MIN_Z;
9370 break;
9371
9372 case ISM330DHCX_Z_EQ_Z:
9373 *val = ISM330DHCX_Z_EQ_Z;
9374 break;
9375
9376 default:
9377 *val = ISM330DHCX_Z_EQ_Y;
9378 break;
9379 }
9380
9381 return ret;
9382}
9383
9384/**
9385 * @brief Magnetometer Y-axis coordinates rotation (to be aligned to
9386 * accelerometer/gyroscope axes orientation).[set]
9387 *
9388 * @param ctx Read / write interface definitions.(ptr)
9389 * @param val Change the values of mag_y_axis in
9390 * reg MAG_CFG_A
9391 * @retval Interface status (MANDATORY: return 0 -> no Error).
9392 *
9393 */
9396{
9397 ism330dhcx_mag_cfg_a_t mag_cfg_a;
9398 int32_t ret;
9400 (uint8_t *)&mag_cfg_a);
9401
9402 if (ret == 0)
9403 {
9404 mag_cfg_a.mag_y_axis = (uint8_t)val;
9406 (uint8_t *)&mag_cfg_a);
9407 }
9408
9409 return ret;
9410}
9411
9412/**
9413 * @brief Magnetometer Y-axis coordinates rotation (to be aligned to
9414 * accelerometer/gyroscope axes orientation).[get]
9415 *
9416 * @param ctx Read / write interface definitions.(ptr)
9417 * @param val Get the values of mag_y_axis in reg MAG_CFG_A
9418 * @retval Interface status (MANDATORY: return 0 -> no Error).
9419 *
9420 */
9423{
9424 ism330dhcx_mag_cfg_a_t mag_cfg_a;
9425 int32_t ret;
9427 (uint8_t *)&mag_cfg_a);
9428
9429 switch (mag_cfg_a.mag_y_axis)
9430 {
9431 case ISM330DHCX_Y_EQ_Y:
9432 *val = ISM330DHCX_Y_EQ_Y;
9433 break;
9434
9436 *val = ISM330DHCX_Y_EQ_MIN_Y;
9437 break;
9438
9439 case ISM330DHCX_Y_EQ_X:
9440 *val = ISM330DHCX_Y_EQ_X;
9441 break;
9442
9444 *val = ISM330DHCX_Y_EQ_MIN_X;
9445 break;
9446
9448 *val = ISM330DHCX_Y_EQ_MIN_Z;
9449 break;
9450
9451 case ISM330DHCX_Y_EQ_Z:
9452 *val = ISM330DHCX_Y_EQ_Z;
9453 break;
9454
9455 default:
9456 *val = ISM330DHCX_Y_EQ_Y;
9457 break;
9458 }
9459
9460 return ret;
9461}
9462
9463/**
9464 * @brief Magnetometer X-axis coordinates rotation (to be aligned to
9465 * accelerometer/gyroscope axes orientation).[set]
9466 *
9467 * @param ctx Read / write interface definitions.(ptr)
9468 * @param val Change the values of mag_x_axis in reg MAG_CFG_B
9469 * @retval Interface status (MANDATORY: return 0 -> no Error).
9470 *
9471 */
9474{
9475 ism330dhcx_mag_cfg_b_t mag_cfg_b;
9476 int32_t ret;
9478 (uint8_t *)&mag_cfg_b);
9479
9480 if (ret == 0)
9481 {
9482 mag_cfg_b.mag_x_axis = (uint8_t)val;
9484 (uint8_t *)&mag_cfg_b);
9485 }
9486
9487 return ret;
9488}
9489
9490/**
9491 * @brief Magnetometer X-axis coordinates rotation (to be aligned to
9492 * accelerometer/gyroscope axes orientation).[get]
9493 *
9494 * @param ctx Read / write interface definitions.(ptr)
9495 * @param val Get the values of mag_x_axis in reg MAG_CFG_B
9496 * @retval Interface status (MANDATORY: return 0 -> no Error).
9497 *
9498 */
9501{
9502 ism330dhcx_mag_cfg_b_t mag_cfg_b;
9503 int32_t ret;
9505 (uint8_t *)&mag_cfg_b);
9506
9507 switch (mag_cfg_b.mag_x_axis)
9508 {
9509 case ISM330DHCX_X_EQ_Y:
9510 *val = ISM330DHCX_X_EQ_Y;
9511 break;
9512
9514 *val = ISM330DHCX_X_EQ_MIN_Y;
9515 break;
9516
9517 case ISM330DHCX_X_EQ_X:
9518 *val = ISM330DHCX_X_EQ_X;
9519 break;
9520
9522 *val = ISM330DHCX_X_EQ_MIN_X;
9523 break;
9524
9526 *val = ISM330DHCX_X_EQ_MIN_Z;
9527 break;
9528
9529 case ISM330DHCX_X_EQ_Z:
9530 *val = ISM330DHCX_X_EQ_Z;
9531 break;
9532
9533 default:
9534 *val = ISM330DHCX_X_EQ_Y;
9535 break;
9536 }
9537
9538 return ret;
9539}
9540
9541/**
9542 * @}
9543 *
9544 */
9545
9546/**
9547 * @defgroup ISM330DHCX_finite_state_machine
9548 * @brief This section groups all the functions that manage the
9549 * state_machine.
9550 * @{
9551 *
9552 */
9553
9554/**
9555 * @brief Interrupt status bit for FSM long counter timeout interrupt
9556 * event.[get]
9557 *
9558 * @param ctx Read / write interface definitions.(ptr)
9559 * @param val Change the values of is_fsm_lc in reg EMB_FUNC_STATUS
9560 * @retval Interface status (MANDATORY: return 0 -> no Error).
9561 *
9562 */
9564 uint8_t *val)
9565{
9566 ism330dhcx_emb_func_status_t emb_func_status;
9567 int32_t ret;
9569
9570 if (ret == 0)
9571 {
9573 (uint8_t *)&emb_func_status, 1);
9574 }
9575
9576 if (ret == 0)
9577 {
9578 *val = emb_func_status.is_fsm_lc;
9580 }
9581
9582 return ret;
9583}
9584
9585/**
9586 * @brief Embedded final state machine functions mode.[set]
9587 *
9588 * @param ctx Read / write interface definitions.(ptr)
9589 * @param val Change the values of fsm_en in reg EMB_FUNC_EN_B
9590 * @retval Interface status (MANDATORY: return 0 -> no Error).
9591 *
9592 */
9593int32_t ism330dhcx_emb_fsm_en_set(stmdev_ctx_t *ctx, uint8_t val)
9594{
9595 int32_t ret;
9596 ism330dhcx_emb_func_en_b_t emb_func_en_b;
9598
9599 if (ret == 0)
9600 {
9602 (uint8_t *)&emb_func_en_b, 1);
9603 }
9604
9605 if (ret == 0)
9606 {
9607 emb_func_en_b.fsm_en = (uint8_t)val;
9609 (uint8_t *)&emb_func_en_b, 1);
9610 }
9611
9612 if (ret == 0)
9613 {
9615 }
9616
9617 return ret;
9618}
9619
9620/**
9621 * @brief Embedded final state machine functions mode.[get]
9622 *
9623 * @param ctx Read / write interface definitions.(ptr)
9624 * @param val Get the values of fsm_en in reg EMB_FUNC_EN_B
9625 * @retval Interface status (MANDATORY: return 0 -> no Error).
9626 *
9627 */
9628int32_t ism330dhcx_emb_fsm_en_get(stmdev_ctx_t *ctx, uint8_t *val)
9629{
9630 int32_t ret;
9631 ism330dhcx_emb_func_en_b_t emb_func_en_b;
9633
9634 if (ret == 0)
9635 {
9637 (uint8_t *)&emb_func_en_b, 1);
9638 }
9639
9640 if (ret == 0)
9641 {
9642 *val = emb_func_en_b.fsm_en;
9644 (uint8_t *)&emb_func_en_b, 1);
9645 }
9646
9647 if (ret == 0)
9648 {
9650 }
9651
9652 return ret;
9653}
9654
9655/**
9656 * @brief Embedded final state machine functions mode.[set]
9657 *
9658 * @param ctx Read / write interface definitions.(ptr)
9659 * @param val Structure of registers from FSM_ENABLE_A to FSM_ENABLE_B
9660 * @retval Interface status (MANDATORY: return 0 -> no Error).
9661 *
9662 */
9665{
9666 ism330dhcx_emb_func_en_b_t emb_func_en_b;
9667 int32_t ret;
9669
9670 if (ret == 0)
9671 {
9673 (uint8_t *)&val->fsm_enable_a, 1);
9674 }
9675
9676 if (ret == 0)
9677 {
9679 (uint8_t *)&val->fsm_enable_b, 1);
9680 }
9681
9682 if (ret == 0)
9683 {
9685 (uint8_t *)&emb_func_en_b, 1);
9686 }
9687
9688 if (ret == 0)
9689 {
9690 if ((val->fsm_enable_a.fsm1_en |
9691 val->fsm_enable_a.fsm2_en |
9692 val->fsm_enable_a.fsm3_en |
9693 val->fsm_enable_a.fsm4_en |
9694 val->fsm_enable_a.fsm5_en |
9695 val->fsm_enable_a.fsm6_en |
9696 val->fsm_enable_a.fsm7_en |
9697 val->fsm_enable_a.fsm8_en |
9698 val->fsm_enable_b.fsm9_en |
9699 val->fsm_enable_b.fsm10_en |
9700 val->fsm_enable_b.fsm11_en |
9701 val->fsm_enable_b.fsm12_en |
9702 val->fsm_enable_b.fsm13_en |
9703 val->fsm_enable_b.fsm14_en |
9704 val->fsm_enable_b.fsm15_en |
9706 {
9707 emb_func_en_b.fsm_en = PROPERTY_ENABLE;
9708 }
9709
9710 else
9711 {
9712 emb_func_en_b.fsm_en = PROPERTY_DISABLE;
9713 }
9714 }
9715
9716 if (ret == 0)
9717 {
9719 (uint8_t *)&emb_func_en_b, 1);
9720 }
9721
9722 if (ret == 0)
9723 {
9725 }
9726
9727 return ret;
9728}
9729
9730/**
9731 * @brief Embedded final state machine functions mode.[get]
9732 *
9733 * @param ctx Read / write interface definitions.(ptr)
9734 * @param val Structure of registers from FSM_ENABLE_A to FSM_ENABLE_B
9735 * @retval Interface status (MANDATORY: return 0 -> no Error).
9736 *
9737 */
9740{
9741 int32_t ret;
9743
9744 if (ret == 0)
9745 {
9747 (uint8_t *)&val->fsm_enable_a, 1);
9748 }
9749
9750 if (ret == 0)
9751 {
9753 (uint8_t *)&val->fsm_enable_b, 1);
9754 }
9755
9756 if (ret == 0)
9757 {
9759 }
9760
9761 return ret;
9762}
9763
9764/**
9765 * @brief FSM long counter status register. Long counter value is an
9766 * unsigned integer value (16-bit format).[set]
9767 *
9768 * @param ctx Read / write interface definitions.(ptr)
9769 * @param buff Buffer that contains data to write
9770 * @retval Interface status (MANDATORY: return 0 -> no Error).
9771 *
9772 */
9773int32_t ism330dhcx_long_cnt_set(stmdev_ctx_t *ctx, uint16_t val)
9774{
9775 uint8_t buff[2];
9776 int32_t ret;
9777 buff[1] = (uint8_t)(val / 256U);
9778 buff[0] = (uint8_t)(val - (buff[1] * 256U));
9780
9781 if (ret == 0)
9782 {
9784 2);
9785 }
9786
9787 if (ret == 0)
9788 {
9790 }
9791
9792 return ret;
9793}
9794
9795/**
9796 * @brief FSM long counter status register. Long counter value is an
9797 * unsigned integer value (16-bit format).[get]
9798 *
9799 * @param ctx Read / write interface definitions.(ptr)
9800 * @param buff Buffer that stores data read
9801 * @retval Interface status (MANDATORY: return 0 -> no Error).
9802 *
9803 */
9804int32_t ism330dhcx_long_cnt_get(stmdev_ctx_t *ctx, uint16_t *val)
9805{
9806 uint8_t buff[2];
9807 int32_t ret;
9809
9810 if (ret == 0)
9811 {
9813 2);
9814 *val = buff[1];
9815 *val = (*val * 256U) + buff[0];
9816 }
9817
9818 if (ret == 0)
9819 {
9821 }
9822
9823 return ret;
9824}
9825
9826/**
9827 * @brief Clear FSM long counter value.[set]
9828 *
9829 * @param ctx Read / write interface definitions.(ptr)
9830 * @param val Change the values of fsm_lc_clr in reg
9831 * FSM_LONG_COUNTER_CLEAR
9832 * @retval Interface status (MANDATORY: return 0 -> no Error).
9833 *
9834 */
9837{
9838 ism330dhcx_fsm_long_counter_clear_t fsm_long_counter_clear;
9839 int32_t ret;
9841
9842 if (ret == 0)
9843 {
9845 (uint8_t *)&fsm_long_counter_clear, 1);
9846 }
9847
9848 if (ret == 0)
9849 {
9850 fsm_long_counter_clear.fsm_lc_clr = (uint8_t)val;
9852 (uint8_t *)&fsm_long_counter_clear, 1);
9853 }
9854
9855 if (ret == 0)
9856 {
9858 }
9859
9860 return ret;
9861}
9862
9863/**
9864 * @brief Clear FSM long counter value.[get]
9865 *
9866 * @param ctx Read / write interface definitions.(ptr)
9867 * @param val Get the values of fsm_lc_clr in reg FSM_LONG_COUNTER_CLEAR
9868 * @retval Interface status (MANDATORY: return 0 -> no Error).
9869 *
9870 */
9873{
9874 ism330dhcx_fsm_long_counter_clear_t fsm_long_counter_clear;
9875 int32_t ret;
9877
9878 if (ret == 0)
9879 {
9881 (uint8_t *)&fsm_long_counter_clear, 1);
9882 }
9883
9884 if (ret == 0)
9885 {
9887 }
9888
9889 switch (fsm_long_counter_clear.fsm_lc_clr)
9890 {
9892 *val = ISM330DHCX_LC_NORMAL;
9893 break;
9894
9896 *val = ISM330DHCX_LC_CLEAR;
9897 break;
9898
9901 break;
9902
9903 default:
9904 *val = ISM330DHCX_LC_NORMAL;
9905 break;
9906 }
9907
9908 return ret;
9909}
9910
9911/**
9912 * @brief FSM output registers.[get]
9913 *
9914 * @param ctx Read / write interface definitions.(ptr)
9915 * @param val Structure of registers from FSM_OUTS1 to FSM_OUTS16
9916 * @retval Interface status (MANDATORY: return 0 -> no Error).
9917 *
9918 */
9921{
9922 int32_t ret;
9924
9925 if (ret == 0)
9926 {
9928 (uint8_t *)&val->fsm_outs1, 16);
9929 }
9930
9931 if (ret == 0)
9932 {
9934 }
9935
9936 return ret;
9937}
9938
9939/**
9940 * @brief Finite State Machine ODR configuration.[set]
9941 *
9942 * @param ctx Read / write interface definitions.(ptr)
9943 * @param val Change the values of fsm_odr in reg EMB_FUNC_ODR_CFG_B
9944 * @retval Interface status (MANDATORY: return 0 -> no Error).
9945 *
9946 */
9949{
9950 ism330dhcx_emb_func_odr_cfg_b_t emb_func_odr_cfg_b;
9951 int32_t ret;
9953
9954 if (ret == 0)
9955 {
9957 (uint8_t *)&emb_func_odr_cfg_b, 1);
9958 }
9959
9960 if (ret == 0)
9961 {
9962 emb_func_odr_cfg_b.not_used_01 = 3; /* set default values */
9963 emb_func_odr_cfg_b.not_used_02 = 1; /* set default values */
9964 emb_func_odr_cfg_b.fsm_odr = (uint8_t)val;
9966 (uint8_t *)&emb_func_odr_cfg_b, 1);
9967 }
9968
9969 if (ret == 0)
9970 {
9972 }
9973
9974 return ret;
9975}
9976
9977/**
9978 * @brief Finite State Machine ODR configuration.[get]
9979 *
9980 * @param ctx Read / write interface definitions.(ptr)
9981 * @param val Get the values of fsm_odr in reg EMB_FUNC_ODR_CFG_B
9982 * @retval Interface status (MANDATORY: return 0 -> no Error).
9983 *
9984 */
9987{
9988 ism330dhcx_emb_func_odr_cfg_b_t emb_func_odr_cfg_b;
9989 int32_t ret;
9991
9992 if (ret == 0)
9993 {
9995 (uint8_t *)&emb_func_odr_cfg_b, 1);
9996 }
9997
9998 if (ret == 0)
9999 {
10001 }
10002
10003 switch (emb_func_odr_cfg_b.fsm_odr)
10004 {
10007 break;
10008
10011 break;
10012
10015 break;
10016
10019 break;
10020
10021 default:
10023 break;
10024 }
10025
10026 return ret;
10027}
10028
10029/**
10030 * @brief FSM initialization request.[set]
10031 *
10032 * @param ctx Read / write interface definitions.(ptr)
10033 * @param val Change the values of fsm_init in reg FSM_INIT
10034 * @retval Interface status (MANDATORY: return 0 -> no Error).
10035 *
10036 */
10037int32_t ism330dhcx_fsm_init_set(stmdev_ctx_t *ctx, uint8_t val)
10038{
10039 ism330dhcx_emb_func_init_b_t emb_func_init_b;
10040 int32_t ret;
10042
10043 if (ret == 0)
10044 {
10046 (uint8_t *)&emb_func_init_b, 1);
10047 }
10048
10049 if (ret == 0)
10050 {
10051 emb_func_init_b.fsm_init = (uint8_t)val;
10053 (uint8_t *)&emb_func_init_b, 1);
10054 }
10055
10056 if (ret == 0)
10057 {
10059 }
10060
10061 return ret;
10062}
10063
10064/**
10065 * @brief FSM initialization request.[get]
10066 *
10067 * @param ctx Read / write interface definitions.(ptr)
10068 * @param val Change the values of fsm_init in reg FSM_INIT
10069 * @retval Interface status (MANDATORY: return 0 -> no Error).
10070 *
10071 */
10072int32_t ism330dhcx_fsm_init_get(stmdev_ctx_t *ctx, uint8_t *val)
10073{
10074 ism330dhcx_emb_func_init_b_t emb_func_init_b;
10075 int32_t ret;
10077
10078 if (ret == 0)
10079 {
10081 (uint8_t *)&emb_func_init_b, 1);
10082 }
10083
10084 if (ret == 0)
10085 {
10086 *val = emb_func_init_b.fsm_init;
10088 }
10089
10090 return ret;
10091}
10092
10093/**
10094 * @brief FSM long counter timeout register (r/w). The long counter
10095 * timeout value is an unsigned integer value (16-bit format).
10096 * When the long counter value reached this value, the FSM
10097 * generates an interrupt.[set]
10098 *
10099 * @param ctx Read / write interface definitions.(ptr)
10100 * @param buff Buffer that contains data to write
10101 * @retval Interface status (MANDATORY: return 0 -> no Error).
10102 *
10103 */
10105 uint16_t val)
10106{
10107 uint8_t buff[2];
10108 int32_t ret;
10109 uint8_t i;
10110 buff[1] = (uint8_t)(val / 256U);
10111 buff[0] = (uint8_t)(val - (buff[1] * 256U));
10112 i = 0x00U;
10114 &buff[i]);
10115
10116 if (ret == 0)
10117 {
10118 i++;
10120 &buff[i]);
10121 }
10122
10123 return ret;
10124}
10125
10126/**
10127 * @brief FSM long counter timeout register (r/w). The long counter
10128 * timeout value is an unsigned integer value (16-bit format).
10129 * When the long counter value reached this value, the FSM generates
10130 * an interrupt.[get]
10131 *
10132 * @param ctx Read / write interface definitions.(ptr)
10133 * @param buff Buffer that stores data read
10134 * @retval Interface status (MANDATORY: return 0 -> no Error).
10135 *
10136 */
10138 uint16_t *val)
10139{
10140 uint8_t buff[2];
10141 int32_t ret;
10142 uint8_t i;
10143 i = 0x00U;
10145 &buff[i]);
10146
10147 if (ret == 0)
10148 {
10149 i++;
10151 &buff[i]);
10152 *val = buff[1];
10153 *val = (*val * 256U) + buff[0];
10154 }
10155
10156 return ret;
10157}
10158
10159/**
10160 * @brief FSM number of programs register.[set]
10161 *
10162 * @param ctx Read / write interface definitions.(ptr)
10163 * @param buff Buffer that contains data to write
10164 * @retval Interface status (MANDATORY: return 0 -> no Error).
10165 *
10166 */
10168 uint8_t *buff)
10169{
10170 int32_t ret;
10172
10173 if (ret == 0)
10174 {
10177 buff);
10178 }
10179
10180 return ret;
10181}
10182
10183/**
10184 * @brief FSM number of programs register.[get]
10185 *
10186 * @param ctx Read / write interface definitions.(ptr)
10187 * @param buff Buffer that stores data read
10188 * @retval Interface status (MANDATORY: return 0 -> no Error).
10189 *
10190 */
10192 uint8_t *buff)
10193{
10194 int32_t ret;
10196
10197 return ret;
10198}
10199
10200/**
10201 * @brief FSM start address register (r/w). First available address is
10202 * 0x033C.[set]
10203 *
10204 * @param ctx Read / write interface definitions.(ptr)
10205 * @param buff Buffer that contains data to write
10206 * @retval Interface status (MANDATORY: return 0 -> no Error).
10207 *
10208 */
10210 uint16_t val)
10211{
10212 uint8_t buff[2];
10213 int32_t ret;
10214 uint8_t i;
10215 buff[1] = (uint8_t)(val / 256U);
10216 buff[0] = (uint8_t)(val - (buff[1] * 256U));
10217 i = 0x00U;
10219 &buff[i]);
10220
10221 if (ret == 0)
10222 {
10223 i++;
10225 &buff[i]);
10226 }
10227
10228 return ret;
10229}
10230
10231/**
10232 * @brief FSM start address register (r/w). First available address
10233 * is 0x033C.[get]
10234 *
10235 * @param ctx Read / write interface definitions.(ptr)
10236 * @param buff Buffer that stores data read
10237 * @retval Interface status (MANDATORY: return 0 -> no Error).
10238 *
10239 */
10241 uint16_t *val)
10242{
10243 uint8_t buff[2];
10244 int32_t ret;
10245 uint8_t i;
10246 i = 0x00U;
10248 &buff[i]);
10249
10250 if (ret == 0)
10251 {
10252 i++;
10254 &buff[i]);
10255 *val = buff[1];
10256 *val = (*val * 256U) + buff[0];
10257 }
10258
10259 return ret;
10260}
10261
10262/**
10263 * @}
10264 *
10265 */
10266
10267/**
10268 * @addtogroup Machine Learning Core
10269 * @brief This section group all the functions concerning the
10270 * usage of Machine Learning Core
10271 * @{
10272 *
10273 */
10274
10275/**
10276 * @brief Enable Machine Learning Core.[set]
10277 *
10278 * @param ctx read / write interface definitions
10279 * @param val change the values of mlc_en in
10280 * reg EMB_FUNC_EN_B and mlc_init
10281 * in EMB_FUNC_INIT_B
10282 *
10283 */
10284int32_t ism330dhcx_mlc_set(stmdev_ctx_t *ctx, uint8_t val)
10285{
10287 int32_t ret;
10289
10290 if (ret == 0)
10291 {
10293 (uint8_t *)&reg, 1);
10294 }
10295
10296 if (ret == 0)
10297 {
10298 reg.mlc_en = val;
10300 (uint8_t *)&reg, 1);
10301 }
10302
10303 if ((val != PROPERTY_DISABLE) && (ret == 0))
10304 {
10306 (uint8_t *)&reg, 1);
10307
10308 if (ret == 0)
10309 {
10310 reg.mlc_en = val;
10312 (uint8_t *)&reg, 1);
10313 }
10314 }
10315
10316 if (ret == 0)
10317 {
10319 }
10320
10321 return ret;
10322}
10323
10324/**
10325 * @brief Enable Machine Learning Core.[get]
10326 *
10327 * @param ctx read / write interface definitions
10328 * @param val Get the values of mlc_en in
10329 * reg EMB_FUNC_EN_B
10330 *
10331 */
10332int32_t ism330dhcx_mlc_get(stmdev_ctx_t *ctx, uint8_t *val)
10333{
10335 int32_t ret;
10337
10338 if (ret == 0)
10339 {
10341 (uint8_t *)&reg, 1);
10342 }
10343
10344 if (ret == 0)
10345 {
10347 *val = reg.mlc_en;
10348 }
10349
10350 return ret;
10351}
10352
10353/**
10354 * @brief Machine Learning Core status register[get]
10355 *
10356 * @param ctx read / write interface definitions
10357 * @param val register MLC_STATUS_MAINPAGE
10358 *
10359 */
10362{
10364 (uint8_t *) val, 1);
10365}
10366
10367/**
10368 * @brief Machine Learning Core data rate selection.[set]
10369 *
10370 * @param ctx read / write interface definitions
10371 * @param val get the values of mlc_odr in
10372 * reg EMB_FUNC_ODR_CFG_C
10373 *
10374 */
10377{
10379 int32_t ret;
10381
10382 if (ret == 0)
10383 {
10385 (uint8_t *)&reg, 1);
10386 }
10387
10388 if (ret == 0)
10389 {
10390 reg.mlc_odr = (uint8_t)val;
10392 (uint8_t *)&reg, 1);
10393 }
10394
10395 if (ret == 0)
10396 {
10398 }
10399
10400 return ret;
10401}
10402
10403/**
10404 * @brief Machine Learning Core data rate selection.[get]
10405 *
10406 * @param ctx read / write interface definitions
10407 * @param val change the values of mlc_odr in
10408 * reg EMB_FUNC_ODR_CFG_C
10409 *
10410 */
10413{
10415 int32_t ret;
10417
10418 if (ret == 0)
10419 {
10421 (uint8_t *)&reg, 1);
10422 }
10423
10424 if (ret == 0)
10425 {
10426 switch (reg.mlc_odr)
10427 {
10430 break;
10431
10434 break;
10435
10438 break;
10439
10442 break;
10443
10444 default:
10446 break;
10447 }
10448
10450 }
10451
10452 return ret;
10453}
10454
10455/**
10456 * @}
10457 *
10458 */
10459
10460/**
10461 * @defgroup ISM330DHCX_Sensor_hub
10462 * @brief This section groups all the functions that manage the
10463 * sensor hub.
10464 * @{
10465 *
10466 */
10467
10468/**
10469 * @brief Sensor hub output registers.[get]
10470 *
10471 * @param ctx Read / write interface definitions.(ptr)
10472 * @param val Structure of registers from SENSOR_HUB_1 to SENSOR_HUB_18
10473 * @retval Interface status (MANDATORY: return 0 -> no Error).
10474 *
10475 */
10477{
10478 int32_t ret;
10480
10481 if (ret == 0)
10482 {
10484 (uint8_t *)val, len);
10485 }
10486
10487 if (ret == 0)
10488 {
10490 }
10491
10492 return ret;
10493}
10494
10495/**
10496 * @brief Number of external sensors to be read by the sensor hub.[set]
10497 *
10498 * @param ctx Read / write interface definitions.(ptr)
10499 * @param val Change the values of aux_sens_on in reg MASTER_CONFIG
10500 * @retval Interface status (MANDATORY: return 0 -> no Error).
10501 *
10502 */
10505{
10506 ism330dhcx_master_config_t master_config;
10507 int32_t ret;
10509
10510 if (ret == 0)
10511 {
10513 (uint8_t *)&master_config, 1);
10514 }
10515
10516 if (ret == 0)
10517 {
10518 master_config.aux_sens_on = (uint8_t)val;
10520 (uint8_t *)&master_config, 1);
10521 }
10522
10523 if (ret == 0)
10524 {
10526 }
10527
10528 return ret;
10529}
10530
10531/**
10532 * @brief Number of external sensors to be read by the sensor hub.[get]
10533 *
10534 * @param ctx Read / write interface definitions.(ptr)
10535 * @param val Get the values of aux_sens_on in reg MASTER_CONFIG
10536 * @retval Interface status (MANDATORY: return 0 -> no Error).
10537 *
10538 */
10541{
10542 ism330dhcx_master_config_t master_config;
10543 int32_t ret;
10545
10546 if (ret == 0)
10547 {
10549 (uint8_t *)&master_config, 1);
10550 }
10551
10552 if (ret == 0)
10553 {
10555 }
10556
10557 switch (master_config.aux_sens_on)
10558 {
10559 case ISM330DHCX_SLV_0:
10560 *val = ISM330DHCX_SLV_0;
10561 break;
10562
10563 case ISM330DHCX_SLV_0_1:
10564 *val = ISM330DHCX_SLV_0_1;
10565 break;
10566
10568 *val = ISM330DHCX_SLV_0_1_2;
10569 break;
10570
10573 break;
10574
10575 default:
10576 *val = ISM330DHCX_SLV_0;
10577 break;
10578 }
10579
10580 return ret;
10581}
10582
10583/**
10584 * @brief Sensor hub I2C master enable.[set]
10585 *
10586 * @param ctx Read / write interface definitions.(ptr)
10587 * @param val Change the values of master_on in reg MASTER_CONFIG
10588 * @retval Interface status (MANDATORY: return 0 -> no Error).
10589 *
10590 */
10591int32_t ism330dhcx_sh_master_set(stmdev_ctx_t *ctx, uint8_t val)
10592{
10593 ism330dhcx_master_config_t master_config;
10594 int32_t ret;
10596
10597 if (ret == 0)
10598 {
10600 (uint8_t *)&master_config, 1);
10601 }
10602
10603 if (ret == 0)
10604 {
10605 master_config.master_on = (uint8_t)val;
10607 (uint8_t *)&master_config, 1);
10608 }
10609
10610 if (ret == 0)
10611 {
10613 }
10614
10615 return ret;
10616}
10617
10618/**
10619 * @brief Sensor hub I2C master enable.[get]
10620 *
10621 * @param ctx Read / write interface definitions.(ptr)
10622 * @param val Change the values of master_on in reg MASTER_CONFIG
10623 * @retval Interface status (MANDATORY: return 0 -> no Error).
10624 *
10625 */
10626int32_t ism330dhcx_sh_master_get(stmdev_ctx_t *ctx, uint8_t *val)
10627{
10628 ism330dhcx_master_config_t master_config;
10629 int32_t ret;
10631
10632 if (ret == 0)
10633 {
10635 (uint8_t *)&master_config, 1);
10636 }
10637
10638 if (ret == 0)
10639 {
10640 *val = master_config.master_on;
10642 }
10643
10644 return ret;
10645}
10646
10647/**
10648 * @brief Master I2C pull-up enable.[set]
10649 *
10650 * @param ctx Read / write interface definitions.(ptr)
10651 * @param val Change the values of shub_pu_en in reg MASTER_CONFIG
10652 * @retval Interface status (MANDATORY: return 0 -> no Error).
10653 *
10654 */
10657{
10658 ism330dhcx_master_config_t master_config;
10659 int32_t ret;
10661
10662 if (ret == 0)
10663 {
10665 (uint8_t *)&master_config, 1);
10666 }
10667
10668 if (ret == 0)
10669 {
10670 master_config.shub_pu_en = (uint8_t)val;
10672 (uint8_t *)&master_config, 1);
10673 }
10674
10675 if (ret == 0)
10676 {
10678 }
10679
10680 return ret;
10681}
10682
10683/**
10684 * @brief Master I2C pull-up enable.[get]
10685 *
10686 * @param ctx Read / write interface definitions.(ptr)
10687 * @param val Get the values of shub_pu_en in reg MASTER_CONFIG
10688 * @retval Interface status (MANDATORY: return 0 -> no Error).
10689 *
10690 */
10693{
10694 ism330dhcx_master_config_t master_config;
10695 int32_t ret;
10697
10698 if (ret == 0)
10699 {
10701 (uint8_t *)&master_config, 1);
10702 }
10703
10704 if (ret == 0)
10705 {
10707 }
10708
10709 switch (master_config.shub_pu_en)
10710 {
10713 break;
10714
10717 break;
10718
10719 default:
10721 break;
10722 }
10723
10724 return ret;
10725}
10726
10727/**
10728 * @brief I2C interface pass-through.[set]
10729 *
10730 * @param ctx Read / write interface definitions.(ptr)
10731 * @param val Change the values of pass_through_mode in reg MASTER_CONFIG
10732 * @retval Interface status (MANDATORY: return 0 -> no Error).
10733 *
10734 */
10736{
10737 ism330dhcx_master_config_t master_config;
10738 int32_t ret;
10740
10741 if (ret == 0)
10742 {
10744 (uint8_t *)&master_config, 1);
10745 }
10746
10747 if (ret == 0)
10748 {
10749 master_config.pass_through_mode = (uint8_t)val;
10751 (uint8_t *)&master_config, 1);
10752 }
10753
10754 if (ret == 0)
10755 {
10757 }
10758
10759 return ret;
10760}
10761
10762/**
10763 * @brief I2C interface pass-through.[get]
10764 *
10765 * @param ctx Read / write interface definitions.(ptr)
10766 * @param val Change the values of pass_through_mode in reg MASTER_CONFIG
10767 * @retval Interface status (MANDATORY: return 0 -> no Error).
10768 *
10769 */
10771 uint8_t *val)
10772{
10773 ism330dhcx_master_config_t master_config;
10774 int32_t ret;
10776
10777 if (ret == 0)
10778 {
10780 (uint8_t *)&master_config, 1);
10781 }
10782
10783 if (ret == 0)
10784 {
10785 *val = master_config.pass_through_mode;
10787 }
10788
10789 return ret;
10790}
10791
10792/**
10793 * @brief Sensor hub trigger signal selection.[set]
10794 *
10795 * @param ctx Read / write interface definitions.(ptr)
10796 * @param val Change the values of start_config in reg MASTER_CONFIG
10797 * @retval Interface status (MANDATORY: return 0 -> no Error).
10798 *
10799 */
10802{
10803 ism330dhcx_master_config_t master_config;
10804 int32_t ret;
10806
10807 if (ret == 0)
10808 {
10810 (uint8_t *)&master_config, 1);
10811 }
10812
10813 if (ret == 0)
10814 {
10815 master_config.start_config = (uint8_t)val;
10817 (uint8_t *)&master_config, 1);
10818 }
10819
10820 if (ret == 0)
10821 {
10823 }
10824
10825 return ret;
10826}
10827
10828/**
10829 * @brief Sensor hub trigger signal selection.[get]
10830 *
10831 * @param ctx Read / write interface definitions.(ptr)
10832 * @param val Get the values of start_config in reg MASTER_CONFIG
10833 * @retval Interface status (MANDATORY: return 0 -> no Error).
10834 *
10835 */
10838{
10839 ism330dhcx_master_config_t master_config;
10840 int32_t ret;
10842
10843 if (ret == 0)
10844 {
10846 (uint8_t *)&master_config, 1);
10847 }
10848
10849 if (ret == 0)
10850 {
10852 }
10853
10854 switch (master_config.start_config)
10855 {
10858 break;
10859
10861 *val = ISM330DHCX_XL_GY_DRDY;
10862 break;
10863
10864 default:
10866 break;
10867 }
10868
10869 return ret;
10870}
10871
10872/**
10873 * @brief Slave 0 write operation is performed only at the first sensor
10874 * hub cycle.[set]
10875 *
10876 * @param ctx Read / write interface definitions.(ptr)
10877 * @param val Change the values of write_once in reg MASTER_CONFIG
10878 * @retval Interface status (MANDATORY: return 0 -> no Error).
10879 *
10880 */
10883{
10884 ism330dhcx_master_config_t master_config;
10885 int32_t ret;
10887
10888 if (ret == 0)
10889 {
10891 (uint8_t *)&master_config, 1);
10892 }
10893
10894 if (ret == 0)
10895 {
10896 master_config.write_once = (uint8_t)val;
10898 (uint8_t *)&master_config, 1);
10899 }
10900
10901 if (ret == 0)
10902 {
10904 }
10905
10906 return ret;
10907}
10908
10909/**
10910 * @brief Slave 0 write operation is performed only at the first sensor
10911 * hub cycle.[get]
10912 *
10913 * @param ctx Read / write interface definitions.(ptr)
10914 * @param val Get the values of write_once in reg MASTER_CONFIG
10915 * @retval Interface status (MANDATORY: return 0 -> no Error).
10916 *
10917 */
10920{
10921 ism330dhcx_master_config_t master_config;
10922 int32_t ret;
10924
10925 if (ret == 0)
10926 {
10928 (uint8_t *)&master_config, 1);
10929 }
10930
10931 if (ret == 0)
10932 {
10934 }
10935
10936 switch (master_config.write_once)
10937 {
10940 break;
10941
10944 break;
10945
10946 default:
10948 break;
10949 }
10950
10951 return ret;
10952}
10953
10954/**
10955 * @brief Reset Master logic and output registers.[set]
10956 *
10957 * @param ctx Read / write interface definitions.(ptr)
10958 * @retval Interface status (MANDATORY: return 0 -> no Error).
10959 *
10960 */
10962{
10963 ism330dhcx_master_config_t master_config;
10964 int32_t ret;
10966
10967 if (ret == 0)
10968 {
10970 (uint8_t *)&master_config, 1);
10971 }
10972
10973 if (ret == 0)
10974 {
10975 master_config.rst_master_regs = PROPERTY_ENABLE;
10977 (uint8_t *)&master_config, 1);
10978 }
10979
10980 if (ret == 0)
10981 {
10982 master_config.rst_master_regs = PROPERTY_DISABLE;
10984 (uint8_t *)&master_config, 1);
10985 }
10986
10987 if (ret == 0)
10988 {
10990 }
10991
10992 return ret;
10993}
10994
10995/**
10996 * @brief Reset Master logic and output registers.[get]
10997 *
10998 * @param ctx Read / write interface definitions.(ptr)
10999 * @param val Change the values of rst_master_regs in reg MASTER_CONFIG
11000 * @retval Interface status (MANDATORY: return 0 -> no Error).
11001 *
11002 */
11003int32_t ism330dhcx_sh_reset_get(stmdev_ctx_t *ctx, uint8_t *val)
11004{
11005 ism330dhcx_master_config_t master_config;
11006 int32_t ret;
11008
11009 if (ret == 0)
11010 {
11012 (uint8_t *)&master_config, 1);
11013 *val = master_config.rst_master_regs;
11014 }
11015
11016 if (ret == 0)
11017 {
11019 }
11020
11021 return ret;
11022}
11023
11024/**
11025 * @brief Rate at which the master communicates.[set]
11026 *
11027 * @param ctx Read / write interface definitions.(ptr)
11028 * @param val Change the values of shub_odr in reg SLV0_CONFIG
11029 * @retval Interface status (MANDATORY: return 0 -> no Error).
11030 *
11031 */
11034{
11035 ism330dhcx_slv0_config_t slv0_config;
11036 int32_t ret;
11038
11039 if (ret == 0)
11040 {
11042 (uint8_t *)&slv0_config, 1);
11043 }
11044
11045 if (ret == 0)
11046 {
11047 slv0_config.shub_odr = (uint8_t)val;
11049 (uint8_t *)&slv0_config, 1);
11050 }
11051
11052 if (ret == 0)
11053 {
11055 }
11056
11057 return ret;
11058}
11059
11060/**
11061 * @brief Rate at which the master communicates.[get]
11062 *
11063 * @param ctx Read / write interface definitions.(ptr)
11064 * @param val Get the values of shub_odr in reg slv1_CONFIG
11065 * @retval Interface status (MANDATORY: return 0 -> no Error).
11066 *
11067 */
11070{
11071 ism330dhcx_slv0_config_t slv0_config;
11072 int32_t ret;
11074
11075 if (ret == 0)
11076 {
11078 (uint8_t *)&slv0_config, 1);
11079 }
11080
11081 if (ret == 0)
11082 {
11084 }
11085
11086 switch (slv0_config.shub_odr)
11087 {
11090 break;
11091
11094 break;
11095
11098 break;
11099
11102 break;
11103
11104 default:
11106 break;
11107 }
11108
11109 return ret;
11110}
11111
11112/**
11113 * @brief Configure slave 0 for perform a write.[set]
11114 *
11115 * @param ctx Read / write interface definitions.(ptr)
11116 * @param val Structure that contain
11117 * - uint8_t slv0_add; 8 bit i2c device address
11118 * - uint8_t slv0_subadd; 8 bit register device address
11119 * - uint8_t slv0_data; 8 bit data to write
11120 * @retval Interface status (MANDATORY: return 0 -> no Error).
11121 *
11122 */
11125{
11126 ism330dhcx_slv0_add_t slv0_add;
11127 int32_t ret;
11129
11130 if (ret == 0)
11131 {
11132 slv0_add.slave0 = (uint8_t)(val->slv0_add >> 1);
11133 slv0_add.rw_0 = 0;
11135 (uint8_t *) & (slv0_add), 1);
11136 }
11137
11138 if (ret == 0)
11139 {
11141 (uint8_t *) & (val->slv0_subadd), 1);
11142 }
11143
11144 if (ret == 0)
11145 {
11147 (uint8_t *) & (val->slv0_data), 1);
11148 }
11149
11150 if (ret == 0)
11151 {
11153 }
11154
11155 return ret;
11156}
11157
11158/**
11159 * @brief Configure slave 0 for perform a write/read.[get]
11160 *
11161 * @param ctx Read / write interface definitions.(ptr)
11162 * @param val Structure that contain
11163 * - uint8_t slv_add; 8 bit i2c device address
11164 * - uint8_t slv_subadd; 8 bit register device address
11165 * - uint8_t slv_len; num of bit to read
11166 * @retval Interface status (MANDATORY: return 0 -> no Error).
11167 *
11168 */
11171{
11172 ism330dhcx_slv0_config_t slv0_config;
11173 ism330dhcx_slv0_add_t slv0_add;
11174 int32_t ret;
11176
11177 if (ret == 0)
11178 {
11179 slv0_add.slave0 = (uint8_t) val->slv_add >> 1;
11180 slv0_add.rw_0 = 1;
11182 (uint8_t *) & (slv0_add), 1);
11183 }
11184
11185 if (ret == 0)
11186 {
11188 &(val->slv_subadd), 1);
11189 }
11190
11191 if (ret == 0)
11192 {
11194 (uint8_t *)&slv0_config, 1);
11195 }
11196
11197 if (ret == 0)
11198 {
11199 slv0_config.slave0_numop = val->slv_len;
11201 (uint8_t *)&slv0_config, 1);
11202 }
11203
11204 if (ret == 0)
11205 {
11207 }
11208
11209 return ret;
11210}
11211
11212/**
11213 * @brief Configure slave 0 for perform a write/read.[get]
11214 *
11215 * @param ctx Read / write interface definitions.(ptr)
11216 * @param val Structure that contain
11217 * - uint8_t slv_add; 8 bit i2c device address
11218 * - uint8_t slv_subadd; 8 bit register device address
11219 * - uint8_t slv_len; num of bit to read
11220 * @retval Interface status (MANDATORY: return 0 -> no Error).
11221 *
11222 */
11225{
11226 ism330dhcx_slv1_config_t slv1_config;
11227 ism330dhcx_slv1_add_t slv1_add;
11228 int32_t ret;
11230
11231 if (ret == 0)
11232 {
11233 slv1_add.slave1_add = (uint8_t)(val->slv_add >> 1);
11234 slv1_add.r_1 = 1;
11236 (uint8_t *)&slv1_add, 1);
11237 }
11238
11239 if (ret == 0)
11240 {
11242 &(val->slv_subadd), 1);
11243 }
11244
11245 if (ret == 0)
11246 {
11248 (uint8_t *)&slv1_config, 1);
11249 }
11250
11251 if (ret == 0)
11252 {
11253 slv1_config.slave1_numop = val->slv_len;
11255 (uint8_t *)&slv1_config, 1);
11256 }
11257
11258 if (ret == 0)
11259 {
11261 }
11262
11263 return ret;
11264}
11265
11266/**
11267 * @brief Configure slave 2 for perform a write/read.[get]
11268 *
11269 * @param ctx Read / write interface definitions.(ptr)
11270 * @param val Structure that contain
11271 * - uint8_t slv_add; 8 bit i2c device address
11272 * - uint8_t slv_subadd; 8 bit register device address
11273 * - uint8_t slv_len; num of bit to read
11274 * @retval Interface status (MANDATORY: return 0 -> no Error).
11275 *
11276 */
11279{
11280 ism330dhcx_slv2_config_t slv2_config;
11281 ism330dhcx_slv2_add_t slv2_add;
11282 int32_t ret;
11284
11285 if (ret == 0)
11286 {
11287 slv2_add.slave2_add = (uint8_t)(val->slv_add >> 1);
11288 slv2_add.r_2 = 1;
11290 (uint8_t *)&slv2_add, 1);
11291 }
11292
11293 if (ret == 0)
11294 {
11296 (uint8_t *) & (val->slv_subadd), 1);
11297 }
11298
11299 if (ret == 0)
11300 {
11302 (uint8_t *)&slv2_config, 1);
11303 }
11304
11305 if (ret == 0)
11306 {
11307 slv2_config.slave2_numop = val->slv_len;
11309 (uint8_t *)&slv2_config, 1);
11310 }
11311
11312 if (ret == 0)
11313 {
11315 }
11316
11317 return ret;
11318}
11319
11320/**
11321 * @brief Configure slave 3 for perform a write/read.[get]
11322 *
11323 * @param ctx Read / write interface definitions.(ptr)
11324 * @param val Structure that contain
11325 * - uint8_t slv_add; 8 bit i2c device address
11326 * - uint8_t slv_subadd; 8 bit register device address
11327 * - uint8_t slv_len; num of bit to read
11328 * @retval Interface status (MANDATORY: return 0 -> no Error).
11329 *
11330 */
11333{
11334 ism330dhcx_slv3_config_t slv3_config;
11335 ism330dhcx_slv3_add_t slv3_add;
11336 int32_t ret;
11338
11339 if (ret == 0)
11340 {
11341 slv3_add.slave3_add = (uint8_t)(val->slv_add >> 1);
11342 slv3_add.r_3 = 1;
11344 (uint8_t *)&slv3_add, 1);
11345 }
11346
11347 if (ret == 0)
11348 {
11350 &(val->slv_subadd), 1);
11351 }
11352
11353 if (ret == 0)
11354 {
11356 (uint8_t *)&slv3_config, 1);
11357 }
11358
11359 if (ret == 0)
11360 {
11361 slv3_config.slave3_numop = val->slv_len;
11363 (uint8_t *)&slv3_config, 1);
11364 }
11365
11366 if (ret == 0)
11367 {
11369 }
11370
11371 return ret;
11372}
11373
11374/**
11375 * @brief Sensor hub source register.[get]
11376 *
11377 * @param ctx Read / write interface definitions.(ptr)
11378 * @param val Registers from STATUS_MASTER
11379 * @retval Interface status (MANDATORY: return 0 -> no Error).
11380 *
11381 */
11384{
11385 int32_t ret;
11387
11388 if (ret == 0)
11389 {
11391 (uint8_t *)val, 1);
11392 }
11393
11394 if (ret == 0)
11395 {
11397 }
11398
11399 return ret;
11400}
11401
11402/**
11403 * @}
11404 *
11405 */
11406
11407/**
11408 * @}
11409 *
11410 */
11411
11412/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
uint8_t reg
int32_t ism330dhcx_den_mode_set(stmdev_ctx_t *ctx, ism330dhcx_den_mode_t val)
DEN functionality marking mode.
int32_t ism330dhcx_den_polarity_set(stmdev_ctx_t *ctx, ism330dhcx_den_lh_t val)
DEN active level configuration.
int32_t ism330dhcx_den_mark_axis_z_get(stmdev_ctx_t *ctx, uint8_t *val)
DEN value stored in LSB of Z-axis.
int32_t ism330dhcx_den_mark_axis_y_set(stmdev_ctx_t *ctx, uint8_t val)
DEN value stored in LSB of Y-axis.
int32_t ism330dhcx_den_mode_get(stmdev_ctx_t *ctx, ism330dhcx_den_mode_t *val)
DEN functionality marking mode.
int32_t ism330dhcx_den_mark_axis_x_get(stmdev_ctx_t *ctx, uint8_t *val)
DEN value stored in LSB of X-axis.
int32_t ism330dhcx_den_enable_set(stmdev_ctx_t *ctx, ism330dhcx_den_xl_g_t val)
DEN configuration.
int32_t ism330dhcx_den_mark_axis_z_set(stmdev_ctx_t *ctx, uint8_t val)
DEN value stored in LSB of Z-axis.
int32_t ism330dhcx_den_mark_axis_y_get(stmdev_ctx_t *ctx, uint8_t *val)
DEN value stored in LSB of Y-axis.
int32_t ism330dhcx_den_enable_get(stmdev_ctx_t *ctx, ism330dhcx_den_xl_g_t *val)
DEN configuration.
int32_t ism330dhcx_den_mark_axis_x_set(stmdev_ctx_t *ctx, uint8_t val)
DEN value stored in LSB of X-axis.
int32_t ism330dhcx_den_polarity_get(stmdev_ctx_t *ctx, ism330dhcx_den_lh_t *val)
DEN active level configuration.
int32_t ism330dhcx_angular_rate_raw_get(stmdev_ctx_t *ctx, int16_t *val)
Angular rate sensor.
int32_t ism330dhcx_rounding_mode_get(stmdev_ctx_t *ctx, ism330dhcx_rounding_t *val)
Gyroscope UI chain full-scale selection.
int32_t ism330dhcx_fifo_out_raw_get(stmdev_ctx_t *ctx, uint8_t *buff)
FIFO data output.
int32_t ism330dhcx_steps_reset(stmdev_ctx_t *ctx)
Reset step counter register.
int32_t ism330dhcx_temperature_raw_get(stmdev_ctx_t *ctx, int16_t *val)
Temperature data output register (r).
int32_t ism330dhcx_rounding_mode_set(stmdev_ctx_t *ctx, ism330dhcx_rounding_t val)
Circular burst-mode (rounding) read of the output registers.
int32_t ism330dhcx_mlc_out_get(stmdev_ctx_t *ctx, uint8_t *buff)
prgsens_out: [get] Output value of all MLCx decision trees.
int32_t ism330dhcx_acceleration_raw_get(stmdev_ctx_t *ctx, int16_t *val)
Linear acceleration output register.
int32_t ism330dhcx_number_of_steps_get(stmdev_ctx_t *ctx, uint16_t *val)
Step counter output register.
int32_t ism330dhcx_read_reg(stmdev_ctx_t *ctx, uint8_t reg, uint8_t *data, uint16_t len)
Read generic device register.
int32_t ism330dhcx_write_reg(stmdev_ctx_t *ctx, uint8_t reg, uint8_t *data, uint16_t len)
Write generic device register.
int32_t ism330dhcx_pedo_int_mode_set(stmdev_ctx_t *ctx, ism330dhcx_carry_count_en_t val)
Set when user wants to generate interrupt on count overflow event/every step.
int32_t ism330dhcx_pedo_int_mode_get(stmdev_ctx_t *ctx, ism330dhcx_carry_count_en_t *val)
Set when user wants to generate interrupt on count overflow event/every step.
int32_t ism330dhcx_pedo_steps_period_set(stmdev_ctx_t *ctx, uint16_t val)
Time period register for step detection on delta time (r/w).
int32_t ism330dhcx_pedo_step_detect_get(stmdev_ctx_t *ctx, uint8_t *val)
Interrupt status bit for step detection.
int32_t ism330dhcx_pedo_sens_set(stmdev_ctx_t *ctx, uint8_t val)
Enable pedometer algorithm.
int32_t ism330dhcx_pedo_steps_period_get(stmdev_ctx_t *ctx, uint16_t *val)
Time period register for step detection on delta time (r/w).
int32_t ism330dhcx_pedo_debounce_steps_set(stmdev_ctx_t *ctx, uint8_t *buff)
Pedometer debounce configuration register (r/w).
int32_t ism330dhcx_pedo_debounce_steps_get(stmdev_ctx_t *ctx, uint8_t *buff)
Pedometer debounce configuration register (r/w).
int32_t ism330dhcx_pedo_sens_get(stmdev_ctx_t *ctx, uint8_t *val)
Enable pedometer algorithm.
float ism330dhcx_from_fs8g_to_mg(int16_t lsb)
float ism330dhcx_from_fs4000dps_to_mdps(int16_t lsb)
float ism330dhcx_from_fs2g_to_mg(int16_t lsb)
float ism330dhcx_from_fs4g_to_mg(int16_t lsb)
float ism330dhcx_from_lsb_to_celsius(int16_t lsb)
float ism330dhcx_from_fs250dps_to_mdps(int16_t lsb)
float ism330dhcx_from_fs125dps_to_mdps(int16_t lsb)
float ism330dhcx_from_fs2000dps_to_mdps(int16_t lsb)
float ism330dhcx_from_fs500dps_to_mdps(int16_t lsb)
float ism330dhcx_from_fs1000dps_to_mdps(int16_t lsb)
float ism330dhcx_from_fs16g_to_mg(int16_t lsb)
float ism330dhcx_from_lsb_to_nsec(int32_t lsb)
int32_t ism330dhcx_sh_status_get(stmdev_ctx_t *ctx, ism330dhcx_status_master_t *val)
Sensor hub source register.
int32_t ism330dhcx_sh_master_get(stmdev_ctx_t *ctx, uint8_t *val)
Sensor hub I2C master enable.
int32_t ism330dhcx_sh_data_rate_get(stmdev_ctx_t *ctx, ism330dhcx_shub_odr_t *val)
Rate at which the master communicates.
int32_t ism330dhcx_sh_slv2_cfg_read(stmdev_ctx_t *ctx, ism330dhcx_sh_cfg_read_t *val)
Configure slave 2 for perform a write/read.
int32_t ism330dhcx_sh_pin_mode_set(stmdev_ctx_t *ctx, ism330dhcx_shub_pu_en_t val)
Master I2C pull-up enable.
int32_t ism330dhcx_sh_pass_through_set(stmdev_ctx_t *ctx, uint8_t val)
I2C interface pass-through.
int32_t ism330dhcx_sh_data_rate_set(stmdev_ctx_t *ctx, ism330dhcx_shub_odr_t val)
Rate at which the master communicates.
int32_t ism330dhcx_sh_slv1_cfg_read(stmdev_ctx_t *ctx, ism330dhcx_sh_cfg_read_t *val)
Configure slave 0 for perform a write/read.
int32_t ism330dhcx_sh_master_set(stmdev_ctx_t *ctx, uint8_t val)
Sensor hub I2C master enable.
int32_t ism330dhcx_sh_reset_set(stmdev_ctx_t *ctx)
Reset Master logic and output registers.
int32_t ism330dhcx_sh_slv0_cfg_read(stmdev_ctx_t *ctx, ism330dhcx_sh_cfg_read_t *val)
Configure slave 0 for perform a write/read.
int32_t ism330dhcx_sh_write_mode_get(stmdev_ctx_t *ctx, ism330dhcx_write_once_t *val)
Slave 0 write operation is performed only at the first sensor hub cycle.
int32_t ism330dhcx_sh_syncro_mode_get(stmdev_ctx_t *ctx, ism330dhcx_start_config_t *val)
Sensor hub trigger signal selection.
int32_t ism330dhcx_sh_pin_mode_get(stmdev_ctx_t *ctx, ism330dhcx_shub_pu_en_t *val)
Master I2C pull-up enable.
int32_t ism330dhcx_sh_write_mode_set(stmdev_ctx_t *ctx, ism330dhcx_write_once_t val)
Slave 0 write operation is performed only at the first sensor hub cycle.
int32_t ism330dhcx_sh_slave_connected_get(stmdev_ctx_t *ctx, ism330dhcx_aux_sens_on_t *val)
Number of external sensors to be read by the sensor hub.
int32_t ism330dhcx_sh_slave_connected_set(stmdev_ctx_t *ctx, ism330dhcx_aux_sens_on_t val)
Number of external sensors to be read by the sensor hub.
int32_t ism330dhcx_sh_slv3_cfg_read(stmdev_ctx_t *ctx, ism330dhcx_sh_cfg_read_t *val)
Configure slave 3 for perform a write/read.
int32_t ism330dhcx_sh_cfg_write(stmdev_ctx_t *ctx, ism330dhcx_sh_cfg_write_t *val)
Configure slave 0 for perform a write.
int32_t ism330dhcx_sh_reset_get(stmdev_ctx_t *ctx, uint8_t *val)
Reset Master logic and output registers.
int32_t ism330dhcx_sh_pass_through_get(stmdev_ctx_t *ctx, uint8_t *val)
I2C interface pass-through.
int32_t ism330dhcx_sh_read_data_raw_get(stmdev_ctx_t *ctx, ism330dhcx_emb_sh_read_t *val, uint8_t len)
Sensor hub output registers.
int32_t ism330dhcx_sh_syncro_mode_set(stmdev_ctx_t *ctx, ism330dhcx_start_config_t val)
Sensor hub trigger signal selection.
int32_t ism330dhcx_timestamp_raw_get(stmdev_ctx_t *ctx, uint32_t *val)
Timestamp first data output register (r).
int32_t ism330dhcx_timestamp_set(stmdev_ctx_t *ctx, uint8_t val)
Enables timestamp counter.
int32_t ism330dhcx_timestamp_get(stmdev_ctx_t *ctx, uint8_t *val)
Enables timestamp counter.
int32_t ism330dhcx_timestamp_rst(stmdev_ctx_t *ctx)
Reset timestamp counter.
int32_t ism330dhcx_wkup_threshold_get(stmdev_ctx_t *ctx, uint8_t *val)
Threshold for wakeup: 1 LSB weight depends on WAKE_THS_W in WAKE_UP_DUR.
int32_t ism330dhcx_wkup_ths_weight_get(stmdev_ctx_t *ctx, ism330dhcx_wake_ths_w_t *val)
Weight of 1 LSB of wakeup threshold.
int32_t ism330dhcx_wkup_threshold_set(stmdev_ctx_t *ctx, uint8_t val)
Threshold for wakeup: 1 LSB weight depends on WAKE_THS_W in WAKE_UP_DUR.
int32_t ism330dhcx_wkup_ths_weight_set(stmdev_ctx_t *ctx, ism330dhcx_wake_ths_w_t val)
Weight of 1 LSB of wakeup threshold.
int32_t ism330dhcx_wkup_dur_set(stmdev_ctx_t *ctx, uint8_t val)
Wake up duration event(1LSb = 1 / ODR).
int32_t ism330dhcx_xl_usr_offset_on_wkup_set(stmdev_ctx_t *ctx, uint8_t val)
Wake up duration event( 1LSb = 1 / ODR ).
int32_t ism330dhcx_xl_usr_offset_on_wkup_get(stmdev_ctx_t *ctx, uint8_t *val)
Wake up duration event( 1LSb = 1 / ODR ).
int32_t ism330dhcx_wkup_dur_get(stmdev_ctx_t *ctx, uint8_t *val)
Wake up duration event(1LSb = 1 / ODR).
int32_t ism330dhcx_aux_gy_lp1_bandwidth_set(stmdev_ctx_t *ctx, ism330dhcx_ftype_ois_t val)
Selects gyroscope digital LPF1 filter bandwidth.
int32_t ism330dhcx_aux_gy_clamp_set(stmdev_ctx_t *ctx, ism330dhcx_st_ois_clampdis_t val)
Enable / Disables OIS chain clamp.
int32_t ism330dhcx_act_pin_notification_set(stmdev_ctx_t *ctx, ism330dhcx_sleep_status_on_int_t val)
Drives the sleep status instead of sleep change on INT pins (only if INT1_SLEEP_CHANGE or INT2_SLEEP_...
int32_t ism330dhcx_act_sleep_dur_get(stmdev_ctx_t *ctx, uint8_t *val)
Duration to go in sleep mode.
int32_t ism330dhcx_aux_xl_self_test_set(stmdev_ctx_t *ctx, ism330dhcx_st_xl_ois_t val)
Selects accelerometer self-test.
int32_t ism330dhcx_mag_offset_set(stmdev_ctx_t *ctx, int16_t *val)
Offset for hard-iron compensation register (r/w).
int32_t ism330dhcx_aux_mode_set(stmdev_ctx_t *ctx, ism330dhcx_ois_en_spi2_t val)
Enables OIS chain data processing for gyro in Mode 3 and Mode 4 (mode4_en = 1) and accelerometer data...
int32_t ism330dhcx_aux_den_polarity_set(stmdev_ctx_t *ctx, ism330dhcx_den_lh_ois_t val)
Indicates polarity of DEN signal on OIS chain.
int32_t ism330dhcx_mag_offset_get(stmdev_ctx_t *ctx, int16_t *val)
Offset for hard-iron compensation register (r/w).
int32_t ism330dhcx_aux_xl_self_test_get(stmdev_ctx_t *ctx, ism330dhcx_st_xl_ois_t *val)
Selects accelerometer self-test.
int32_t ism330dhcx_mag_y_orient_set(stmdev_ctx_t *ctx, ism330dhcx_mag_y_axis_t val)
Magnetometer Y-axis coordinates rotation (to be aligned to accelerometer/gyroscope axes orientation).
int32_t ism330dhcx_mag_x_orient_set(stmdev_ctx_t *ctx, ism330dhcx_mag_x_axis_t val)
Magnetometer X-axis coordinates rotation (to be aligned to accelerometer/gyroscope axes orientation).
int32_t ism330dhcx_aux_status_reg_get(stmdev_ctx_t *ctx, ism330dhcx_status_spiaux_t *val)
The STATUS_SPIAux register is read by the auxiliary SPI.
int32_t ism330dhcx_aux_gy_lp1_bandwidth_get(stmdev_ctx_t *ctx, ism330dhcx_ftype_ois_t *val)
Selects gyroscope digital LPF1 filter bandwidth.
int32_t ism330dhcx_4d_mode_get(stmdev_ctx_t *ctx, uint8_t *val)
4D orientation detection enable.
int32_t ism330dhcx_aux_drdy_on_int2_set(stmdev_ctx_t *ctx, uint8_t val)
Enables/Disable OIS chain DRDY on INT2 pin.
int32_t ism330dhcx_aux_spi_mode_get(stmdev_ctx_t *ctx, ism330dhcx_sim_ois_t *val)
SPI2 3- or 4-wire interface.
int32_t ism330dhcx_gy_sleep_mode_set(stmdev_ctx_t *ctx, uint8_t val)
Enables gyroscope Sleep mode.
int32_t ism330dhcx_aux_xl_bandwidth_get(stmdev_ctx_t *ctx, ism330dhcx_filter_xl_conf_ois_t *val)
Selects accelerometer OIS channel bandwidth.
int32_t ism330dhcx_aux_den_polarity_get(stmdev_ctx_t *ctx, ism330dhcx_den_lh_ois_t *val)
Indicates polarity of DEN signal on OIS chain.
int32_t ism330dhcx_spi_mode_get(stmdev_ctx_t *ctx, ism330dhcx_sim_t *val)
SPI Serial Interface Mode selection.
int32_t ism330dhcx_aux_gy_self_test_set(stmdev_ctx_t *ctx, ism330dhcx_st_ois_t val)
Selects gyroscope OIS chain self-test.
int32_t ism330dhcx_aux_gy_flag_data_ready_get(stmdev_ctx_t *ctx, uint8_t *val)
AUX gyroscope data available.
int32_t ism330dhcx_aux_gy_hp_bandwidth_get(stmdev_ctx_t *ctx, ism330dhcx_hpm_ois_t *val)
Selects gyroscope OIS chain digital high-pass filter cutoff.
int32_t ism330dhcx_aux_xl_bandwidth_set(stmdev_ctx_t *ctx, ism330dhcx_filter_xl_conf_ois_t val)
Selects accelerometer OIS channel bandwidth.
int32_t ism330dhcx_act_mode_set(stmdev_ctx_t *ctx, ism330dhcx_inact_en_t val)
Enable inactivity function.
int32_t ism330dhcx_sdo_sa0_mode_set(stmdev_ctx_t *ctx, ism330dhcx_sdo_pu_en_t val)
Connect/Disconnect SDO/SA0 internal pull-up.
int32_t ism330dhcx_mag_z_orient_set(stmdev_ctx_t *ctx, ism330dhcx_mag_z_axis_t val)
Magnetometer Z-axis coordinates rotation (to be aligned to accelerometer/gyroscope axes orientation).
int32_t ism330dhcx_aux_sdo_ocs_mode_set(stmdev_ctx_t *ctx, ism330dhcx_ois_pu_dis_t val)
On auxiliary interface connect/disconnect SDO and OCS internal pull-up.
int32_t ism330dhcx_aux_pw_on_ctrl_set(stmdev_ctx_t *ctx, ism330dhcx_ois_on_t val)
OIS chain on aux interface power on mode.
int32_t ism330dhcx_aux_gy_clamp_get(stmdev_ctx_t *ctx, ism330dhcx_st_ois_clampdis_t *val)
Enable / Disables OIS chain clamp.
int32_t ism330dhcx_aux_den_mode_set(stmdev_ctx_t *ctx, ism330dhcx_lvl2_ois_t val)
Configure DEN mode on the OIS chain.
int32_t ism330dhcx_aux_spi_mode_set(stmdev_ctx_t *ctx, ism330dhcx_sim_ois_t val)
SPI2 3- or 4-wire interface.
int32_t ism330dhcx_aux_xl_flag_data_ready_get(stmdev_ctx_t *ctx, uint8_t *val)
AUX accelerometer data available.
int32_t ism330dhcx_6d_threshold_set(stmdev_ctx_t *ctx, ism330dhcx_sixd_ths_t val)
Threshold for 4D/6D function.
int32_t ism330dhcx_6d_threshold_get(stmdev_ctx_t *ctx, ism330dhcx_sixd_ths_t *val)
Threshold for 4D/6D function.
int32_t ism330dhcx_mag_soft_iron_get(stmdev_ctx_t *ctx, uint16_t *val)
Soft-iron (3x3 symmetric) matrix correction register (r/w).
int32_t ism330dhcx_mag_x_orient_get(stmdev_ctx_t *ctx, ism330dhcx_mag_x_axis_t *val)
Magnetometer X-axis coordinates rotation (to be aligned to accelerometer/gyroscope axes orientation).
int32_t ism330dhcx_aux_gy_flag_settling_get(stmdev_ctx_t *ctx, uint8_t *val)
High when the gyroscope output is in the settling phase.
int32_t ism330dhcx_aux_mode_get(stmdev_ctx_t *ctx, ism330dhcx_ois_en_spi2_t *val)
Enables OIS chain data processing for gyro in Mode 3 and Mode 4 (mode4_en = 1) and accelerometer data...
int32_t ism330dhcx_aux_sdo_ocs_mode_get(stmdev_ctx_t *ctx, ism330dhcx_ois_pu_dis_t *val)
On auxiliary interface connect/disconnect SDO and OCS internal pull-up.
int32_t ism330dhcx_aux_xl_full_scale_get(stmdev_ctx_t *ctx, ism330dhcx_fs_xl_ois_t *val)
Selects accelerometer OIS channel full-scale.
int32_t ism330dhcx_mag_soft_iron_set(stmdev_ctx_t *ctx, uint16_t *val)
Soft-iron (3x3 symmetric) matrix correction register (r/w).
int32_t ism330dhcx_mag_sensitivity_set(stmdev_ctx_t *ctx, uint16_t val)
External magnetometer sensitivity value register.
int32_t ism330dhcx_4d_mode_set(stmdev_ctx_t *ctx, uint8_t val)
4D orientation detection enable.
int32_t ism330dhcx_gy_sleep_mode_get(stmdev_ctx_t *ctx, uint8_t *val)
Enables gyroscope Sleep mode.
int32_t ism330dhcx_aux_gy_full_scale_get(stmdev_ctx_t *ctx, ism330dhcx_fs_g_ois_t *val)
Selects gyroscope OIS chain full-scale.
int32_t ism330dhcx_act_pin_notification_get(stmdev_ctx_t *ctx, ism330dhcx_sleep_status_on_int_t *val)
Drives the sleep status instead of sleep change on INT pins (only if INT1_SLEEP_CHANGE or INT2_SLEEP_...
int32_t ism330dhcx_mag_z_orient_get(stmdev_ctx_t *ctx, ism330dhcx_mag_z_axis_t *val)
Magnetometer Z-axis coordinates rotation (to be aligned to accelerometer/gyroscope axes orientation).
int32_t ism330dhcx_sdo_sa0_mode_get(stmdev_ctx_t *ctx, ism330dhcx_sdo_pu_en_t *val)
Connect/Disconnect SDO/SA0 internal pull-up.
int32_t ism330dhcx_aux_drdy_on_int2_get(stmdev_ctx_t *ctx, uint8_t *val)
Enables/Disable OIS chain DRDY on INT2 pin.
int32_t ism330dhcx_mag_y_orient_get(stmdev_ctx_t *ctx, ism330dhcx_mag_y_axis_t *val)
Magnetometer Y-axis coordinates rotation (to be aligned to accelerometer/gyroscope axes orientation).
int32_t ism330dhcx_act_mode_get(stmdev_ctx_t *ctx, ism330dhcx_inact_en_t *val)
Enable inactivity function.
int32_t ism330dhcx_aux_gy_self_test_get(stmdev_ctx_t *ctx, ism330dhcx_st_ois_t *val)
Selects gyroscope OIS chain self-test.
int32_t ism330dhcx_aux_den_mode_get(stmdev_ctx_t *ctx, ism330dhcx_lvl2_ois_t *val)
Configure DEN mode on the OIS chain.
int32_t ism330dhcx_aux_pw_on_ctrl_get(stmdev_ctx_t *ctx, ism330dhcx_ois_on_t *val)
OIS chain on aux interface power on mode[get].
int32_t ism330dhcx_mag_sensitivity_get(stmdev_ctx_t *ctx, uint16_t *val)
External magnetometer sensitivity value register.
int32_t ism330dhcx_i2c_interface_set(stmdev_ctx_t *ctx, ism330dhcx_i2c_disable_t val)
Disable / Enable I2C interface.
int32_t ism330dhcx_aux_gy_full_scale_set(stmdev_ctx_t *ctx, ism330dhcx_fs_g_ois_t val)
Selects gyroscope OIS chain full-scale.
int32_t ism330dhcx_spi_mode_set(stmdev_ctx_t *ctx, ism330dhcx_sim_t val)
SPI Serial Interface Mode selection.
int32_t ism330dhcx_aux_gy_hp_bandwidth_set(stmdev_ctx_t *ctx, ism330dhcx_hpm_ois_t val)
Selects gyroscope OIS chain digital high-pass filter cutoff.
int32_t ism330dhcx_aux_xl_full_scale_set(stmdev_ctx_t *ctx, ism330dhcx_fs_xl_ois_t val)
Selects accelerometer OIS channel full-scale.
int32_t ism330dhcx_i2c_interface_get(stmdev_ctx_t *ctx, ism330dhcx_i2c_disable_t *val)
Disable / Enable I2C interface.
int32_t ism330dhcx_act_sleep_dur_set(stmdev_ctx_t *ctx, uint8_t val)
Duration to go in sleep mode (1 LSb = 512 / ODR).
int32_t ism330dhcx_device_conf_get(stmdev_ctx_t *ctx, uint8_t *val)
DEVICE_CONF bit configuration[get].
int32_t ism330dhcx_ln_pg_write_byte(stmdev_ctx_t *ctx, uint16_t add, uint8_t *val)
Write a line(byte) in a page.
int32_t ism330dhcx_gy_self_test_get(stmdev_ctx_t *ctx, ism330dhcx_st_g_t *val)
Angular rate sensor self-test enable.
int32_t ism330dhcx_device_id_get(stmdev_ctx_t *ctx, uint8_t *buff)
Device Who am I.
int32_t ism330dhcx_xl_self_test_get(stmdev_ctx_t *ctx, ism330dhcx_st_xl_t *val)
Linear acceleration sensor self-test enable.
int32_t ism330dhcx_odr_cal_reg_set(stmdev_ctx_t *ctx, uint8_t val)
Difference in percentage of the effective ODR (and timestamp rate) with respect to the typical.
int32_t ism330dhcx_ln_pg_write(stmdev_ctx_t *ctx, uint16_t add, uint8_t *buf, uint8_t len)
Write buffer in a page.
int32_t ism330dhcx_auto_increment_set(stmdev_ctx_t *ctx, uint8_t val)
Register address automatically incremented during a multiple byte access with a serial interface.
int32_t ism330dhcx_boot_get(stmdev_ctx_t *ctx, uint8_t *val)
Reboot memory content.
int32_t ism330dhcx_reset_get(stmdev_ctx_t *ctx, uint8_t *val)
Software reset.
int32_t ism330dhcx_data_ready_mode_get(stmdev_ctx_t *ctx, ism330dhcx_dataready_pulsed_t *val)
Data-ready pulsed / letched mode.
int32_t ism330dhcx_mem_bank_get(stmdev_ctx_t *ctx, ism330dhcx_reg_access_t *val)
Enable access to the embedded functions/sensor hub configuration registers.
int32_t ism330dhcx_boot_set(stmdev_ctx_t *ctx, uint8_t val)
Reboot memory content.
int32_t ism330dhcx_gy_self_test_set(stmdev_ctx_t *ctx, ism330dhcx_st_g_t val)
Angular rate sensor self-test enable.
int32_t ism330dhcx_ln_pg_read_byte(stmdev_ctx_t *ctx, uint16_t add, uint8_t *val)
Read a line(byte) in a page.
int32_t ism330dhcx_data_ready_mode_set(stmdev_ctx_t *ctx, ism330dhcx_dataready_pulsed_t val)
Data-ready pulsed / letched mode.
int32_t ism330dhcx_auto_increment_get(stmdev_ctx_t *ctx, uint8_t *val)
Register address automatically incremented during a multiple byte access with a serial interface.
int32_t ism330dhcx_reset_set(stmdev_ctx_t *ctx, uint8_t val)
Software reset.
int32_t ism330dhcx_xl_self_test_set(stmdev_ctx_t *ctx, ism330dhcx_st_xl_t val)
Linear acceleration sensor self-test enable.
int32_t ism330dhcx_mem_bank_set(stmdev_ctx_t *ctx, ism330dhcx_reg_access_t val)
Enable access to the embedded functions/sensor hub configuration registers.
int32_t ism330dhcx_device_conf_set(stmdev_ctx_t *ctx, uint8_t val)
DEVICE_CONF bit configuration[set].
int32_t ism330dhcx_odr_cal_reg_get(stmdev_ctx_t *ctx, uint8_t *val)
Difference in percentage of the effective ODR (and timestamp rate) with respect to the typical.
int32_t ism330dhcx_fifo_mode_get(stmdev_ctx_t *ctx, ism330dhcx_fifo_mode_t *val)
FIFO mode selection.
int32_t ism330dhcx_fifo_xl_batch_set(stmdev_ctx_t *ctx, ism330dhcx_bdr_xl_t val)
Selects Batching Data Rate (writing frequency in FIFO) for accelerometer data.
int32_t ism330dhcx_fifo_temp_batch_set(stmdev_ctx_t *ctx, ism330dhcx_odr_t_batch_t val)
Selects Batching Data Rate (writing frequency in FIFO) for temperature data.
int32_t ism330dhcx_sh_batch_slave_0_set(stmdev_ctx_t *ctx, uint8_t val)
Enable FIFO batching data of first slave.
int32_t ism330dhcx_fifo_gy_batch_set(stmdev_ctx_t *ctx, ism330dhcx_bdr_gy_t val)
Selects Batching Data Rate (writing frequency in FIFO) for gyroscope data.
int32_t ism330dhcx_fifo_pedo_batch_set(stmdev_ctx_t *ctx, uint8_t val)
Enable FIFO batching of pedometer embedded function values.
int32_t ism330dhcx_compression_algo_get(stmdev_ctx_t *ctx, ism330dhcx_uncoptr_rate_t *val)
Enable and configure compression algo.
int32_t ism330dhcx_fifo_watermark_get(stmdev_ctx_t *ctx, uint16_t *val)
FIFO watermark level selection.
int32_t ism330dhcx_sh_batch_slave_1_get(stmdev_ctx_t *ctx, uint8_t *val)
Enable FIFO batching data of second slave.
int32_t ism330dhcx_fifo_watermark_set(stmdev_ctx_t *ctx, uint16_t val)
FIFO watermark level selection.
int32_t ism330dhcx_fifo_virtual_sens_odr_chg_set(stmdev_ctx_t *ctx, uint8_t val)
Enables ODR CHANGE virtual sensor to be batched in FIFO.
int32_t ism330dhcx_compression_algo_real_time_get(stmdev_ctx_t *ctx, uint8_t *val)
Enables/Disables compression algorithm runtime.
int32_t ism330dhcx_fifo_ovr_flag_get(stmdev_ctx_t *ctx, uint8_t *val)
FIFO overrun status.
int32_t ism330dhcx_fifo_temp_batch_get(stmdev_ctx_t *ctx, ism330dhcx_odr_t_batch_t *val)
Selects Batching Data Rate (writing frequency in FIFO) for temperature data.
int32_t ism330dhcx_fifo_sensor_tag_get(stmdev_ctx_t *ctx, ism330dhcx_fifo_tag_t *val)
Identifies the sensor in FIFO_DATA_OUT.
int32_t ism330dhcx_fifo_pedo_batch_get(stmdev_ctx_t *ctx, uint8_t *val)
Enable FIFO batching of pedometer embedded function values.
int32_t ism330dhcx_sh_batch_slave_2_set(stmdev_ctx_t *ctx, uint8_t val)
Enable FIFO batching data of third slave.
int32_t ism330dhcx_sh_batch_slave_1_set(stmdev_ctx_t *ctx, uint8_t val)
Enable FIFO batching data of second slave.
int32_t ism330dhcx_compression_algo_real_time_set(stmdev_ctx_t *ctx, uint8_t val)
Enables/Disables compression algorithm runtime[set].
int32_t ism330dhcx_rst_batch_counter_set(stmdev_ctx_t *ctx, uint8_t val)
Resets the internal counter of batching events for a single sensor.
int32_t ism330dhcx_batch_counter_threshold_get(stmdev_ctx_t *ctx, uint16_t *val)
Batch data rate counter.
int32_t ism330dhcx_fifo_wtm_flag_get(stmdev_ctx_t *ctx, uint8_t *val)
FIFO watermark status.
int32_t ism330dhcx_fifo_cnt_event_batch_get(stmdev_ctx_t *ctx, ism330dhcx_trig_counter_bdr_t *val)
Selects the trigger for the internal counter of batching events between XL and gyro.
int32_t ism330dhcx_rst_batch_counter_get(stmdev_ctx_t *ctx, uint8_t *val)
Resets the internal counter of batching events for a single sensor.
int32_t ism330dhcx_compression_algo_init_set(stmdev_ctx_t *ctx, uint8_t val)
FIFO compression feature initialization request.
int32_t ism330dhcx_fifo_xl_batch_get(stmdev_ctx_t *ctx, ism330dhcx_bdr_xl_t *val)
Selects Batching Data Rate (writing frequency in FIFO) for accelerometer data.
int32_t ism330dhcx_fifo_full_flag_get(stmdev_ctx_t *ctx, uint8_t *val)
Smart FIFO full status.
int32_t ism330dhcx_fifo_timestamp_decimation_set(stmdev_ctx_t *ctx, ism330dhcx_odr_ts_batch_t val)
Selects decimation for timestamp batching in FIFO.
int32_t ism330dhcx_fifo_mode_set(stmdev_ctx_t *ctx, ism330dhcx_fifo_mode_t val)
FIFO mode selection.
int32_t ism330dhcx_fifo_data_level_get(stmdev_ctx_t *ctx, uint16_t *val)
Number of unread sensor data (TAG + 6 bytes) stored in FIFO.
int32_t ism330dhcx_fifo_status_get(stmdev_ctx_t *ctx, ism330dhcx_fifo_status2_t *val)
Smart FIFO status.
int32_t ism330dhcx_fifo_stop_on_wtm_set(stmdev_ctx_t *ctx, uint8_t val)
Sensing chain FIFO stop values memorization at threshold level.
int32_t ism330dhcx_sh_batch_slave_3_get(stmdev_ctx_t *ctx, uint8_t *val)
Enable FIFO batching data of fourth slave.
int32_t ism330dhcx_batch_counter_threshold_set(stmdev_ctx_t *ctx, uint16_t val)
Batch data rate counter.
int32_t ism330dhcx_compression_algo_init_get(stmdev_ctx_t *ctx, uint8_t *val)
FIFO compression feature initialization request.
int32_t ism330dhcx_fifo_gy_batch_get(stmdev_ctx_t *ctx, ism330dhcx_bdr_gy_t *val)
Selects Batching Data Rate (writing frequency in FIFO) for gyroscope data.
int32_t ism330dhcx_fifo_cnt_event_batch_set(stmdev_ctx_t *ctx, ism330dhcx_trig_counter_bdr_t val)
Selects the trigger for the internal counter of batching events between XL and gyro.
int32_t ism330dhcx_sh_batch_slave_2_get(stmdev_ctx_t *ctx, uint8_t *val)
Enable FIFO batching data of third slave.
int32_t ism330dhcx_fifo_stop_on_wtm_get(stmdev_ctx_t *ctx, uint8_t *val)
Sensing chain FIFO stop values memorization at threshold level.
int32_t ism330dhcx_compression_algo_set(stmdev_ctx_t *ctx, ism330dhcx_uncoptr_rate_t val)
Enable and configure compression algo.
int32_t ism330dhcx_fifo_virtual_sens_odr_chg_get(stmdev_ctx_t *ctx, uint8_t *val)
Enables ODR CHANGE virtual sensor to be batched in FIFO.
int32_t ism330dhcx_sh_batch_slave_0_get(stmdev_ctx_t *ctx, uint8_t *val)
Enable FIFO batching data of first slave.
int32_t ism330dhcx_fifo_timestamp_decimation_get(stmdev_ctx_t *ctx, ism330dhcx_odr_ts_batch_t *val)
Selects decimation for timestamp batching in FIFO.
int32_t ism330dhcx_sh_batch_slave_3_set(stmdev_ctx_t *ctx, uint8_t val)
Enable FIFO batching data of fourth slave.
int32_t ism330dhcx_xl_hp_path_internal_get(stmdev_ctx_t *ctx, ism330dhcx_slope_fds_t *val)
HPF or SLOPE filter selection on wake-up and Activity/Inactivity functions.
int32_t ism330dhcx_gy_filter_lp1_set(stmdev_ctx_t *ctx, uint8_t val)
Enables gyroscope digital LPF1 if auxiliary SPI is disabled; the bandwidth can be selected through FT...
int32_t ism330dhcx_gy_hp_path_internal_get(stmdev_ctx_t *ctx, ism330dhcx_hpm_g_t *val)
Enables gyroscope digital high-pass filter.
int32_t ism330dhcx_filter_settling_mask_set(stmdev_ctx_t *ctx, uint8_t val)
Mask DRDY on pin (both XL & Gyro) until filter settling ends (XL and Gyro independently masked).
int32_t ism330dhcx_gy_lp1_bandwidth_set(stmdev_ctx_t *ctx, ism330dhcx_ftype_t val)
Gyroscope low pass filter 1 bandwidth.
int32_t ism330dhcx_gy_lp1_bandwidth_get(stmdev_ctx_t *ctx, ism330dhcx_ftype_t *val)
Gyroscope low pass filter 1 bandwidth.
int32_t ism330dhcx_xl_lp2_on_6d_set(stmdev_ctx_t *ctx, uint8_t val)
Low pass filter 2 on 6D function selection.
int32_t ism330dhcx_xl_lp2_on_6d_get(stmdev_ctx_t *ctx, uint8_t *val)
Low pass filter 2 on 6D function selection.
int32_t ism330dhcx_xl_filter_lp2_get(stmdev_ctx_t *ctx, uint8_t *val)
Accelerometer output from LPF2 filtering stage selection.
int32_t ism330dhcx_xl_fast_settling_set(stmdev_ctx_t *ctx, uint8_t val)
Enables accelerometer LPF2 and HPF fast-settling mode.
int32_t ism330dhcx_filter_settling_mask_get(stmdev_ctx_t *ctx, uint8_t *val)
Mask DRDY on pin (both XL & Gyro) until filter settling ends (XL and Gyro independently masked).
int32_t ism330dhcx_gy_filter_lp1_get(stmdev_ctx_t *ctx, uint8_t *val)
Enables gyroscope digital LPF1 if auxiliary SPI is disabled; the bandwidth can be selected through FT...
int32_t ism330dhcx_xl_hp_path_on_out_set(stmdev_ctx_t *ctx, ism330dhcx_hp_slope_xl_en_t val)
Accelerometer slope filter / high-pass filter selection on output.
int32_t ism330dhcx_xl_fast_settling_get(stmdev_ctx_t *ctx, uint8_t *val)
Enables accelerometer LPF2 and HPF fast-settling mode.
int32_t ism330dhcx_xl_hp_path_on_out_get(stmdev_ctx_t *ctx, ism330dhcx_hp_slope_xl_en_t *val)
Accelerometer slope filter / high-pass filter selection on output.
int32_t ism330dhcx_xl_hp_path_internal_set(stmdev_ctx_t *ctx, ism330dhcx_slope_fds_t val)
HPF or SLOPE filter selection on wake-up and Activity/Inactivity functions.
int32_t ism330dhcx_xl_filter_lp2_set(stmdev_ctx_t *ctx, uint8_t val)
Accelerometer output from LPF2 filtering stage selection.
int32_t ism330dhcx_gy_hp_path_internal_set(stmdev_ctx_t *ctx, ism330dhcx_hpm_g_t val)
Enables gyroscope digital high-pass filter.
int32_t ism330dhcx_fsm_number_of_programs_set(stmdev_ctx_t *ctx, uint8_t *buff)
FSM number of programs register.
int32_t ism330dhcx_long_clr_get(stmdev_ctx_t *ctx, ism330dhcx_fsm_lc_clr_t *val)
Clear FSM long counter value.
int32_t ism330dhcx_long_cnt_int_value_get(stmdev_ctx_t *ctx, uint16_t *val)
FSM long counter timeout register (r/w).
int32_t ism330dhcx_emb_fsm_en_set(stmdev_ctx_t *ctx, uint8_t val)
Embedded final state machine functions mode.
int32_t ism330dhcx_fsm_number_of_programs_get(stmdev_ctx_t *ctx, uint8_t *buff)
FSM number of programs register.
int32_t ism330dhcx_fsm_enable_set(stmdev_ctx_t *ctx, ism330dhcx_emb_fsm_enable_t *val)
Embedded final state machine functions mode.
int32_t ism330dhcx_fsm_start_address_get(stmdev_ctx_t *ctx, uint16_t *val)
FSM start address register (r/w).
int32_t ism330dhcx_long_cnt_set(stmdev_ctx_t *ctx, uint16_t val)
FSM long counter status register.
int32_t ism330dhcx_emb_fsm_en_get(stmdev_ctx_t *ctx, uint8_t *val)
Embedded final state machine functions mode.
int32_t ism330dhcx_fsm_out_get(stmdev_ctx_t *ctx, ism330dhcx_fsm_out_t *val)
FSM output registers.
int32_t ism330dhcx_long_cnt_flag_data_ready_get(stmdev_ctx_t *ctx, uint8_t *val)
Interrupt status bit for FSM long counter timeout interrupt event.
int32_t ism330dhcx_fsm_data_rate_get(stmdev_ctx_t *ctx, ism330dhcx_fsm_odr_t *val)
Finite State Machine ODR configuration.
int32_t ism330dhcx_fsm_init_get(stmdev_ctx_t *ctx, uint8_t *val)
FSM initialization request.
int32_t ism330dhcx_fsm_start_address_set(stmdev_ctx_t *ctx, uint16_t val)
FSM start address register (r/w).
int32_t ism330dhcx_fsm_data_rate_set(stmdev_ctx_t *ctx, ism330dhcx_fsm_odr_t val)
Finite State Machine ODR configuration.
int32_t ism330dhcx_fsm_enable_get(stmdev_ctx_t *ctx, ism330dhcx_emb_fsm_enable_t *val)
Embedded final state machine functions mode.
int32_t ism330dhcx_fsm_init_set(stmdev_ctx_t *ctx, uint8_t val)
FSM initialization request.
int32_t ism330dhcx_long_cnt_get(stmdev_ctx_t *ctx, uint16_t *val)
FSM long counter status register.
int32_t ism330dhcx_long_cnt_int_value_set(stmdev_ctx_t *ctx, uint16_t val)
FSM long counter timeout register (r/w).
int32_t ism330dhcx_long_clr_set(stmdev_ctx_t *ctx, ism330dhcx_fsm_lc_clr_t val)
Clear FSM long counter value.
int32_t ism330dhcx_ff_dur_set(stmdev_ctx_t *ctx, uint8_t val)
Free-fall duration event(1LSb = 1 / ODR).
int32_t ism330dhcx_ff_dur_get(stmdev_ctx_t *ctx, uint8_t *val)
Free-fall duration event(1LSb = 1 / ODR).
int32_t ism330dhcx_ff_threshold_get(stmdev_ctx_t *ctx, ism330dhcx_ff_ths_t *val)
Free fall threshold setting.
int32_t ism330dhcx_ff_threshold_set(stmdev_ctx_t *ctx, ism330dhcx_ff_ths_t val)
Free fall threshold setting.
int32_t ism330dhcx_pin_int2_route_set(stmdev_ctx_t *ctx, ism330dhcx_pin_int2_route_t *val)
Select the signal that need to route on int2 pad[set].
int32_t ism330dhcx_pin_polarity_get(stmdev_ctx_t *ctx, ism330dhcx_h_lactive_t *val)
Interrupt active-high/low.
int32_t ism330dhcx_int_notification_get(stmdev_ctx_t *ctx, ism330dhcx_lir_t *val)
All interrupt signals notification mode.
int32_t ism330dhcx_pin_polarity_set(stmdev_ctx_t *ctx, ism330dhcx_h_lactive_t val)
Interrupt active-high/low.
int32_t ism330dhcx_all_on_int1_set(stmdev_ctx_t *ctx, uint8_t val)
All interrupt signals become available on INT1 pin.
int32_t ism330dhcx_all_on_int1_get(stmdev_ctx_t *ctx, uint8_t *val)
All interrupt signals become available on INT1 pin.
int32_t ism330dhcx_pin_int1_route_get(stmdev_ctx_t *ctx, ism330dhcx_pin_int1_route_t *val)
Select the signal that need to route on int1 pad.
int32_t ism330dhcx_pin_mode_get(stmdev_ctx_t *ctx, ism330dhcx_pp_od_t *val)
Push-pull/open drain selection on interrupt pads.
int32_t ism330dhcx_pin_mode_set(stmdev_ctx_t *ctx, ism330dhcx_pp_od_t val)
Push-pull/open drain selection on interrupt pads.
int32_t ism330dhcx_pin_int2_route_get(stmdev_ctx_t *ctx, ism330dhcx_pin_int2_route_t *val)
Select the signal that need to route on int2 pad.
int32_t ism330dhcx_int_notification_set(stmdev_ctx_t *ctx, ism330dhcx_lir_t val)
All interrupt signals notification mode.
int32_t ism330dhcx_pin_int1_route_set(stmdev_ctx_t *ctx, ism330dhcx_pin_int1_route_t *val)
Select the signal that need to route on int1 pad[set].
int32_t ism330dhcx_motion_flag_data_ready_get(stmdev_ctx_t *ctx, uint8_t *val)
Interrupt status bit for significant motion detection.
int32_t ism330dhcx_motion_sens_set(stmdev_ctx_t *ctx, uint8_t val)
Enable significant motion detection function.
int32_t ism330dhcx_motion_sens_get(stmdev_ctx_t *ctx, uint8_t *val)
Enable significant motion detection function.
int32_t ism330dhcx_tap_threshold_x_get(stmdev_ctx_t *ctx, uint8_t *val)
X-axis tap recognition threshold.
int32_t ism330dhcx_tap_axis_priority_get(stmdev_ctx_t *ctx, ism330dhcx_tap_priority_t *val)
Selection of axis priority for TAP detection[get].
int32_t ism330dhcx_tap_detection_on_y_get(stmdev_ctx_t *ctx, uint8_t *val)
Enable Y direction in tap recognition.
int32_t ism330dhcx_tap_shock_set(stmdev_ctx_t *ctx, uint8_t val)
Maximum duration is the maximum time of an overthreshold signal detection to be recognized as a tap e...
int32_t ism330dhcx_tap_axis_priority_set(stmdev_ctx_t *ctx, ism330dhcx_tap_priority_t val)
Selection of axis priority for TAP detection.
int32_t ism330dhcx_tap_threshold_y_get(stmdev_ctx_t *ctx, uint8_t *val)
Y-axis tap recognition threshold.
int32_t ism330dhcx_tap_detection_on_x_set(stmdev_ctx_t *ctx, uint8_t val)
Enable X direction in tap recognition.
int32_t ism330dhcx_tap_threshold_y_set(stmdev_ctx_t *ctx, uint8_t val)
Y-axis tap recognition threshold.
int32_t ism330dhcx_tap_threshold_z_set(stmdev_ctx_t *ctx, uint8_t val)
Z-axis recognition threshold.
int32_t ism330dhcx_tap_threshold_z_get(stmdev_ctx_t *ctx, uint8_t *val)
Z-axis recognition threshold.
int32_t ism330dhcx_tap_detection_on_x_get(stmdev_ctx_t *ctx, uint8_t *val)
Enable X direction in tap recognition.
int32_t ism330dhcx_tap_dur_get(stmdev_ctx_t *ctx, uint8_t *val)
When double tap recognition is enabled, this register expresses the maximum time between two consecut...
int32_t ism330dhcx_tap_detection_on_y_set(stmdev_ctx_t *ctx, uint8_t val)
Enable Y direction in tap recognition.
int32_t ism330dhcx_tap_detection_on_z_set(stmdev_ctx_t *ctx, uint8_t val)
Enable Z direction in tap recognition.
int32_t ism330dhcx_tap_dur_set(stmdev_ctx_t *ctx, uint8_t val)
When double tap recognition is enabled, this register expresses the maximum time between two consecut...
int32_t ism330dhcx_tap_quiet_get(stmdev_ctx_t *ctx, uint8_t *val)
Quiet time is the time after the first detected tap in which there must not be any overthreshold even...
int32_t ism330dhcx_tap_mode_get(stmdev_ctx_t *ctx, ism330dhcx_single_double_tap_t *val)
Single/double-tap event enable.
int32_t ism330dhcx_tap_threshold_x_set(stmdev_ctx_t *ctx, uint8_t val)
X-axis tap recognition threshold.
int32_t ism330dhcx_tap_mode_set(stmdev_ctx_t *ctx, ism330dhcx_single_double_tap_t val)
Single/double-tap event enable.
int32_t ism330dhcx_tap_detection_on_z_get(stmdev_ctx_t *ctx, uint8_t *val)
Enable Z direction in tap recognition.
int32_t ism330dhcx_tap_shock_get(stmdev_ctx_t *ctx, uint8_t *val)
Maximum duration is the maximum time of an overthreshold signal detection to be recognized as a tap e...
int32_t ism330dhcx_tap_quiet_set(stmdev_ctx_t *ctx, uint8_t val)
Quiet time is the time after the first detected tap in which there must not be any overthreshold even...
int32_t ism330dhcx_tilt_sens_set(stmdev_ctx_t *ctx, uint8_t val)
Enable tilt calculation.
int32_t ism330dhcx_tilt_sens_get(stmdev_ctx_t *ctx, uint8_t *val)
Enable tilt calculation.
int32_t ism330dhcx_tilt_flag_data_ready_get(stmdev_ctx_t *ctx, uint8_t *val)
Interrupt status bit for tilt detection.
ism330dhcx_sleep_status_on_int_t
#define ISM330DHCX_PIN_CTRL
#define ISM330DHCX_TAP_THS_6D
#define ISM330DHCX_INT_DUR2
#define ISM330DHCX_SLV0_SUBADD
#define ISM330DHCX_FIFO_STATUS2
ism330dhcx_carry_count_en_t
ism330dhcx_den_lh_t
#define ISM330DHCX_SLV3_CONFIG
ism330dhcx_den_lh_ois_t
ism330dhcx_ois_on_t
#define ISM330DHCX_SLV2_CONFIG
ism330dhcx_sim_ois_t
#define ISM330DHCX_STATUS_SPIAUX
ism330dhcx_trig_counter_bdr_t
#define ISM330DHCX_EMB_FUNC_INT1
#define ISM330DHCX_CTRL1_XL
#define ISM330DHCX_FSM_ENABLE_B
ism330dhcx_wake_ths_w_t
#define ISM330DHCX_MAG_SENSITIVITY_L
#define ISM330DHCX_CTRL10_C
ism330dhcx_bdr_gy_t
#define ISM330DHCX_SLV0_CONFIG
#define ISM330DHCX_SLV3_SUBADD
ism330dhcx_aux_sens_on_t
#define ISM330DHCX_MLC0_SRC
ism330dhcx_fs_g_t
#define ISM330DHCX_MAG_SI_YZ_H
#define ISM330DHCX_MLC_INT2
ism330dhcx_lvl2_ois_t
ism330dhcx_fifo_tag_t
#define ISM330DHCX_PEDO_SC_DELTAT_H
#define ISM330DHCX_FSM_INT2_A
ism330dhcx_odr_g_t
#define ISM330DHCX_MLC_INT1
ism330dhcx_single_double_tap_t
#define ISM330DHCX_OUTX_L_A
#define ISM330DHCX_TAP_SRC
#define ISM330DHCX_MAG_SI_YY_H
ism330dhcx_inact_en_t
#define ISM330DHCX_MAG_SI_XX_L
#define ISM330DHCX_MAG_CFG_A
ism330dhcx_uncoptr_rate_t
ism330dhcx_den_xl_g_t
#define ISM330DHCX_CTRL4_C
ism330dhcx_ftype_t
#define ISM330DHCX_MAG_OFFZ_L
#define ISM330DHCX_FSM_INT2_B
#define ISM330DHCX_TAP_CFG2
#define ISM330DHCX_SLV1_CONFIG
ism330dhcx_hp_slope_xl_en_t
#define ISM330DHCX_FSM_ENABLE_A
#define ISM330DHCX_MAG_SI_XZ_H
ism330dhcx_dataready_pulsed_t
#define ISM330DHCX_INT1_CTRL
ism330dhcx_usr_off_w_t
#define ISM330DHCX_FSM_LONG_COUNTER_L
#define ISM330DHCX_TIMESTAMP0
#define ISM330DHCX_FSM_START_ADD_H
#define ISM330DHCX_MAG_SI_YZ_L
#define ISM330DHCX_EMB_FUNC_EN_A
#define ISM330DHCX_PAGE_ADDRESS
ism330dhcx_start_config_t
#define ISM330DHCX_FIFO_CTRL3
ism330dhcx_filter_xl_conf_ois_t
ism330dhcx_xl_hm_mode_t
#define ISM330DHCX_WAKE_UP_THS
ism330dhcx_mlc_odr_t
#define ISM330DHCX_MAG_SI_XY_H
#define ISM330DHCX_OUTX_L_G
ism330dhcx_fifo_mode_t
#define ISM330DHCX_WHO_AM_I
#define ISM330DHCX_DATAWRITE_SLV0
#define ISM330DHCX_MAG_OFFX_L
#define ISM330DHCX_MD2_CFG
#define ISM330DHCX_STATUS_REG
#define ISM330DHCX_INT2_CTRL
#define ISM330DHCX_INTERNAL_FREQ_FINE
#define ISM330DHCX_SENSOR_HUB_1
#define ISM330DHCX_TAP_CFG0
#define ISM330DHCX_FREE_FALL
#define ISM330DHCX_SLV0_ADD
#define ISM330DHCX_FIFO_CTRL2
#define ISM330DHCX_MASTER_CONFIG
#define ISM330DHCX_FSM_OUTS1
#define ISM330DHCX_MAG_SI_YY_L
ism330dhcx_lir_t
ism330dhcx_fs_xl_ois_t
#define ISM330DHCX_MAG_SENSITIVITY_H
ism330dhcx_hpm_g_t
#define ISM330DHCX_PAGE_VALUE
ism330dhcx_g_hm_mode_t
ism330dhcx_odr_t_batch_t
#define ISM330DHCX_FSM_START_ADD_L
#define ISM330DHCX_PAGE_RW
#define ISM330DHCX_CTRL2_G
#define ISM330DHCX_WAKE_UP_DUR
ism330dhcx_sixd_ths_t
#define ISM330DHCX_MLC_STATUS_MAINPAGE
#define ISM330DHCX_ALL_INT_SRC
#define ISM330DHCX_MAG_OFFZ_H
ism330dhcx_ois_en_spi2_t
#define ISM330DHCX_Z_OFS_USR
ism330dhcx_hpm_ois_t
#define ISM330DHCX_EMB_FUNC_ODR_CFG_B
#define ISM330DHCX_FSM_LC_TIMEOUT_L
#define ISM330DHCX_INT_OIS
#define ISM330DHCX_FSM_INT1_B
ism330dhcx_shub_odr_t
#define ISM330DHCX_FIFO_STATUS1
#define ISM330DHCX_CTRL2_OIS
#define ISM330DHCX_X_OFS_USR
ism330dhcx_write_once_t
ism330dhcx_st_ois_t
#define ISM330DHCX_OUT_TEMP_L
ism330dhcx_fsm_odr_t
#define ISM330DHCX_SLV2_ADD
ism330dhcx_tap_priority_t
#define ISM330DHCX_MD1_CFG
ism330dhcx_reg_access_t
ism330dhcx_shub_pu_en_t
#define ISM330DHCX_CTRL7_G
#define ISM330DHCX_Y_OFS_USR
#define ISM330DHCX_MAG_SI_XY_L
#define ISM330DHCX_COUNTER_BDR_REG2
#define ISM330DHCX_EMB_FUNC_ODR_CFG_C
ism330dhcx_mag_x_axis_t
#define ISM330DHCX_CTRL3_C
#define ISM330DHCX_MAG_SI_XZ_L
#define ISM330DHCX_CTRL9_XL
#define ISM330DHCX_FSM_PROGRAMS
#define ISM330DHCX_FIFO_DATA_OUT_X_L
ism330dhcx_sim_t
#define ISM330DHCX_FUNC_CFG_ACCESS
#define ISM330DHCX_SLV1_ADD
ism330dhcx_i2c_disable_t
ism330dhcx_sdo_pu_en_t
#define ISM330DHCX_FSM_INT1_A
ism330dhcx_ois_pu_dis_t
#define ISM330DHCX_CTRL3_OIS
ism330dhcx_slope_fds_t
#define ISM330DHCX_FSM_STATUS_B
#define ISM330DHCX_WAKE_UP_SRC
#define ISM330DHCX_SLV1_SUBADD
#define ISM330DHCX_FIFO_CTRL1
ism330dhcx_bdr_xl_t
#define ISM330DHCX_MAG_SI_ZZ_L
#define ISM330DHCX_EMB_FUNC_INIT_B
#define ISM330DHCX_CTRL5_C
ism330dhcx_ftype_ois_t
#define ISM330DHCX_PEDO_DEB_STEPS_CONF
ism330dhcx_odr_xl_t
ism330dhcx_st_ois_clampdis_t
ism330dhcx_odr_ts_batch_t
#define ISM330DHCX_FIFO_DATA_OUT_TAG
#define ISM330DHCX_STEP_COUNTER_L
#define ISM330DHCX_TAP_CFG1
ism330dhcx_rounding_t
#define ISM330DHCX_PAGE_SEL
#define ISM330DHCX_MAG_SI_XX_H
#define ISM330DHCX_EMB_FUNC_EN_B
#define ISM330DHCX_FSM_LONG_COUNTER_CLEAR
#define ISM330DHCX_MAG_CFG_B
#define ISM330DHCX_D6D_SRC
#define ISM330DHCX_EMB_FUNC_STATUS
ism330dhcx_mag_y_axis_t
#define ISM330DHCX_FSM_STATUS_A
#define ISM330DHCX_CTRL8_XL
ism330dhcx_pp_od_t
#define ISM330DHCX_SLV3_ADD
#define ISM330DHCX_EMB_FUNC_FIFO_CFG
ism330dhcx_mag_z_axis_t
#define ISM330DHCX_CTRL1_OIS
#define ISM330DHCX_FIFO_CTRL4
#define ISM330DHCX_MAG_OFFY_L
#define ISM330DHCX_FSM_LC_TIMEOUT_H
#define ISM330DHCX_MAG_OFFX_H
#define ISM330DHCX_CTRL6_C
#define ISM330DHCX_PEDO_CMD_REG
#define ISM330DHCX_EMB_FUNC_SRC
ism330dhcx_h_lactive_t
ism330dhcx_fs_xl_t
#define ISM330DHCX_STATUS_MASTER
#define ISM330DHCX_MAG_SI_ZZ_H
ism330dhcx_st_xl_ois_t
#define ISM330DHCX_PEDO_SC_DELTAT_L
ism330dhcx_st_g_t
#define ISM330DHCX_TIMESTAMP2
#define ISM330DHCX_MAG_OFFY_H
ism330dhcx_ff_ths_t
#define ISM330DHCX_COUNTER_BDR_REG1
ism330dhcx_fsm_lc_clr_t
ism330dhcx_st_xl_t
#define ISM330DHCX_SLV2_SUBADD
ism330dhcx_den_mode_t
#define ISM330DHCX_EMB_FUNC_INT2
ism330dhcx_fs_g_ois_t
@ ISM330DHCX_DRIVE_SLEEP_CHG_EVENT
@ ISM330DHCX_DRIVE_SLEEP_STATUS
@ ISM330DHCX_COUNT_OVERFLOW
@ ISM330DHCX_EVERY_STEP
@ ISM330DHCX_DEN_ACT_HIGH
@ ISM330DHCX_DEN_ACT_LOW
@ ISM330DHCX_AUX_DEN_ACTIVE_HIGH
@ ISM330DHCX_AUX_DEN_ACTIVE_LOW
@ ISM330DHCX_AUX_ON_BY_AUX_INTERFACE
@ ISM330DHCX_AUX_ON
@ ISM330DHCX_AUX_SPI_3_WIRE
@ ISM330DHCX_AUX_SPI_4_WIRE
@ ISM330DHCX_GYRO_BATCH_EVENT
@ ISM330DHCX_XL_BATCH_EVENT
@ ISM330DHCX_LSb_FS_DIV_64
@ ISM330DHCX_LSb_FS_DIV_256
@ ISM330DHCX_GY_BATCHED_AT_208Hz
@ ISM330DHCX_GY_NOT_BATCHED
@ ISM330DHCX_GY_BATCHED_6Hz5
@ ISM330DHCX_GY_BATCHED_AT_104Hz
@ ISM330DHCX_GY_BATCHED_AT_12Hz5
@ ISM330DHCX_GY_BATCHED_AT_6667Hz
@ ISM330DHCX_GY_BATCHED_AT_3333Hz
@ ISM330DHCX_GY_BATCHED_AT_52Hz
@ ISM330DHCX_GY_BATCHED_AT_833Hz
@ ISM330DHCX_GY_BATCHED_AT_26Hz
@ ISM330DHCX_GY_BATCHED_AT_417Hz
@ ISM330DHCX_GY_BATCHED_AT_1667Hz
@ ISM330DHCX_SLV_0_1_2
@ ISM330DHCX_SLV_0_1
@ ISM330DHCX_SLV_0
@ ISM330DHCX_SLV_0_1_2_3
@ ISM330DHCX_500dps
@ ISM330DHCX_2000dps
@ ISM330DHCX_1000dps
@ ISM330DHCX_250dps
@ ISM330DHCX_4000dps
@ ISM330DHCX_125dps
@ ISM330DHCX_AUX_DEN_LEVEL_TRIG
@ ISM330DHCX_AUX_DEN_LEVEL_LATCH
@ ISM330DHCX_AUX_DEN_DISABLE
@ ISM330DHCX_STEP_CPUNTER_TAG
@ ISM330DHCX_GEOMAG_ROTATION_TAG
@ ISM330DHCX_SENSORHUB_SLAVE1_TAG
@ ISM330DHCX_GYRO_3XC_TAG
@ ISM330DHCX_TEMPERATURE_TAG
@ ISM330DHCX_XL_NC_T_2_TAG
@ ISM330DHCX_CFG_CHANGE_TAG
@ ISM330DHCX_XL_NC_TAG
@ ISM330DHCX_SENSORHUB_SLAVE0_TAG
@ ISM330DHCX_ROTATION_TAG
@ ISM330DHCX_GYRO_NC_T_2_TAG
@ ISM330DHCX_XL_NC_T_1_TAG
@ ISM330DHCX_XL_3XC_TAG
@ ISM330DHCX_SENSORHUB_SLAVE2_TAG
@ ISM330DHCX_GYRO_NC_TAG
@ ISM330DHCX_GAME_ROTATION_TAG
@ ISM330DHCX_TIMESTAMP_TAG
@ ISM330DHCX_GYRO_2XC_TAG
@ ISM330DHCX_SENSORHUB_SLAVE3_TAG
@ ISM330DHCX_GYRO_NC_T_1_TAG
@ ISM330DHCX_XL_2XC_TAG
@ ISM330DHCX_SENSORHUB_NACK_TAG
@ ISM330DHCX_GY_ODR_104Hz
@ ISM330DHCX_GY_ODR_3332Hz
@ ISM330DHCX_GY_ODR_416Hz
@ ISM330DHCX_GY_ODR_OFF
@ ISM330DHCX_GY_ODR_1666Hz
@ ISM330DHCX_GY_ODR_6667Hz
@ ISM330DHCX_GY_ODR_833Hz
@ ISM330DHCX_GY_ODR_208Hz
@ ISM330DHCX_GY_ODR_52Hz
@ ISM330DHCX_GY_ODR_26Hz
@ ISM330DHCX_GY_ODR_12Hz5
@ ISM330DHCX_ONLY_SINGLE
@ ISM330DHCX_BOTH_SINGLE_DOUBLE
@ ISM330DHCX_XL_AND_GY_NOT_AFFECTED
@ ISM330DHCX_XL_12Hz5_GY_NOT_AFFECTED
@ ISM330DHCX_XL_12Hz5_GY_SLEEP
@ ISM330DHCX_XL_12Hz5_GY_PD
@ ISM330DHCX_CMP_DISABLE
@ ISM330DHCX_CMP_8_TO_1
@ ISM330DHCX_CMP_16_TO_1
@ ISM330DHCX_CMP_32_TO_1
@ ISM330DHCX_CMP_ALWAYS
@ ISM330DHCX_STAMP_IN_XL_DATA
@ ISM330DHCX_STAMP_IN_GY_DATA
@ ISM330DHCX_STAMP_IN_GY_XL_DATA
@ ISM330DHCX_STRONG
@ ISM330DHCX_LIGHT
@ ISM330DHCX_AGGRESSIVE
@ ISM330DHCX_VERY_LIGHT
@ ISM330DHCX_MEDIUM
@ ISM330DHCX_ULTRA_LIGHT
@ ISM330DHCX_XTREME
@ ISM330DHCX_VERY_STRONG
@ ISM330DHCX_HP_REF_MD_ODR_DIV_20
@ ISM330DHCX_HP_REF_MD_ODR_DIV_200
@ ISM330DHCX_SLOPE_ODR_DIV_4
@ ISM330DHCX_HP_ODR_DIV_45
@ ISM330DHCX_LP_ODR_DIV_200
@ ISM330DHCX_LP_ODR_DIV_45
@ ISM330DHCX_HP_PATH_DISABLE_ON_OUT
@ ISM330DHCX_HP_REF_MD_ODR_DIV_800
@ ISM330DHCX_HP_REF_MD_ODR_DIV_100
@ ISM330DHCX_HP_ODR_DIV_10
@ ISM330DHCX_HP_REF_MD_ODR_DIV_10
@ ISM330DHCX_HP_REF_MD_ODR_DIV_400
@ ISM330DHCX_HP_ODR_DIV_20
@ ISM330DHCX_LP_ODR_DIV_400
@ ISM330DHCX_HP_REF_MD_ODR_DIV_45
@ ISM330DHCX_LP_ODR_DIV_10
@ ISM330DHCX_LP_ODR_DIV_20
@ ISM330DHCX_HP_ODR_DIV_100
@ ISM330DHCX_HP_ODR_DIV_800
@ ISM330DHCX_HP_ODR_DIV_400
@ ISM330DHCX_LP_ODR_DIV_800
@ ISM330DHCX_LP_ODR_DIV_100
@ ISM330DHCX_HP_ODR_DIV_200
@ ISM330DHCX_DRDY_LATCHED
@ ISM330DHCX_DRDY_PULSED
@ ISM330DHCX_LSb_1mg
@ ISM330DHCX_LSb_16mg
@ ISM330DHCX_EXT_ON_INT2_PIN
@ ISM330DHCX_XL_GY_DRDY
@ ISM330DHCX_4Hz11
@ ISM330DHCX_68Hz2
@ ISM330DHCX_33Hz6
@ ISM330DHCX_631Hz
@ ISM330DHCX_140Hz
@ ISM330DHCX_295Hz
@ ISM330DHCX_16Hz7
@ ISM330DHCX_8Hz3
@ ISM330DHCX_HIGH_PERFORMANCE_MD
@ ISM330DHCX_LOW_NORMAL_POWER_MD
@ ISM330DHCX_ODR_PRGS_12Hz5
@ ISM330DHCX_ODR_PRGS_52Hz
@ ISM330DHCX_ODR_PRGS_26Hz
@ ISM330DHCX_ODR_PRGS_104Hz
@ ISM330DHCX_FIFO_MODE
@ ISM330DHCX_BYPASS_TO_FIFO_MODE
@ ISM330DHCX_BYPASS_MODE
@ ISM330DHCX_STREAM_MODE
@ ISM330DHCX_BYPASS_TO_STREAM_MODE
@ ISM330DHCX_STREAM_TO_FIFO_MODE
@ ISM330DHCX_ALL_INT_LATCHED
@ ISM330DHCX_BASE_PULSED_EMB_LATCHED
@ ISM330DHCX_ALL_INT_PULSED
@ ISM330DHCX_BASE_LATCHED_EMB_PULSED
@ ISM330DHCX_AUX_4g
@ ISM330DHCX_AUX_2g
@ ISM330DHCX_AUX_16g
@ ISM330DHCX_AUX_8g
@ ISM330DHCX_HP_FILTER_16mHz
@ ISM330DHCX_HP_FILTER_260mHz
@ ISM330DHCX_HP_FILTER_1Hz04
@ ISM330DHCX_HP_FILTER_NONE
@ ISM330DHCX_HP_FILTER_65mHz
@ ISM330DHCX_GY_HIGH_PERFORMANCE
@ ISM330DHCX_GY_NORMAL
@ ISM330DHCX_TEMP_NOT_BATCHED
@ ISM330DHCX_TEMP_BATCHED_AT_1Hz6
@ ISM330DHCX_TEMP_BATCHED_AT_52Hz
@ ISM330DHCX_TEMP_BATCHED_AT_12Hz5
@ ISM330DHCX_DEG_80
@ ISM330DHCX_DEG_50
@ ISM330DHCX_DEG_70
@ ISM330DHCX_DEG_60
@ ISM330DHCX_MODE_4_GY_XL
@ ISM330DHCX_AUX_DISABLE
@ ISM330DHCX_MODE_3_GY
@ ISM330DHCX_AUX_HP_Hz065
@ ISM330DHCX_AUX_HP_Hz260
@ ISM330DHCX_AUX_HP_Hz016
@ ISM330DHCX_AUX_HP_DISABLE
@ ISM330DHCX_AUX_HP_1Hz040
@ ISM330DHCX_SH_ODR_52Hz
@ ISM330DHCX_SH_ODR_13Hz
@ ISM330DHCX_SH_ODR_26Hz
@ ISM330DHCX_SH_ODR_104Hz
@ ISM330DHCX_ONLY_FIRST_CYCLE
@ ISM330DHCX_EACH_SH_CYCLE
@ ISM330DHCX_AUX_GY_DISABLE
@ ISM330DHCX_AUX_GY_NEG
@ ISM330DHCX_AUX_GY_POS
@ ISM330DHCX_ODR_FSM_52Hz
@ ISM330DHCX_ODR_FSM_104Hz
@ ISM330DHCX_ODR_FSM_12Hz5
@ ISM330DHCX_ODR_FSM_26Hz
@ ISM330DHCX_ZYX
@ ISM330DHCX_ZXY
@ ISM330DHCX_XZY
@ ISM330DHCX_YXZ
@ ISM330DHCX_YZX
@ ISM330DHCX_XYZ
@ ISM330DHCX_USER_BANK
@ ISM330DHCX_SENSOR_HUB_BANK
@ ISM330DHCX_EMBEDDED_FUNC_BANK
@ ISM330DHCX_INTERNAL_PULL_UP
@ ISM330DHCX_EXT_PULL_UP
@ ISM330DHCX_X_EQ_MIN_X
@ ISM330DHCX_X_EQ_Y
@ ISM330DHCX_X_EQ_Z
@ ISM330DHCX_X_EQ_X
@ ISM330DHCX_X_EQ_MIN_Y
@ ISM330DHCX_X_EQ_MIN_Z
@ ISM330DHCX_SPI_4_WIRE
@ ISM330DHCX_SPI_3_WIRE
@ ISM330DHCX_I2C_DISABLE
@ ISM330DHCX_I2C_ENABLE
@ ISM330DHCX_PULL_UP_DISC
@ ISM330DHCX_PULL_UP_CONNECT
@ ISM330DHCX_AUX_PULL_UP_DISC
@ ISM330DHCX_AUX_PULL_UP_CONNECT
@ ISM330DHCX_USE_HPF
@ ISM330DHCX_USE_SLOPE
@ ISM330DHCX_XL_BATCHED_AT_26Hz
@ ISM330DHCX_XL_BATCHED_AT_3333Hz
@ ISM330DHCX_XL_BATCHED_AT_6Hz5
@ ISM330DHCX_XL_BATCHED_AT_833Hz
@ ISM330DHCX_XL_BATCHED_AT_417Hz
@ ISM330DHCX_XL_BATCHED_AT_1667Hz
@ ISM330DHCX_XL_BATCHED_AT_104Hz
@ ISM330DHCX_XL_NOT_BATCHED
@ ISM330DHCX_XL_BATCHED_AT_6667Hz
@ ISM330DHCX_XL_BATCHED_AT_52Hz
@ ISM330DHCX_XL_BATCHED_AT_12Hz5
@ ISM330DHCX_XL_BATCHED_AT_208Hz
@ ISM330DHCX_172Hz70
@ ISM330DHCX_937Hz91
@ ISM330DHCX_351Hz39
@ ISM330DHCX_236Hz63
@ ISM330DHCX_XL_ODR_104Hz
@ ISM330DHCX_XL_ODR_1666Hz
@ ISM330DHCX_XL_ODR_1Hz6
@ ISM330DHCX_XL_ODR_208Hz
@ ISM330DHCX_XL_ODR_52Hz
@ ISM330DHCX_XL_ODR_833Hz
@ ISM330DHCX_XL_ODR_26Hz
@ ISM330DHCX_XL_ODR_6667Hz
@ ISM330DHCX_XL_ODR_416Hz
@ ISM330DHCX_XL_ODR_3332Hz
@ ISM330DHCX_XL_ODR_OFF
@ ISM330DHCX_XL_ODR_12Hz5
@ ISM330DHCX_ENABLE_CLAMP
@ ISM330DHCX_DISABLE_CLAMP
@ ISM330DHCX_DEC_1
@ ISM330DHCX_NO_DECIMATION
@ ISM330DHCX_DEC_32
@ ISM330DHCX_DEC_8
@ ISM330DHCX_ROUND_GY
@ ISM330DHCX_ROUND_XL
@ ISM330DHCX_NO_ROUND
@ ISM330DHCX_ROUND_GY_XL
@ ISM330DHCX_Y_EQ_MIN_Z
@ ISM330DHCX_Y_EQ_MIN_X
@ ISM330DHCX_Y_EQ_Y
@ ISM330DHCX_Y_EQ_X
@ ISM330DHCX_Y_EQ_Z
@ ISM330DHCX_Y_EQ_MIN_Y
@ ISM330DHCX_OPEN_DRAIN
@ ISM330DHCX_PUSH_PULL
@ ISM330DHCX_Z_EQ_X
@ ISM330DHCX_Z_EQ_Z
@ ISM330DHCX_Z_EQ_MIN_X
@ ISM330DHCX_Z_EQ_MIN_Y
@ ISM330DHCX_Z_EQ_MIN_Z
@ ISM330DHCX_Z_EQ_Y
@ ISM330DHCX_ACTIVE_LOW
@ ISM330DHCX_ACTIVE_HIGH
@ ISM330DHCX_16g
@ ISM330DHCX_8g
@ ISM330DHCX_4g
@ ISM330DHCX_2g
@ ISM330DHCX_AUX_XL_DISABLE
@ ISM330DHCX_AUX_XL_POS
@ ISM330DHCX_AUX_XL_NEG
@ ISM330DHCX_GY_ST_DISABLE
@ ISM330DHCX_GY_ST_POSITIVE
@ ISM330DHCX_GY_ST_NEGATIVE
@ ISM330DHCX_FF_TSH_219mg
@ ISM330DHCX_FF_TSH_344mg
@ ISM330DHCX_FF_TSH_469mg
@ ISM330DHCX_FF_TSH_500mg
@ ISM330DHCX_FF_TSH_250mg
@ ISM330DHCX_FF_TSH_156mg
@ ISM330DHCX_FF_TSH_312mg
@ ISM330DHCX_FF_TSH_406mg
@ ISM330DHCX_LC_CLEAR_DONE
@ ISM330DHCX_LC_NORMAL
@ ISM330DHCX_LC_CLEAR
@ ISM330DHCX_XL_ST_NEGATIVE
@ ISM330DHCX_XL_ST_DISABLE
@ ISM330DHCX_XL_ST_POSITIVE
@ ISM330DHCX_LEVEL_TRIGGER
@ ISM330DHCX_DEN_DISABLE
@ ISM330DHCX_LEVEL_LETCHED
@ ISM330DHCX_LEVEL_FIFO
@ ISM330DHCX_EDGE_TRIGGER
@ ISM330DHCX_250dps_AUX
@ ISM330DHCX_500dps_AUX
@ ISM330DHCX_1000dps_AUX
@ ISM330DHCX_125dps_AUX
@ ISM330DHCX_2000dps_AUX
int32_t ism330dhcx_xl_offset_weight_get(stmdev_ctx_t *ctx, ism330dhcx_usr_off_w_t *val)
Weight of XL user offset bits of registers X_OFS_USR (73h), Y_OFS_USR (74h), Z_OFS_USR (75h).
int32_t ism330dhcx_xl_usr_offset_x_set(stmdev_ctx_t *ctx, uint8_t *buff)
Accelerometer X-axis user offset correction expressed in two’s complement, weight depends on USR_OFF_...
int32_t ism330dhcx_xl_full_scale_get(stmdev_ctx_t *ctx, ism330dhcx_fs_xl_t *val)
Accelerometer full-scale selection.
int32_t ism330dhcx_gy_full_scale_get(stmdev_ctx_t *ctx, ism330dhcx_fs_g_t *val)
Gyroscope UI chain full-scale selection.
int32_t ism330dhcx_gy_flag_data_ready_get(stmdev_ctx_t *ctx, uint8_t *val)
Gyroscope new data available.
int32_t ism330dhcx_gy_power_mode_get(stmdev_ctx_t *ctx, ism330dhcx_g_hm_mode_t *val)
gy_power_mode: [get] Operating mode for gyroscope.
int32_t ism330dhcx_xl_power_mode_get(stmdev_ctx_t *ctx, ism330dhcx_xl_hm_mode_t *val)
Accelerometer power mode[get].
int32_t ism330dhcx_xl_usr_offset_y_set(stmdev_ctx_t *ctx, uint8_t *buff)
Accelerometer Y-axis user offset correction expressed in two’s complement, weight depends on USR_OFF_...
int32_t ism330dhcx_xl_power_mode_set(stmdev_ctx_t *ctx, ism330dhcx_xl_hm_mode_t val)
Accelerometer power mode.
int32_t ism330dhcx_xl_flag_data_ready_get(stmdev_ctx_t *ctx, uint8_t *val)
Accelerometer new data available.
int32_t ism330dhcx_xl_offset_weight_set(stmdev_ctx_t *ctx, ism330dhcx_usr_off_w_t val)
Weight of XL user offset bits of registers X_OFS_USR (73h), Y_OFS_USR (74h), Z_OFS_USR (75h).
int32_t ism330dhcx_gy_full_scale_set(stmdev_ctx_t *ctx, ism330dhcx_fs_g_t val)
Gyroscope UI chain full-scale selection.
int32_t ism330dhcx_status_reg_get(stmdev_ctx_t *ctx, ism330dhcx_status_reg_t *val)
The STATUS_REG register is read by the primary interface.
int32_t ism330dhcx_temp_flag_data_ready_get(stmdev_ctx_t *ctx, uint8_t *val)
Temperature new data available.
int32_t ism330dhcx_block_data_update_get(stmdev_ctx_t *ctx, uint8_t *val)
Block data update.
int32_t ism330dhcx_xl_full_scale_set(stmdev_ctx_t *ctx, ism330dhcx_fs_xl_t val)
Accelerometer full-scale selection[set].
int32_t ism330dhcx_xl_data_rate_set(stmdev_ctx_t *ctx, ism330dhcx_odr_xl_t val)
Accelerometer UI data rate selection.
int32_t ism330dhcx_xl_usr_offset_x_get(stmdev_ctx_t *ctx, uint8_t *buff)
Accelerometer X-axis user offset correction expressed in two’s complement, weight depends on USR_OFF_...
int32_t ism330dhcx_gy_data_rate_set(stmdev_ctx_t *ctx, ism330dhcx_odr_g_t val)
Gyroscope data rate.
int32_t ism330dhcx_xl_usr_offset_z_get(stmdev_ctx_t *ctx, uint8_t *buff)
Accelerometer X-axis user offset correction expressed in two’s complement, weight depends on USR_OFF_...
int32_t ism330dhcx_xl_data_rate_get(stmdev_ctx_t *ctx, ism330dhcx_odr_xl_t *val)
Accelerometer UI data rate selection.
int32_t ism330dhcx_gy_data_rate_get(stmdev_ctx_t *ctx, ism330dhcx_odr_g_t *val)
Gyroscope data rate.
int32_t ism330dhcx_xl_usr_offset_z_set(stmdev_ctx_t *ctx, uint8_t *buff)
Accelerometer Z-axis user offset correction expressed in two’s complement, weight depends on USR_OFF_...
int32_t ism330dhcx_xl_usr_offset_set(stmdev_ctx_t *ctx, uint8_t val)
Enables user offset on out.
int32_t ism330dhcx_block_data_update_set(stmdev_ctx_t *ctx, uint8_t val)
Block data update.
int32_t ism330dhcx_gy_power_mode_set(stmdev_ctx_t *ctx, ism330dhcx_g_hm_mode_t val)
Operating mode for gyroscope.
int32_t ism330dhcx_xl_usr_offset_y_get(stmdev_ctx_t *ctx, uint8_t *buff)
Accelerometer Y-axis user offset correction expressed in two’s complement, weight depends on USR_OFF_...
int32_t ism330dhcx_all_sources_get(stmdev_ctx_t *ctx, ism330dhcx_all_sources_t *val)
Read all the interrupt flag of the device.
int32_t ism330dhcx_xl_usr_offset_get(stmdev_ctx_t *ctx, uint8_t *val)
Get user offset on out flag.
int32_t ism330dhcx_mlc_data_rate_get(stmdev_ctx_t *ctx, ism330dhcx_mlc_odr_t *val)
Machine Learning Core data rate selection.
int32_t ism330dhcx_mlc_set(stmdev_ctx_t *ctx, uint8_t val)
Enable Machine Learning Core.
int32_t ism330dhcx_mlc_data_rate_set(stmdev_ctx_t *ctx, ism330dhcx_mlc_odr_t val)
Machine Learning Core data rate selection.
int32_t ism330dhcx_mlc_get(stmdev_ctx_t *ctx, uint8_t *val)
Enable Machine Learning Core.
int32_t ism330dhcx_mlc_status_get(stmdev_ctx_t *ctx, ism330dhcx_mlc_status_mainpage_t *val)
Machine Learning Core status register[get].
#define PROPERTY_ENABLE
#define PROPERTY_DISABLE
This file contains all the functions prototypes for the ism330dhcx_reg.c driver.
ism330dhcx_status_reg_t status_reg
ism330dhcx_wake_up_src_t wake_up_src
ism330dhcx_fsm_status_a_t fsm_status_a
ism330dhcx_emb_func_status_t emb_func_status
ism330dhcx_d6d_src_t d6d_src
ism330dhcx_all_int_src_t all_int_src
ism330dhcx_fsm_status_b_t fsm_status_b
ism330dhcx_tap_src_t tap_src
ism330dhcx_fsm_enable_b_t fsm_enable_b
ism330dhcx_fsm_enable_a_t fsm_enable_a
ism330dhcx_fsm_outs1_t fsm_outs1
ism330dhcx_int1_ctrl_t int1_ctrl
ism330dhcx_md1_cfg_t md1_cfg
ism330dhcx_fsm_int1_b_t fsm_int1_b
ism330dhcx_emb_func_int1_t emb_func_int1
ism330dhcx_mlc_int1_t mlc_int1
ism330dhcx_fsm_int1_a_t fsm_int1_a
ism330dhcx_emb_func_int2_t emb_func_int2
ism330dhcx_md2_cfg_t md2_cfg
ism330dhcx_fsm_int2_a_t fsm_int2_a
ism330dhcx_fsm_int2_b_t fsm_int2_b
ism330dhcx_int2_ctrl_t int2_ctrl
ism330dhcx_mlc_int2_t mlc_int2
stmdev_read_ptr read_reg
stmdev_write_ptr write_reg
Component mandatory fields.
void * handle
Customizable optional pointer.