STSW-STLKT01: Drivers/BSP/SensorTile/SensorTile_accelero.c Source File

STSW-STLKT01

STSW-STLKT01
SensorTile_accelero.c
Go to the documentation of this file.
1 
39 /* Includes ------------------------------------------------------------------*/
40 
41 #include "SensorTile_accelero.h"
42 
43 
44 
62 static DrvContextTypeDef ACCELERO_SensorHandle[ ACCELERO_SENSORS_MAX_NUM ];
63 static ACCELERO_Data_t ACCELERO_Data[ ACCELERO_SENSORS_MAX_NUM ]; // Accelerometer - all.
64 static LSM6DSM_X_Data_t LSM6DSM_X_0_Data; // Accelerometer - sensor 0.
65 static LSM303AGR_X_Data_t LSM303AGR_X_0_Data; // Accelerometer - sensor 1.
66 
74 static DrvStatusTypeDef BSP_LSM6DSM_ACCELERO_Init( void **handle );
75 static DrvStatusTypeDef BSP_LSM303AGR_ACCELERO_Init( void **handle );
76 
93 DrvStatusTypeDef BSP_ACCELERO_Init( ACCELERO_ID_t id, void **handle )
94 {
95 
96  *handle = NULL;
97 
98  switch(id)
99  {
100  case ACCELERO_SENSORS_AUTO:
101  default:
102  {
103  /* Try to init the LSM6DSM before */
104  if(BSP_LSM6DSM_ACCELERO_Init(handle) == COMPONENT_ERROR )
105  {
106  /* Normally it must not happen */
107  /* Try to init the LSM303AGR accelerometer */
108  if( BSP_LSM303AGR_ACCELERO_Init(handle) == COMPONENT_ERROR )
109  {
110  return COMPONENT_ERROR;
111  }
112  }
113  break;
114  }
115  case LSM6DSM_X_0:
116  {
117  if( BSP_LSM6DSM_ACCELERO_Init(handle) == COMPONENT_ERROR )
118  {
119  return COMPONENT_ERROR;
120  }
121  break;
122  }
123  case LSM303AGR_X_0:
124  {
125  if( BSP_LSM303AGR_ACCELERO_Init(handle) == COMPONENT_ERROR )
126  {
127  return COMPONENT_ERROR;
128  }
129  break;
130  }
131  }
132 
133  return COMPONENT_OK;
134 }
135 
136 static DrvStatusTypeDef BSP_LSM6DSM_ACCELERO_Init( void **handle )
137 {
138  ACCELERO_Drv_t *driver = NULL;
139  uint8_t data = 0x0C;
140 
141  if(ACCELERO_SensorHandle[ LSM6DSM_X_0 ].isInitialized == 1)
142  {
143  /* We have reached the max num of instance for this component */
144  return COMPONENT_ERROR;
145  }
146 
147  if ( Sensor_IO_SPI_Init() == COMPONENT_ERROR )
148  {
149  return COMPONENT_ERROR;
150  }
151 
152  /* Setup sensor handle. */
153  ACCELERO_SensorHandle[ LSM6DSM_X_0 ].who_am_i = LSM6DSM_ACC_GYRO_WHO_AM_I;
154  ACCELERO_SensorHandle[ LSM6DSM_X_0 ].ifType = 1; // SPI interface
155  ACCELERO_SensorHandle[ LSM6DSM_X_0 ].address = LSM6DSM_ACC_GYRO_I2C_ADDRESS_HIGH;
156  ACCELERO_SensorHandle[ LSM6DSM_X_0 ].spiDevice = LSM6DSM;
157  ACCELERO_SensorHandle[ LSM6DSM_X_0 ].instance = LSM6DSM_X_0;
158  ACCELERO_SensorHandle[ LSM6DSM_X_0 ].isInitialized = 0;
159  ACCELERO_SensorHandle[ LSM6DSM_X_0 ].isEnabled = 0;
160  ACCELERO_SensorHandle[ LSM6DSM_X_0 ].isCombo = 1;
161  ACCELERO_SensorHandle[ LSM6DSM_X_0 ].pData = ( void * )&ACCELERO_Data[ LSM6DSM_X_0 ];
162  ACCELERO_SensorHandle[ LSM6DSM_X_0 ].pVTable = ( void * )&LSM6DSM_X_Drv;
163  ACCELERO_SensorHandle[ LSM6DSM_X_0 ].pExtVTable = ( void * )&LSM6DSM_X_ExtDrv;
164 
165  LSM6DSM_X_0_Data.comboData = &LSM6DSM_Combo_Data[0];
166  ACCELERO_Data[ LSM6DSM_X_0 ].pComponentData = ( void * )&LSM6DSM_X_0_Data;
167  ACCELERO_Data[ LSM6DSM_X_0 ].pExtData = 0;
168 
169  *handle = (void *)&ACCELERO_SensorHandle[ LSM6DSM_X_0 ];
170 
171  Sensor_IO_SPI_CS_Init(*handle);
172 
173  if(LSM6DSM_Combo_Data[0].isGyroInitialized == 0)
174  {
175  // SPI Serial Interface Mode selection --> 3Wires
176  if( Sensor_IO_Write(*handle, LSM6DSM_ACC_GYRO_CTRL3_C, &data, 1) )
177  {
178  return COMPONENT_ERROR;
179  }
180  }
181 
182  driver = ( ACCELERO_Drv_t * )((DrvContextTypeDef *)(*handle))->pVTable;
183 
184  if ( driver->Init == NULL )
185  {
186  memset((*handle), 0, sizeof(DrvContextTypeDef));
187  *handle = NULL;
188  return COMPONENT_ERROR;
189  }
190 
191  if ( driver->Init( (DrvContextTypeDef *)(*handle) ) == COMPONENT_ERROR )
192  {
193  memset((*handle), 0, sizeof(DrvContextTypeDef));
194  *handle = NULL;
195  return COMPONENT_ERROR;
196  }
197 
198  /* Disable I2C interface */
199  if ( LSM6DSM_ACC_GYRO_W_I2C_DISABLE( *handle, LSM6DSM_ACC_GYRO_I2C_DISABLE_SPI_ONLY ) == MEMS_ERROR )
200  {
201  return COMPONENT_ERROR;
202  }
203 
204  /* Configure interrupt lines for LSM6DSM */
206 
207  return COMPONENT_OK;
208 }
209 
210 static DrvStatusTypeDef BSP_LSM303AGR_ACCELERO_Init( void **handle )
211 {
212  ACCELERO_Drv_t *driver = NULL;
213  uint8_t data = 0x01;
214 
215  if(ACCELERO_SensorHandle[ LSM303AGR_X_0 ].isInitialized == 1)
216  {
217  /* We have reached the max num of instance for this component */
218  return COMPONENT_ERROR;
219  }
220 
221  if ( Sensor_IO_SPI_Init() == COMPONENT_ERROR )
222  {
223  return COMPONENT_ERROR;
224  }
225 
226  /* Setup sensor handle. */
227  ACCELERO_SensorHandle[ LSM303AGR_X_0 ].who_am_i = LSM303AGR_ACC_WHO_AM_I;
228  ACCELERO_SensorHandle[ LSM303AGR_X_0 ].ifType = 1; // SPI interface
229  ACCELERO_SensorHandle[ LSM303AGR_X_0 ].address = LSM303AGR_ACC_I2C_ADDRESS;
230  ACCELERO_SensorHandle[ LSM303AGR_X_0 ].spiDevice = LSM303AGR_X;
231  ACCELERO_SensorHandle[ LSM303AGR_X_0 ].instance = LSM303AGR_X_0;
232  ACCELERO_SensorHandle[ LSM303AGR_X_0 ].isInitialized = 0;
233  ACCELERO_SensorHandle[ LSM303AGR_X_0 ].isEnabled = 0;
234  ACCELERO_SensorHandle[ LSM303AGR_X_0 ].isCombo = 1;
235  ACCELERO_SensorHandle[ LSM303AGR_X_0 ].pData = ( void * )&ACCELERO_Data[ LSM303AGR_X_0 ];
236  ACCELERO_SensorHandle[ LSM303AGR_X_0 ].pVTable = ( void * )&LSM303AGR_X_Drv;
237  ACCELERO_SensorHandle[ LSM303AGR_X_0 ].pExtVTable = 0;
238 
239  LSM303AGR_X_0_Data.comboData = &LSM303AGR_Combo_Data[0];
240  ACCELERO_Data[ LSM303AGR_X_0 ].pComponentData = ( void * )&LSM303AGR_X_0_Data;
241  ACCELERO_Data[ LSM303AGR_X_0 ].pExtData = 0;
242 
243  *handle = (void *)&ACCELERO_SensorHandle[ LSM303AGR_X_0 ];
244 
245  Sensor_IO_SPI_CS_Init(*handle);
246 
247  if(LSM303AGR_Combo_Data[0].isMagInitialized == 0)
248  {
249  // SPI Serial Interface Mode selection --> 3Wires
250  if( Sensor_IO_Write(*handle, LSM303AGR_ACC_CTRL_REG4, &data, 1) )
251  {
252  return COMPONENT_ERROR;
253  }
254  }
255 
256  driver = ( ACCELERO_Drv_t * )((DrvContextTypeDef *)(*handle))->pVTable;
257 
258  if ( driver->Init == NULL )
259  {
260  memset((*handle), 0, sizeof(DrvContextTypeDef));
261  *handle = NULL;
262  return COMPONENT_ERROR;
263  }
264 
265  if ( driver->Init( (DrvContextTypeDef *)(*handle) ) == COMPONENT_ERROR )
266  {
267  memset((*handle), 0, sizeof(DrvContextTypeDef));
268  *handle = NULL;
269  return COMPONENT_ERROR;
270  }
271 
272  return COMPONENT_OK;
273 }
274 
275 
282 DrvStatusTypeDef BSP_ACCELERO_DeInit( void **handle )
283 {
284 
285  DrvContextTypeDef *ctx = (DrvContextTypeDef *)(*handle);
286  ACCELERO_Drv_t *driver = NULL;
287 
288  if(ctx == NULL)
289  {
290  return COMPONENT_ERROR;
291  }
292 
293  driver = ( ACCELERO_Drv_t * )ctx->pVTable;
294 
295  if ( driver->DeInit == NULL )
296  {
297  return COMPONENT_ERROR;
298  }
299 
300  if ( driver->DeInit( ctx ) == COMPONENT_ERROR )
301  {
302  return COMPONENT_ERROR;
303  }
304 
305  memset(ctx, 0, sizeof(DrvContextTypeDef));
306 
307  *handle = NULL;
308 
309  return COMPONENT_OK;
310 }
311 
312 
319 DrvStatusTypeDef BSP_ACCELERO_Sensor_Enable( void *handle )
320 {
321 
322  DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
323  ACCELERO_Drv_t *driver = NULL;
324 
325  if(ctx == NULL)
326  {
327  return COMPONENT_ERROR;
328  }
329 
330  driver = ( ACCELERO_Drv_t * )ctx->pVTable;
331 
332  if ( driver->Sensor_Enable == NULL )
333  {
334  return COMPONENT_ERROR;
335  }
336 
337  if ( driver->Sensor_Enable( ctx ) == COMPONENT_ERROR )
338  {
339  return COMPONENT_ERROR;
340  }
341 
342  return COMPONENT_OK;
343 }
344 
345 
346 
353 DrvStatusTypeDef BSP_ACCELERO_Sensor_Disable( void *handle )
354 {
355 
356  DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
357  ACCELERO_Drv_t *driver = NULL;
358 
359  if(ctx == NULL)
360  {
361  return COMPONENT_ERROR;
362  }
363 
364  driver = ( ACCELERO_Drv_t * )ctx->pVTable;
365 
366  if ( driver->Sensor_Disable == NULL )
367  {
368  return COMPONENT_ERROR;
369  }
370 
371  if ( driver->Sensor_Disable( ctx ) == COMPONENT_ERROR )
372  {
373  return COMPONENT_ERROR;
374  }
375 
376  return COMPONENT_OK;
377 }
378 
379 
387 DrvStatusTypeDef BSP_ACCELERO_IsInitialized( void *handle, uint8_t *status )
388 {
389  DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
390 
391  if(ctx == NULL)
392  {
393  return COMPONENT_ERROR;
394  }
395 
396  if ( status == NULL )
397  {
398  return COMPONENT_ERROR;
399  }
400 
401  *status = ctx->isInitialized;
402 
403  return COMPONENT_OK;
404 }
405 
406 
414 DrvStatusTypeDef BSP_ACCELERO_IsEnabled( void *handle, uint8_t *status )
415 {
416  DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
417 
418  if(ctx == NULL)
419  {
420  return COMPONENT_ERROR;
421  }
422 
423  if ( status == NULL )
424  {
425  return COMPONENT_ERROR;
426  }
427 
428  *status = ctx->isEnabled;
429 
430  return COMPONENT_OK;
431 }
432 
433 
441 DrvStatusTypeDef BSP_ACCELERO_IsCombo( void *handle, uint8_t *status )
442 {
443  DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
444 
445  if(ctx == NULL)
446  {
447  return COMPONENT_ERROR;
448  }
449 
450  if ( status == NULL )
451  {
452  return COMPONENT_ERROR;
453  }
454 
455  *status = ctx->isCombo;
456 
457  return COMPONENT_OK;
458 }
459 
460 
468 DrvStatusTypeDef BSP_ACCELERO_Get_Instance( void *handle, uint8_t *instance )
469 {
470  DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
471 
472  if(ctx == NULL)
473  {
474  return COMPONENT_ERROR;
475  }
476 
477  if ( instance == NULL )
478  {
479  return COMPONENT_ERROR;
480  }
481 
482  *instance = ctx->instance;
483 
484  return COMPONENT_OK;
485 }
486 
487 
488 
496 DrvStatusTypeDef BSP_ACCELERO_Get_WhoAmI( void *handle, uint8_t *who_am_i )
497 {
498 
499  DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
500  ACCELERO_Drv_t *driver = NULL;
501 
502  if(ctx == NULL)
503  {
504  return COMPONENT_ERROR;
505  }
506 
507  driver = ( ACCELERO_Drv_t * )ctx->pVTable;
508 
509  if ( driver->Get_WhoAmI == NULL )
510  {
511  return COMPONENT_ERROR;
512  }
513 
514  if ( driver->Get_WhoAmI( ctx, who_am_i ) == COMPONENT_ERROR )
515  {
516  return COMPONENT_ERROR;
517  }
518 
519  return COMPONENT_OK;
520 }
521 
522 
523 
530 DrvStatusTypeDef BSP_ACCELERO_Check_WhoAmI( void *handle )
531 {
532 
533  DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
534  ACCELERO_Drv_t *driver = NULL;
535 
536  if(ctx == NULL)
537  {
538  return COMPONENT_ERROR;
539  }
540 
541  driver = ( ACCELERO_Drv_t * )ctx->pVTable;
542 
543  if ( driver->Check_WhoAmI == NULL )
544  {
545  return COMPONENT_ERROR;
546  }
547 
548  if ( driver->Check_WhoAmI( ctx ) == COMPONENT_ERROR )
549  {
550  return COMPONENT_ERROR;
551  }
552 
553  return COMPONENT_OK;
554 }
555 
556 
557 
565 DrvStatusTypeDef BSP_ACCELERO_Get_Axes( void *handle, SensorAxes_t *acceleration )
566 {
567 
568  DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
569  ACCELERO_Drv_t *driver = NULL;
570 
571  if(ctx == NULL)
572  {
573  return COMPONENT_ERROR;
574  }
575 
576  driver = ( ACCELERO_Drv_t * )ctx->pVTable;
577 
578  if(acceleration == NULL)
579  {
580  return COMPONENT_ERROR;
581  }
582 
583  if ( driver->Get_Axes == NULL )
584  {
585  return COMPONENT_ERROR;
586  }
587 
588  if ( driver->Get_Axes( ctx, acceleration ) == COMPONENT_ERROR )
589  {
590  return COMPONENT_ERROR;
591  }
592 
593  return COMPONENT_OK;
594 }
595 
596 
597 
605 DrvStatusTypeDef BSP_ACCELERO_Get_AxesRaw( void *handle, SensorAxesRaw_t *value )
606 {
607  DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
608  ACCELERO_Drv_t *driver = NULL;
609 
610  if(ctx == NULL)
611  {
612  return COMPONENT_ERROR;
613  }
614 
615  driver = ( ACCELERO_Drv_t * )ctx->pVTable;
616 
617  if(value == NULL)
618  {
619  return COMPONENT_ERROR;
620  }
621 
622  if ( driver->Get_AxesRaw == NULL )
623  {
624  return COMPONENT_ERROR;
625  }
626 
627  if ( driver->Get_AxesRaw( ctx, value) == COMPONENT_ERROR )
628  {
629  return COMPONENT_ERROR;
630  }
631 
632  return COMPONENT_OK;
633 }
634 
635 
643 DrvStatusTypeDef BSP_ACCELERO_Get_Sensitivity( void *handle, float *sensitivity )
644 {
645 
646  DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
647  ACCELERO_Drv_t *driver = NULL;
648 
649  if(ctx == NULL)
650  {
651  return COMPONENT_ERROR;
652  }
653 
654  driver = ( ACCELERO_Drv_t * )ctx->pVTable;
655 
656  if(sensitivity == NULL)
657  {
658  return COMPONENT_ERROR;
659  }
660 
661  if ( driver->Get_Sensitivity == NULL )
662  {
663  return COMPONENT_ERROR;
664  }
665 
666  if ( driver->Get_Sensitivity( ctx, sensitivity ) == COMPONENT_ERROR )
667  {
668  return COMPONENT_ERROR;
669  }
670 
671  return COMPONENT_OK;
672 }
673 
674 
675 
683 DrvStatusTypeDef BSP_ACCELERO_Get_ODR( void *handle, float *odr )
684 {
685 
686  DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
687  ACCELERO_Drv_t *driver = NULL;
688 
689  if(ctx == NULL)
690  {
691  return COMPONENT_ERROR;
692  }
693 
694  driver = ( ACCELERO_Drv_t * )ctx->pVTable;
695 
696  if(odr == NULL)
697  {
698  return COMPONENT_ERROR;
699  }
700 
701  if ( driver->Get_ODR == NULL )
702  {
703  return COMPONENT_ERROR;
704  }
705 
706  if ( driver->Get_ODR( ctx, odr ) == COMPONENT_ERROR )
707  {
708  return COMPONENT_ERROR;
709  }
710 
711  return COMPONENT_OK;
712 }
713 
714 
715 
723 DrvStatusTypeDef BSP_ACCELERO_Set_ODR( void *handle, SensorOdr_t odr )
724 {
725 
726  DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
727  ACCELERO_Drv_t *driver = NULL;
728 
729  if(ctx == NULL)
730  {
731  return COMPONENT_ERROR;
732  }
733 
734  driver = ( ACCELERO_Drv_t * )ctx->pVTable;
735 
736  if ( driver->Set_ODR == NULL )
737  {
738  return COMPONENT_ERROR;
739  }
740  if ( driver->Set_ODR( ctx, odr ) == COMPONENT_ERROR )
741  {
742  return COMPONENT_ERROR;
743  }
744 
745  return COMPONENT_OK;
746 }
747 
748 
749 
757 DrvStatusTypeDef BSP_ACCELERO_Set_ODR_Value( void *handle, float odr )
758 {
759 
760  DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
761  ACCELERO_Drv_t *driver = NULL;
762 
763  if(ctx == NULL)
764  {
765  return COMPONENT_ERROR;
766  }
767 
768  driver = ( ACCELERO_Drv_t * )ctx->pVTable;
769 
770  if ( driver->Set_ODR_Value == NULL )
771  {
772  return COMPONENT_ERROR;
773  }
774  if ( driver->Set_ODR_Value( ctx, odr ) == COMPONENT_ERROR )
775  {
776  return COMPONENT_ERROR;
777  }
778 
779  return COMPONENT_OK;
780 }
781 
782 
783 
791 DrvStatusTypeDef BSP_ACCELERO_Get_FS( void *handle, float *fullScale )
792 {
793 
794  DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
795  ACCELERO_Drv_t *driver = NULL;
796 
797  if(ctx == NULL)
798  {
799  return COMPONENT_ERROR;
800  }
801 
802  driver = ( ACCELERO_Drv_t * )ctx->pVTable;
803 
804  if(fullScale == NULL)
805  {
806  return COMPONENT_ERROR;
807  }
808 
809  if ( driver->Get_FS == NULL )
810  {
811  return COMPONENT_ERROR;
812  }
813 
814  if ( driver->Get_FS( ctx, fullScale ) == COMPONENT_ERROR )
815  {
816  return COMPONENT_ERROR;
817  }
818 
819  return COMPONENT_OK;
820 }
821 
822 
823 
831 DrvStatusTypeDef BSP_ACCELERO_Set_FS( void *handle, SensorFs_t fullScale )
832 {
833 
834  DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
835  ACCELERO_Drv_t *driver = NULL;
836 
837  if(ctx == NULL)
838  {
839  return COMPONENT_ERROR;
840  }
841 
842  driver = ( ACCELERO_Drv_t * )ctx->pVTable;
843 
844  if ( driver->Set_FS == NULL )
845  {
846  return COMPONENT_ERROR;
847  }
848  if ( driver->Set_FS( ctx, fullScale ) == COMPONENT_ERROR )
849  {
850  return COMPONENT_ERROR;
851  }
852 
853  return COMPONENT_OK;
854 }
855 
856 
857 
865 DrvStatusTypeDef BSP_ACCELERO_Set_FS_Value( void *handle, float fullScale )
866 {
867 
868  DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
869  ACCELERO_Drv_t *driver = NULL;
870 
871  if(ctx == NULL)
872  {
873  return COMPONENT_ERROR;
874  }
875 
876  driver = ( ACCELERO_Drv_t * )ctx->pVTable;
877 
878  if ( driver->Set_FS_Value == NULL )
879  {
880  return COMPONENT_ERROR;
881  }
882  if ( driver->Set_FS_Value( ctx, fullScale ) == COMPONENT_ERROR )
883  {
884  return COMPONENT_ERROR;
885  }
886 
887  return COMPONENT_OK;
888 }
889 
890 
891 
899 DrvStatusTypeDef BSP_ACCELERO_Get_Axes_Status( void *handle, uint8_t *xyz_enabled )
900 {
901 
902  DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
903  ACCELERO_Drv_t *driver = NULL;
904 
905  if(ctx == NULL)
906  {
907  return COMPONENT_ERROR;
908  }
909 
910  driver = ( ACCELERO_Drv_t * )ctx->pVTable;
911 
912  if(xyz_enabled == NULL)
913  {
914  return COMPONENT_ERROR;
915  }
916 
917  if ( driver->Get_Axes_Status == NULL )
918  {
919  return COMPONENT_ERROR;
920  }
921 
922  if ( driver->Get_Axes_Status( ctx, xyz_enabled ) == COMPONENT_ERROR )
923  {
924  return COMPONENT_ERROR;
925  }
926 
927  return COMPONENT_OK;
928 }
929 
930 
931 
939 DrvStatusTypeDef BSP_ACCELERO_Set_Axes_Status( void *handle, uint8_t *enable_xyz )
940 {
941 
942  DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
943  ACCELERO_Drv_t *driver = NULL;
944 
945  if(ctx == NULL)
946  {
947  return COMPONENT_ERROR;
948  }
949 
950  driver = ( ACCELERO_Drv_t * )ctx->pVTable;
951 
952  if(enable_xyz == NULL)
953  {
954  return COMPONENT_ERROR;
955  }
956 
957  if ( driver->Set_Axes_Status == NULL )
958  {
959  return COMPONENT_ERROR;
960  }
961 
962  if ( driver->Set_Axes_Status( ctx, enable_xyz ) == COMPONENT_ERROR )
963  {
964  return COMPONENT_ERROR;
965  }
966 
967  return COMPONENT_OK;
968 }
969 
970 
979 DrvStatusTypeDef BSP_ACCELERO_Read_Reg( void *handle, uint8_t reg, uint8_t *data )
980 {
981 
982  DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
983  ACCELERO_Drv_t *driver = NULL;
984 
985  if(ctx == NULL)
986  {
987  return COMPONENT_ERROR;
988  }
989 
990  driver = ( ACCELERO_Drv_t * )ctx->pVTable;
991 
992  if(data == NULL)
993  {
994  return COMPONENT_ERROR;
995  }
996 
997  if ( driver->Read_Reg == NULL )
998  {
999  return COMPONENT_ERROR;
1000  }
1001 
1002  if ( driver->Read_Reg( ctx, reg, data ) == COMPONENT_ERROR )
1003  {
1004  return COMPONENT_ERROR;
1005  }
1006 
1007  return COMPONENT_OK;
1008 }
1009 
1010 
1011 
1012 
1021 DrvStatusTypeDef BSP_ACCELERO_Write_Reg( void *handle, uint8_t reg, uint8_t data )
1022 {
1023 
1024  DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
1025  ACCELERO_Drv_t *driver = NULL;
1026 
1027  if(ctx == NULL)
1028  {
1029  return COMPONENT_ERROR;
1030  }
1031 
1032  driver = ( ACCELERO_Drv_t * )ctx->pVTable;
1033 
1034  if ( driver->Write_Reg == NULL )
1035  {
1036  return COMPONENT_ERROR;
1037  }
1038 
1039  if ( driver->Write_Reg( ctx, reg, data ) == COMPONENT_ERROR )
1040  {
1041  return COMPONENT_ERROR;
1042  }
1043 
1044  return COMPONENT_OK;
1045 }
1046 
1047 
1048 
1056 DrvStatusTypeDef BSP_ACCELERO_Get_DRDY_Status( void *handle, uint8_t *status )
1057 {
1058 
1059  DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
1060  ACCELERO_Drv_t *driver = NULL;
1061 
1062  if(ctx == NULL)
1063  {
1064  return COMPONENT_ERROR;
1065  }
1066 
1067  driver = ( ACCELERO_Drv_t * )ctx->pVTable;
1068 
1069  if ( driver->Get_DRDY_Status == NULL )
1070  {
1071  return COMPONENT_ERROR;
1072  }
1073 
1074  if ( driver->Get_DRDY_Status( ctx, status ) == COMPONENT_ERROR )
1075  {
1076  return COMPONENT_ERROR;
1077  }
1078 
1079  return COMPONENT_OK;
1080 }
1081 
1082 
1090 DrvStatusTypeDef BSP_ACCELERO_Enable_Free_Fall_Detection_Ext( void *handle )
1091 {
1092 
1093  DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
1094 
1095  if(ctx == NULL)
1096  {
1097  return COMPONENT_ERROR;
1098  }
1099 
1100  if ( ctx->pExtVTable == NULL )
1101  {
1102  return COMPONENT_ERROR;
1103  }
1104 
1105  /* At the moment this feature is only implemented for LSM6DS3 */
1106  if ( ctx->who_am_i == LSM6DSM_ACC_GYRO_WHO_AM_I )
1107  {
1108  LSM6DSM_X_ExtDrv_t *extDriver = ( LSM6DSM_X_ExtDrv_t * )ctx->pExtVTable;
1109 
1110  if ( extDriver->Enable_Free_Fall_Detection == NULL )
1111  {
1112  return COMPONENT_ERROR;
1113  }
1114 
1115  else
1116  {
1117  return extDriver->Enable_Free_Fall_Detection( ctx );
1118  }
1119  }
1120 
1121  else
1122  {
1123  return COMPONENT_ERROR;
1124  }
1125 }
1126 
1127 
1128 
1135 DrvStatusTypeDef BSP_ACCELERO_Disable_Free_Fall_Detection_Ext( void *handle )
1136 {
1137 
1138  DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
1139 
1140  if(ctx == NULL)
1141  {
1142  return COMPONENT_ERROR;
1143  }
1144 
1145  if ( ctx->pExtVTable == NULL )
1146  {
1147  return COMPONENT_ERROR;
1148  }
1149 
1150  /* At the moment this feature is only implemented for LSM6DS3 */
1151  if ( ctx->who_am_i == LSM6DSM_ACC_GYRO_WHO_AM_I )
1152  {
1153  LSM6DSM_X_ExtDrv_t *extDriver = ( LSM6DSM_X_ExtDrv_t * )ctx->pExtVTable;
1154 
1155  if ( extDriver->Disable_Free_Fall_Detection == NULL )
1156  {
1157  return COMPONENT_ERROR;
1158  }
1159 
1160  else
1161  {
1162  return extDriver->Disable_Free_Fall_Detection( ctx );
1163  }
1164  }
1165 
1166  else
1167  {
1168  return COMPONENT_ERROR;
1169  }
1170 }
1171 
1172 
1173 
1181 DrvStatusTypeDef BSP_ACCELERO_Get_Free_Fall_Detection_Status_Ext( void *handle, uint8_t *status )
1182 {
1183 
1184  DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
1185 
1186  if(ctx == NULL)
1187  {
1188  return COMPONENT_ERROR;
1189  }
1190 
1191  if ( ctx->pExtVTable == NULL )
1192  {
1193  return COMPONENT_ERROR;
1194  }
1195 
1196  if ( status == NULL )
1197  {
1198  return COMPONENT_ERROR;
1199  }
1200 
1201  /* At the moment this feature is only implemented for LSM6DS3 */
1202  if ( ctx->who_am_i == LSM6DSM_ACC_GYRO_WHO_AM_I )
1203  {
1204  LSM6DSM_X_ExtDrv_t *extDriver = ( LSM6DSM_X_ExtDrv_t * )ctx->pExtVTable;
1205 
1206  if ( extDriver->Get_Free_Fall_Detection_Status == NULL )
1207  {
1208  return COMPONENT_ERROR;
1209  }
1210 
1211  else
1212  {
1213  return extDriver->Get_Free_Fall_Detection_Status( ctx, status );
1214  }
1215  }
1216 
1217  else
1218  {
1219  return COMPONENT_ERROR;
1220  }
1221 }
1222 
1223 
1224 
1232 DrvStatusTypeDef BSP_ACCELERO_Set_Free_Fall_Threshold_Ext( void *handle, LSM6DSM_ACC_GYRO_FF_THS_t thr )
1233 {
1234 
1235  DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
1236 
1237  if(ctx == NULL)
1238  {
1239  return COMPONENT_ERROR;
1240  }
1241 
1242  if ( ctx->pExtVTable == NULL )
1243  {
1244  return COMPONENT_ERROR;
1245  }
1246 
1247  /* At the moment this feature is only implemented for LSM6DS3 */
1248  if ( ctx->who_am_i == LSM6DSM_ACC_GYRO_WHO_AM_I )
1249  {
1250  LSM6DSM_X_ExtDrv_t *extDriver = ( LSM6DSM_X_ExtDrv_t * )ctx->pExtVTable;
1251 
1252  if ( extDriver->Set_Free_Fall_Threshold == NULL )
1253  {
1254  return COMPONENT_ERROR;
1255  }
1256 
1257  else
1258  {
1259  return extDriver->Set_Free_Fall_Threshold( ctx, thr );
1260  }
1261  }
1262 
1263  else
1264  {
1265  return COMPONENT_ERROR;
1266  }
1267 }
1268 
1269 
1270 
1278 DrvStatusTypeDef BSP_ACCELERO_Enable_Pedometer_Ext( void *handle )
1279 {
1280 
1281  DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
1282 
1283  if(ctx == NULL)
1284  {
1285  return COMPONENT_ERROR;
1286  }
1287 
1288  if ( ctx->pExtVTable == NULL )
1289  {
1290  return COMPONENT_ERROR;
1291  }
1292 
1293  /* At the moment this feature is only implemented for LSM6DS3 */
1294  if ( ctx->who_am_i == LSM6DSM_ACC_GYRO_WHO_AM_I )
1295  {
1296  LSM6DSM_X_ExtDrv_t *extDriver = ( LSM6DSM_X_ExtDrv_t * )ctx->pExtVTable;
1297 
1298  if ( extDriver->Enable_Pedometer == NULL )
1299  {
1300  return COMPONENT_ERROR;
1301  }
1302 
1303  else
1304  {
1305  return extDriver->Enable_Pedometer( ctx );
1306  }
1307  }
1308 
1309  else
1310  {
1311  return COMPONENT_ERROR;
1312  }
1313 }
1314 
1315 
1316 
1323 DrvStatusTypeDef BSP_ACCELERO_Disable_Pedometer_Ext( void *handle )
1324 {
1325 
1326  DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
1327 
1328  if(ctx == NULL)
1329  {
1330  return COMPONENT_ERROR;
1331  }
1332 
1333  if ( ctx->pExtVTable == NULL )
1334  {
1335  return COMPONENT_ERROR;
1336  }
1337 
1338  /* At the moment this feature is only implemented for LSM6DS3 */
1339  if ( ctx->who_am_i == LSM6DSM_ACC_GYRO_WHO_AM_I )
1340  {
1341  LSM6DSM_X_ExtDrv_t *extDriver = ( LSM6DSM_X_ExtDrv_t * )ctx->pExtVTable;
1342 
1343  if ( extDriver->Disable_Pedometer == NULL )
1344  {
1345  return COMPONENT_ERROR;
1346  }
1347 
1348  else
1349  {
1350  return extDriver->Disable_Pedometer( ctx );
1351  }
1352  }
1353 
1354  else
1355  {
1356  return COMPONENT_ERROR;
1357  }
1358 }
1359 
1360 
1361 
1369 DrvStatusTypeDef BSP_ACCELERO_Get_Pedometer_Status_Ext( void *handle, uint8_t *status )
1370 {
1371 
1372  DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
1373 
1374  if(ctx == NULL)
1375  {
1376  return COMPONENT_ERROR;
1377  }
1378 
1379  if ( ctx->pExtVTable == NULL )
1380  {
1381  return COMPONENT_ERROR;
1382  }
1383 
1384  if ( status == NULL )
1385  {
1386  return COMPONENT_ERROR;
1387  }
1388 
1389  /* At the moment this feature is only implemented for LSM6DS3 */
1390  if ( ctx->who_am_i == LSM6DSM_ACC_GYRO_WHO_AM_I )
1391  {
1392  LSM6DSM_X_ExtDrv_t *extDriver = ( LSM6DSM_X_ExtDrv_t * )ctx->pExtVTable;
1393 
1394  if ( extDriver->Get_Pedometer_Status == NULL )
1395  {
1396  return COMPONENT_ERROR;
1397  }
1398 
1399  else
1400  {
1401  return extDriver->Get_Pedometer_Status( ctx, status );
1402  }
1403  }
1404 
1405  else
1406  {
1407  return COMPONENT_ERROR;
1408  }
1409 }
1410 
1411 
1412 
1420 DrvStatusTypeDef BSP_ACCELERO_Get_Step_Count_Ext( void *handle, uint16_t *step_count )
1421 {
1422 
1423  DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
1424 
1425  if(ctx == NULL)
1426  {
1427  return COMPONENT_ERROR;
1428  }
1429 
1430  if ( ctx->pExtVTable == NULL )
1431  {
1432  return COMPONENT_ERROR;
1433  }
1434 
1435  if ( step_count == NULL )
1436  {
1437  return COMPONENT_ERROR;
1438  }
1439 
1440  /* At the moment this feature is only implemented for LSM6DS3 */
1441  if ( ctx->who_am_i == LSM6DSM_ACC_GYRO_WHO_AM_I )
1442  {
1443  LSM6DSM_X_ExtDrv_t *extDriver = ( LSM6DSM_X_ExtDrv_t * )ctx->pExtVTable;
1444 
1445  if ( extDriver->Get_Step_Count == NULL )
1446  {
1447  return COMPONENT_ERROR;
1448  }
1449 
1450  else
1451  {
1452  return extDriver->Get_Step_Count( ctx, step_count );
1453  }
1454  }
1455 
1456  else
1457  {
1458  return COMPONENT_ERROR;
1459  }
1460 }
1461 
1462 
1463 
1470 DrvStatusTypeDef BSP_ACCELERO_Reset_Step_Counter_Ext( void *handle )
1471 {
1472 
1473  DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
1474 
1475  if(ctx == NULL)
1476  {
1477  return COMPONENT_ERROR;
1478  }
1479 
1480  if ( ctx->pExtVTable == NULL )
1481  {
1482  return COMPONENT_ERROR;
1483  }
1484 
1485  /* At the moment this feature is only implemented for LSM6DS3 */
1486  if ( ctx->who_am_i == LSM6DSM_ACC_GYRO_WHO_AM_I )
1487  {
1488  LSM6DSM_X_ExtDrv_t *extDriver = ( LSM6DSM_X_ExtDrv_t * )ctx->pExtVTable;
1489 
1490  if ( extDriver->Enable_Step_Counter_Reset == NULL || extDriver->Disable_Step_Counter_Reset == NULL )
1491  {
1492  return COMPONENT_ERROR;
1493  }
1494 
1495  else
1496  {
1497  if( extDriver->Enable_Step_Counter_Reset( ctx ) == COMPONENT_ERROR )
1498  {
1499  return COMPONENT_ERROR;
1500  }
1501 
1502  HAL_Delay( 10 );
1503 
1504  if( extDriver->Disable_Step_Counter_Reset( ctx ) == COMPONENT_ERROR )
1505  {
1506  return COMPONENT_ERROR;
1507  }
1508  }
1509  }
1510 
1511  else
1512  {
1513  return COMPONENT_ERROR;
1514  }
1515 
1516  return COMPONENT_OK;
1517 }
1518 
1519 
1520 
1528 DrvStatusTypeDef BSP_ACCELERO_Set_Pedometer_Threshold_Ext( void *handle, uint8_t thr )
1529 {
1530 
1531  DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
1532 
1533  if(ctx == NULL)
1534  {
1535  return COMPONENT_ERROR;
1536  }
1537 
1538  if ( ctx->pExtVTable == NULL )
1539  {
1540  return COMPONENT_ERROR;
1541  }
1542 
1543  /* At the moment this feature is only implemented for LSM6DS3 */
1544  if ( ctx->who_am_i == LSM6DSM_ACC_GYRO_WHO_AM_I )
1545  {
1546  LSM6DSM_X_ExtDrv_t *extDriver = ( LSM6DSM_X_ExtDrv_t * )ctx->pExtVTable;
1547 
1548  if ( extDriver->Set_Pedometer_Threshold == NULL )
1549  {
1550  return COMPONENT_ERROR;
1551  }
1552 
1553  else
1554  {
1555  return extDriver->Set_Pedometer_Threshold( ctx, thr );
1556  }
1557  }
1558 
1559  else
1560  {
1561  return COMPONENT_ERROR;
1562  }
1563 }
1564 
1565 
1566 
1574 DrvStatusTypeDef BSP_ACCELERO_Enable_Tilt_Detection_Ext( void *handle )
1575 {
1576 
1577  DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
1578 
1579  if(ctx == NULL)
1580  {
1581  return COMPONENT_ERROR;
1582  }
1583 
1584  if ( ctx->pExtVTable == NULL )
1585  {
1586  return COMPONENT_ERROR;
1587  }
1588 
1589  /* At the moment this feature is only implemented for LSM6DS3 */
1590  if ( ctx->who_am_i == LSM6DSM_ACC_GYRO_WHO_AM_I )
1591  {
1592  LSM6DSM_X_ExtDrv_t *extDriver = ( LSM6DSM_X_ExtDrv_t * )ctx->pExtVTable;
1593 
1594  if ( extDriver->Enable_Tilt_Detection == NULL )
1595  {
1596  return COMPONENT_ERROR;
1597  }
1598 
1599  else
1600  {
1601  return extDriver->Enable_Tilt_Detection( ctx );
1602  }
1603  }
1604 
1605  else
1606  {
1607  return COMPONENT_ERROR;
1608  }
1609 }
1610 
1611 
1612 
1619 DrvStatusTypeDef BSP_ACCELERO_Disable_Tilt_Detection_Ext( void *handle )
1620 {
1621 
1622  DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
1623 
1624  if(ctx == NULL)
1625  {
1626  return COMPONENT_ERROR;
1627  }
1628 
1629  if ( ctx->pExtVTable == NULL )
1630  {
1631  return COMPONENT_ERROR;
1632  }
1633 
1634  /* At the moment this feature is only implemented for LSM6DS3 */
1635  if ( ctx->who_am_i == LSM6DSM_ACC_GYRO_WHO_AM_I )
1636  {
1637  LSM6DSM_X_ExtDrv_t *extDriver = ( LSM6DSM_X_ExtDrv_t * )ctx->pExtVTable;
1638 
1639  if ( extDriver->Disable_Tilt_Detection == NULL )
1640  {
1641  return COMPONENT_ERROR;
1642  }
1643 
1644  else
1645  {
1646  return extDriver->Disable_Tilt_Detection( ctx );
1647  }
1648  }
1649 
1650  else
1651  {
1652  return COMPONENT_ERROR;
1653  }
1654 }
1655 
1656 
1657 
1665 DrvStatusTypeDef BSP_ACCELERO_Get_Tilt_Detection_Status_Ext( void *handle, uint8_t *status )
1666 {
1667 
1668  DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
1669 
1670  if(ctx == NULL)
1671  {
1672  return COMPONENT_ERROR;
1673  }
1674 
1675  if ( ctx->pExtVTable == NULL )
1676  {
1677  return COMPONENT_ERROR;
1678  }
1679 
1680  if ( status == NULL )
1681  {
1682  return COMPONENT_ERROR;
1683  }
1684 
1685  /* At the moment this feature is only implemented for LSM6DS3 */
1686  if ( ctx->who_am_i == LSM6DSM_ACC_GYRO_WHO_AM_I )
1687  {
1688  LSM6DSM_X_ExtDrv_t *extDriver = ( LSM6DSM_X_ExtDrv_t * )ctx->pExtVTable;
1689 
1690  if ( extDriver->Get_Tilt_Detection_Status == NULL )
1691  {
1692  return COMPONENT_ERROR;
1693  }
1694 
1695  else
1696  {
1697  return extDriver->Get_Tilt_Detection_Status( ctx, status );
1698  }
1699  }
1700 
1701  else
1702  {
1703  return COMPONENT_ERROR;
1704  }
1705 }
1706 
1707 
1708 
1716 DrvStatusTypeDef BSP_ACCELERO_Enable_Wake_Up_Detection_Ext( void *handle )
1717 {
1718 
1719  DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
1720 
1721  if(ctx == NULL)
1722  {
1723  return COMPONENT_ERROR;
1724  }
1725 
1726  if ( ctx->pExtVTable == NULL )
1727  {
1728  return COMPONENT_ERROR;
1729  }
1730 
1731  /* At the moment this feature is only implemented for LSM6DS3 */
1732  if ( ctx->who_am_i == LSM6DSM_ACC_GYRO_WHO_AM_I )
1733  {
1734  LSM6DSM_X_ExtDrv_t *extDriver = ( LSM6DSM_X_ExtDrv_t * )ctx->pExtVTable;
1735 
1736  if ( extDriver->Enable_Wake_Up_Detection == NULL )
1737  {
1738  return COMPONENT_ERROR;
1739  }
1740 
1741  else
1742  {
1743  return extDriver->Enable_Wake_Up_Detection( ctx );
1744  }
1745  }
1746 
1747  else
1748  {
1749  return COMPONENT_ERROR;
1750  }
1751 }
1752 
1753 
1754 
1761 DrvStatusTypeDef BSP_ACCELERO_Disable_Wake_Up_Detection_Ext( void *handle )
1762 {
1763 
1764  DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
1765 
1766  if(ctx == NULL)
1767  {
1768  return COMPONENT_ERROR;
1769  }
1770 
1771  if ( ctx->pExtVTable == NULL )
1772  {
1773  return COMPONENT_ERROR;
1774  }
1775 
1776  /* At the moment this feature is only implemented for LSM6DS3 */
1777  if ( ctx->who_am_i == LSM6DSM_ACC_GYRO_WHO_AM_I )
1778  {
1779  LSM6DSM_X_ExtDrv_t *extDriver = ( LSM6DSM_X_ExtDrv_t * )ctx->pExtVTable;
1780 
1781  if ( extDriver->Disable_Wake_Up_Detection == NULL )
1782  {
1783  return COMPONENT_ERROR;
1784  }
1785 
1786  else
1787  {
1788  return extDriver->Disable_Wake_Up_Detection( ctx );
1789  }
1790  }
1791 
1792  else
1793  {
1794  return COMPONENT_ERROR;
1795  }
1796 }
1797 
1798 
1799 
1807 DrvStatusTypeDef BSP_ACCELERO_Get_Wake_Up_Detection_Status_Ext( void *handle, uint8_t *status )
1808 {
1809 
1810  DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
1811 
1812  if(ctx == NULL)
1813  {
1814  return COMPONENT_ERROR;
1815  }
1816 
1817  if ( ctx->pExtVTable == NULL )
1818  {
1819  return COMPONENT_ERROR;
1820  }
1821 
1822  if ( status == NULL )
1823  {
1824  return COMPONENT_ERROR;
1825  }
1826 
1827  /* At the moment this feature is only implemented for LSM6DS3 */
1828  if ( ctx->who_am_i == LSM6DSM_ACC_GYRO_WHO_AM_I )
1829  {
1830  LSM6DSM_X_ExtDrv_t *extDriver = ( LSM6DSM_X_ExtDrv_t * )ctx->pExtVTable;
1831 
1832  if ( extDriver->Get_Wake_Up_Detection_Status == NULL )
1833  {
1834  return COMPONENT_ERROR;
1835  }
1836 
1837  else
1838  {
1839  return extDriver->Get_Wake_Up_Detection_Status( ctx, status );
1840  }
1841  }
1842 
1843  else
1844  {
1845  return COMPONENT_ERROR;
1846  }
1847 }
1848 
1849 
1850 
1858 DrvStatusTypeDef BSP_ACCELERO_Set_Wake_Up_Threshold_Ext( void *handle, uint8_t thr )
1859 {
1860 
1861  DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
1862 
1863  if(ctx == NULL)
1864  {
1865  return COMPONENT_ERROR;
1866  }
1867 
1868  if ( ctx->pExtVTable == NULL )
1869  {
1870  return COMPONENT_ERROR;
1871  }
1872 
1873  /* At the moment this feature is only implemented for LSM6DS3 */
1874  if ( ctx->who_am_i == LSM6DSM_ACC_GYRO_WHO_AM_I )
1875  {
1876  LSM6DSM_X_ExtDrv_t *extDriver = ( LSM6DSM_X_ExtDrv_t * )ctx->pExtVTable;
1877 
1878  if ( extDriver->Set_Wake_Up_Threshold == NULL )
1879  {
1880  return COMPONENT_ERROR;
1881  }
1882 
1883  else
1884  {
1885  return extDriver->Set_Wake_Up_Threshold( ctx, thr );
1886  }
1887  }
1888 
1889  else
1890  {
1891  return COMPONENT_ERROR;
1892  }
1893 }
1894 
1895 
1896 
1904 DrvStatusTypeDef BSP_ACCELERO_Enable_Single_Tap_Detection_Ext( void *handle )
1905 {
1906 
1907  DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
1908 
1909  if(ctx == NULL)
1910  {
1911  return COMPONENT_ERROR;
1912  }
1913 
1914  if ( ctx->pExtVTable == NULL )
1915  {
1916  return COMPONENT_ERROR;
1917  }
1918 
1919  /* At the moment this feature is only implemented for LSM6DS3 */
1920  if ( ctx->who_am_i == LSM6DSM_ACC_GYRO_WHO_AM_I )
1921  {
1922  LSM6DSM_X_ExtDrv_t *extDriver = ( LSM6DSM_X_ExtDrv_t * )ctx->pExtVTable;
1923 
1924  if ( extDriver->Enable_Single_Tap_Detection == NULL )
1925  {
1926  return COMPONENT_ERROR;
1927  }
1928 
1929  else
1930  {
1931  return extDriver->Enable_Single_Tap_Detection( ctx );
1932  }
1933  }
1934 
1935  else
1936  {
1937  return COMPONENT_ERROR;
1938  }
1939 }
1940 
1941 
1942 
1949 DrvStatusTypeDef BSP_ACCELERO_Disable_Single_Tap_Detection_Ext( void *handle )
1950 {
1951 
1952  DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
1953 
1954  if(ctx == NULL)
1955  {
1956  return COMPONENT_ERROR;
1957  }
1958 
1959  if ( ctx->pExtVTable == NULL )
1960  {
1961  return COMPONENT_ERROR;
1962  }
1963 
1964  /* At the moment this feature is only implemented for LSM6DS3 */
1965  if ( ctx->who_am_i == LSM6DSM_ACC_GYRO_WHO_AM_I )
1966  {
1967  LSM6DSM_X_ExtDrv_t *extDriver = ( LSM6DSM_X_ExtDrv_t * )ctx->pExtVTable;
1968 
1969  if ( extDriver->Disable_Single_Tap_Detection == NULL )
1970  {
1971  return COMPONENT_ERROR;
1972  }
1973 
1974  else
1975  {
1976  return extDriver->Disable_Single_Tap_Detection( ctx );
1977  }
1978  }
1979 
1980  else
1981  {
1982  return COMPONENT_ERROR;
1983  }
1984 }
1985 
1986 
1987 
1995 DrvStatusTypeDef BSP_ACCELERO_Get_Single_Tap_Detection_Status_Ext( void *handle, uint8_t *status )
1996 {
1997 
1998  DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
1999 
2000  if(ctx == NULL)
2001  {
2002  return COMPONENT_ERROR;
2003  }
2004 
2005  if ( ctx->pExtVTable == NULL )
2006  {
2007  return COMPONENT_ERROR;
2008  }
2009 
2010  if ( status == NULL )
2011  {
2012  return COMPONENT_ERROR;
2013  }
2014 
2015  /* At the moment this feature is only implemented for LSM6DS3 */
2016  if ( ctx->who_am_i == LSM6DSM_ACC_GYRO_WHO_AM_I )
2017  {
2018  LSM6DSM_X_ExtDrv_t *extDriver = ( LSM6DSM_X_ExtDrv_t * )ctx->pExtVTable;
2019 
2020  if ( extDriver->Get_Single_Tap_Detection_Status == NULL )
2021  {
2022  return COMPONENT_ERROR;
2023  }
2024 
2025  else
2026  {
2027  return extDriver->Get_Single_Tap_Detection_Status( ctx, status );
2028  }
2029  }
2030 
2031  else
2032  {
2033  return COMPONENT_ERROR;
2034  }
2035 }
2036 
2037 
2038 
2046 DrvStatusTypeDef BSP_ACCELERO_Enable_Double_Tap_Detection_Ext( void *handle )
2047 {
2048 
2049  DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
2050 
2051  if(ctx == NULL)
2052  {
2053  return COMPONENT_ERROR;
2054  }
2055 
2056  if ( ctx->pExtVTable == NULL )
2057  {
2058  return COMPONENT_ERROR;
2059  }
2060 
2061  /* At the moment this feature is only implemented for LSM6DS3 */
2062  if ( ctx->who_am_i == LSM6DSM_ACC_GYRO_WHO_AM_I )
2063  {
2064  LSM6DSM_X_ExtDrv_t *extDriver = ( LSM6DSM_X_ExtDrv_t * )ctx->pExtVTable;
2065 
2066  if ( extDriver->Enable_Double_Tap_Detection == NULL )
2067  {
2068  return COMPONENT_ERROR;
2069  }
2070 
2071  else
2072  {
2073  return extDriver->Enable_Double_Tap_Detection( ctx );
2074  }
2075  }
2076 
2077  else
2078  {
2079  return COMPONENT_ERROR;
2080  }
2081 }
2082 
2083 
2084 
2091 DrvStatusTypeDef BSP_ACCELERO_Disable_Double_Tap_Detection_Ext( void *handle )
2092 {
2093 
2094  DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
2095 
2096  if(ctx == NULL)
2097  {
2098  return COMPONENT_ERROR;
2099  }
2100 
2101  if ( ctx->pExtVTable == NULL )
2102  {
2103  return COMPONENT_ERROR;
2104  }
2105 
2106  /* At the moment this feature is only implemented for LSM6DS3 */
2107  if ( ctx->who_am_i == LSM6DSM_ACC_GYRO_WHO_AM_I )
2108  {
2109  LSM6DSM_X_ExtDrv_t *extDriver = ( LSM6DSM_X_ExtDrv_t * )ctx->pExtVTable;
2110 
2111  if ( extDriver->Disable_Double_Tap_Detection == NULL )
2112  {
2113  return COMPONENT_ERROR;
2114  }
2115 
2116  else
2117  {
2118  return extDriver->Disable_Double_Tap_Detection( ctx );
2119  }
2120  }
2121 
2122  else
2123  {
2124  return COMPONENT_ERROR;
2125  }
2126 }
2127 
2128 
2129 
2137 DrvStatusTypeDef BSP_ACCELERO_Get_Double_Tap_Detection_Status_Ext( void *handle, uint8_t *status )
2138 {
2139 
2140  DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
2141 
2142  if(ctx == NULL)
2143  {
2144  return COMPONENT_ERROR;
2145  }
2146 
2147  if ( ctx->pExtVTable == NULL )
2148  {
2149  return COMPONENT_ERROR;
2150  }
2151 
2152  if ( status == NULL )
2153  {
2154  return COMPONENT_ERROR;
2155  }
2156 
2157  if ( ctx->who_am_i == LSM6DSM_ACC_GYRO_WHO_AM_I )
2158  {
2159  LSM6DSM_X_ExtDrv_t *extDriver = ( LSM6DSM_X_ExtDrv_t * )ctx->pExtVTable;
2160 
2161  if ( extDriver->Get_Double_Tap_Detection_Status == NULL )
2162  {
2163  return COMPONENT_ERROR;
2164  }
2165 
2166  else
2167  {
2168  return extDriver->Get_Double_Tap_Detection_Status( ctx, status );
2169  }
2170  }
2171 
2172  else
2173  {
2174  return COMPONENT_ERROR;
2175  }
2176 }
2177 
2178 
2179 
2187 DrvStatusTypeDef BSP_ACCELERO_Set_Tap_Threshold_Ext( void *handle, uint8_t thr )
2188 {
2189 
2190  DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
2191 
2192  if(ctx == NULL)
2193  {
2194  return COMPONENT_ERROR;
2195  }
2196 
2197  if ( ctx->pExtVTable == NULL )
2198  {
2199  return COMPONENT_ERROR;
2200  }
2201 
2202  /* At the moment this feature is only implemented for LSM6DS3 */
2203  if ( ctx->who_am_i == LSM6DSM_ACC_GYRO_WHO_AM_I )
2204  {
2205  LSM6DSM_X_ExtDrv_t *extDriver = ( LSM6DSM_X_ExtDrv_t * )ctx->pExtVTable;
2206 
2207  if ( extDriver->Set_Tap_Threshold == NULL )
2208  {
2209  return COMPONENT_ERROR;
2210  }
2211 
2212  else
2213  {
2214  return extDriver->Set_Tap_Threshold( ctx, thr );
2215  }
2216  }
2217 
2218  else
2219  {
2220  return COMPONENT_ERROR;
2221  }
2222 }
2223 
2224 
2225 
2233 DrvStatusTypeDef BSP_ACCELERO_Set_Tap_Shock_Time_Ext( void *handle, uint8_t time )
2234 {
2235 
2236  DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
2237 
2238  if(ctx == NULL)
2239  {
2240  return COMPONENT_ERROR;
2241  }
2242 
2243  if ( ctx->pExtVTable == NULL )
2244  {
2245  return COMPONENT_ERROR;
2246  }
2247 
2248  /* At the moment this feature is only implemented for LSM6DS3 */
2249  if ( ctx->who_am_i == LSM6DSM_ACC_GYRO_WHO_AM_I )
2250  {
2251  LSM6DSM_X_ExtDrv_t *extDriver = ( LSM6DSM_X_ExtDrv_t * )ctx->pExtVTable;
2252 
2253  if ( extDriver->Set_Tap_Shock_Time == NULL )
2254  {
2255  return COMPONENT_ERROR;
2256  }
2257 
2258  else
2259  {
2260  return extDriver->Set_Tap_Shock_Time( ctx, time );
2261  }
2262  }
2263 
2264  else
2265  {
2266  return COMPONENT_ERROR;
2267  }
2268 }
2269 
2270 
2271 
2279 DrvStatusTypeDef BSP_ACCELERO_Set_Tap_Quiet_Time_Ext( void *handle, uint8_t time )
2280 {
2281 
2282  DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
2283 
2284  if(ctx == NULL)
2285  {
2286  return COMPONENT_ERROR;
2287  }
2288 
2289  if ( ctx->pExtVTable == NULL )
2290  {
2291  return COMPONENT_ERROR;
2292  }
2293 
2294  /* At the moment this feature is only implemented for LSM6DS3 */
2295  if ( ctx->who_am_i == LSM6DSM_ACC_GYRO_WHO_AM_I )
2296  {
2297  LSM6DSM_X_ExtDrv_t *extDriver = ( LSM6DSM_X_ExtDrv_t * )ctx->pExtVTable;
2298 
2299  if ( extDriver->Set_Tap_Quiet_Time == NULL )
2300  {
2301  return COMPONENT_ERROR;
2302  }
2303 
2304  else
2305  {
2306  return extDriver->Set_Tap_Quiet_Time( ctx, time );
2307  }
2308  }
2309 
2310  else
2311  {
2312  return COMPONENT_ERROR;
2313  }
2314 }
2315 
2316 
2317 
2325 DrvStatusTypeDef BSP_ACCELERO_Set_Tap_Duration_Time_Ext( void *handle, uint8_t time )
2326 {
2327 
2328  DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
2329 
2330  if(ctx == NULL)
2331  {
2332  return COMPONENT_ERROR;
2333  }
2334 
2335  if ( ctx->pExtVTable == NULL )
2336  {
2337  return COMPONENT_ERROR;
2338  }
2339 
2340  /* At the moment this feature is only implemented for LSM6DS3 */
2341  if ( ctx->who_am_i == LSM6DSM_ACC_GYRO_WHO_AM_I )
2342  {
2343  LSM6DSM_X_ExtDrv_t *extDriver = ( LSM6DSM_X_ExtDrv_t * )ctx->pExtVTable;
2344 
2345  if ( extDriver->Set_Tap_Duration_Time == NULL )
2346  {
2347  return COMPONENT_ERROR;
2348  }
2349 
2350  else
2351  {
2352  return extDriver->Set_Tap_Duration_Time( ctx, time );
2353  }
2354  }
2355 
2356  else
2357  {
2358  return COMPONENT_ERROR;
2359  }
2360 }
2361 
2362 
2363 
2371 DrvStatusTypeDef BSP_ACCELERO_Enable_6D_Orientation_Ext( void *handle )
2372 {
2373 
2374  DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
2375 
2376  if(ctx == NULL)
2377  {
2378  return COMPONENT_ERROR;
2379  }
2380 
2381  if ( ctx->pExtVTable == NULL )
2382  {
2383  return COMPONENT_ERROR;
2384  }
2385 
2386  /* At the moment this feature is only implemented for LSM6DS3 */
2387  if ( ctx->who_am_i == LSM6DSM_ACC_GYRO_WHO_AM_I )
2388  {
2389  LSM6DSM_X_ExtDrv_t *extDriver = ( LSM6DSM_X_ExtDrv_t * )ctx->pExtVTable;
2390 
2391  if ( extDriver->Enable_6D_Orientation == NULL )
2392  {
2393  return COMPONENT_ERROR;
2394  }
2395 
2396  else
2397  {
2398  return extDriver->Enable_6D_Orientation( ctx );
2399  }
2400  }
2401 
2402  else
2403  {
2404  return COMPONENT_ERROR;
2405  }
2406 }
2407 
2408 
2409 
2416 DrvStatusTypeDef BSP_ACCELERO_Disable_6D_Orientation_Ext( void *handle )
2417 {
2418 
2419  DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
2420 
2421  if(ctx == NULL)
2422  {
2423  return COMPONENT_ERROR;
2424  }
2425 
2426  if ( ctx->pExtVTable == NULL )
2427  {
2428  return COMPONENT_ERROR;
2429  }
2430 
2431  /* At the moment this feature is only implemented for LSM6DS3 */
2432  if ( ctx->who_am_i == LSM6DSM_ACC_GYRO_WHO_AM_I )
2433  {
2434  LSM6DSM_X_ExtDrv_t *extDriver = ( LSM6DSM_X_ExtDrv_t * )ctx->pExtVTable;
2435 
2436  if ( extDriver->Disable_6D_Orientation == NULL )
2437  {
2438  return COMPONENT_ERROR;
2439  }
2440 
2441  else
2442  {
2443  return extDriver->Disable_6D_Orientation( ctx );
2444  }
2445  }
2446 
2447  else
2448  {
2449  return COMPONENT_ERROR;
2450  }
2451 }
2452 
2453 
2454 
2462 DrvStatusTypeDef BSP_ACCELERO_Get_6D_Orientation_Status_Ext( void *handle, uint8_t *status )
2463 {
2464 
2465  DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
2466 
2467  if(ctx == NULL)
2468  {
2469  return COMPONENT_ERROR;
2470  }
2471 
2472  if ( ctx->pExtVTable == NULL )
2473  {
2474  return COMPONENT_ERROR;
2475  }
2476 
2477  if ( status == NULL )
2478  {
2479  return COMPONENT_ERROR;
2480  }
2481 
2482  /* At the moment this feature is only implemented for LSM6DS3 */
2483  if ( ctx->who_am_i == LSM6DSM_ACC_GYRO_WHO_AM_I )
2484  {
2485  LSM6DSM_X_ExtDrv_t *extDriver = ( LSM6DSM_X_ExtDrv_t * )ctx->pExtVTable;
2486 
2487  if ( extDriver->Get_6D_Orientation_Status == NULL )
2488  {
2489  return COMPONENT_ERROR;
2490  }
2491 
2492  else
2493  {
2494  return extDriver->Get_6D_Orientation_Status( ctx, status );
2495  }
2496  }
2497 
2498  else
2499  {
2500  return COMPONENT_ERROR;
2501  }
2502 }
2503 
2504 
2505 
2513 DrvStatusTypeDef BSP_ACCELERO_Get_6D_Orientation_XL_Ext( void *handle, uint8_t *xl )
2514 {
2515 
2516  DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
2517 
2518  if(ctx == NULL)
2519  {
2520  return COMPONENT_ERROR;
2521  }
2522 
2523  if ( ctx->pExtVTable == NULL )
2524  {
2525  return COMPONENT_ERROR;
2526  }
2527 
2528  if ( xl == NULL )
2529  {
2530  return COMPONENT_ERROR;
2531  }
2532 
2533  /* At the moment this feature is only implemented for LSM6DS3 */
2534  if ( ctx->who_am_i == LSM6DSM_ACC_GYRO_WHO_AM_I )
2535  {
2536  LSM6DSM_X_ExtDrv_t *extDriver = ( LSM6DSM_X_ExtDrv_t * )ctx->pExtVTable;
2537 
2538  if ( extDriver->Get_6D_Orientation_XL == NULL )
2539  {
2540  return COMPONENT_ERROR;
2541  }
2542 
2543  else
2544  {
2545  return extDriver->Get_6D_Orientation_XL( ctx, xl );
2546  }
2547  }
2548 
2549  else
2550  {
2551  return COMPONENT_ERROR;
2552  }
2553 }
2554 
2555 
2556 
2564 DrvStatusTypeDef BSP_ACCELERO_Get_6D_Orientation_XH_Ext( void *handle, uint8_t *xh )
2565 {
2566 
2567  DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
2568 
2569  if(ctx == NULL)
2570  {
2571  return COMPONENT_ERROR;
2572  }
2573 
2574  if ( ctx->pExtVTable == NULL )
2575  {
2576  return COMPONENT_ERROR;
2577  }
2578 
2579  if ( xh == NULL )
2580  {
2581  return COMPONENT_ERROR;
2582  }
2583 
2584  /* At the moment this feature is only implemented for LSM6DS3 */
2585  if ( ctx->who_am_i == LSM6DSM_ACC_GYRO_WHO_AM_I )
2586  {
2587  LSM6DSM_X_ExtDrv_t *extDriver = ( LSM6DSM_X_ExtDrv_t * )ctx->pExtVTable;
2588 
2589  if ( extDriver->Get_6D_Orientation_XH == NULL )
2590  {
2591  return COMPONENT_ERROR;
2592  }
2593 
2594  else
2595  {
2596  return extDriver->Get_6D_Orientation_XH( ctx, xh );
2597  }
2598  }
2599 
2600  else
2601  {
2602  return COMPONENT_ERROR;
2603  }
2604 }
2605 
2606 
2607 
2615 DrvStatusTypeDef BSP_ACCELERO_Get_6D_Orientation_YL_Ext( void *handle, uint8_t *yl )
2616 {
2617 
2618  DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
2619 
2620  if(ctx == NULL)
2621  {
2622  return COMPONENT_ERROR;
2623  }
2624 
2625  if ( ctx->pExtVTable == NULL )
2626  {
2627  return COMPONENT_ERROR;
2628  }
2629 
2630  if ( yl == NULL )
2631  {
2632  return COMPONENT_ERROR;
2633  }
2634 
2635  /* At the moment this feature is only implemented for LSM6DS3 */
2636  if ( ctx->who_am_i == LSM6DSM_ACC_GYRO_WHO_AM_I )
2637  {
2638  LSM6DSM_X_ExtDrv_t *extDriver = ( LSM6DSM_X_ExtDrv_t * )ctx->pExtVTable;
2639 
2640  if ( extDriver->Get_6D_Orientation_YL == NULL )
2641  {
2642  return COMPONENT_ERROR;
2643  }
2644 
2645  else
2646  {
2647  return extDriver->Get_6D_Orientation_YL( ctx, yl );
2648  }
2649  }
2650 
2651  else
2652  {
2653  return COMPONENT_ERROR;
2654  }
2655 }
2656 
2657 
2658 
2666 DrvStatusTypeDef BSP_ACCELERO_Get_6D_Orientation_YH_Ext( void *handle, uint8_t *yh )
2667 {
2668 
2669  DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
2670 
2671  if(ctx == NULL)
2672  {
2673  return COMPONENT_ERROR;
2674  }
2675 
2676  if ( ctx->pExtVTable == NULL )
2677  {
2678  return COMPONENT_ERROR;
2679  }
2680 
2681  if ( yh == NULL )
2682  {
2683  return COMPONENT_ERROR;
2684  }
2685 
2686  /* At the moment this feature is only implemented for LSM6DS3 */
2687  if ( ctx->who_am_i == LSM6DSM_ACC_GYRO_WHO_AM_I )
2688  {
2689  LSM6DSM_X_ExtDrv_t *extDriver = ( LSM6DSM_X_ExtDrv_t * )ctx->pExtVTable;
2690 
2691  if ( extDriver->Get_6D_Orientation_YH == NULL )
2692  {
2693  return COMPONENT_ERROR;
2694  }
2695 
2696  else
2697  {
2698  return extDriver->Get_6D_Orientation_YH( ctx, yh );
2699  }
2700  }
2701 
2702  else
2703  {
2704  return COMPONENT_ERROR;
2705  }
2706 }
2707 
2708 
2709 
2717 DrvStatusTypeDef BSP_ACCELERO_Get_6D_Orientation_ZL_Ext( void *handle, uint8_t *zl )
2718 {
2719 
2720  DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
2721 
2722  if(ctx == NULL)
2723  {
2724  return COMPONENT_ERROR;
2725  }
2726 
2727  if ( ctx->pExtVTable == NULL )
2728  {
2729  return COMPONENT_ERROR;
2730  }
2731 
2732  if ( zl == NULL )
2733  {
2734  return COMPONENT_ERROR;
2735  }
2736 
2737  /* At the moment this feature is only implemented for LSM6DS3 */
2738  if ( ctx->who_am_i == LSM6DSM_ACC_GYRO_WHO_AM_I )
2739  {
2740  LSM6DSM_X_ExtDrv_t *extDriver = ( LSM6DSM_X_ExtDrv_t * )ctx->pExtVTable;
2741 
2742  if ( extDriver->Get_6D_Orientation_ZL == NULL )
2743  {
2744  return COMPONENT_ERROR;
2745  }
2746 
2747  else
2748  {
2749  return extDriver->Get_6D_Orientation_ZL( ctx, zl );
2750  }
2751  }
2752 
2753  else
2754  {
2755  return COMPONENT_ERROR;
2756  }
2757 }
2758 
2759 
2760 
2768 DrvStatusTypeDef BSP_ACCELERO_Get_6D_Orientation_ZH_Ext( void *handle, uint8_t *zh )
2769 {
2770 
2771  DrvContextTypeDef *ctx = (DrvContextTypeDef *)handle;
2772 
2773  if(ctx == NULL)
2774  {
2775  return COMPONENT_ERROR;
2776  }
2777 
2778  if ( ctx->pExtVTable == NULL )
2779  {
2780  return COMPONENT_ERROR;
2781  }
2782 
2783  if ( zh == NULL )
2784  {
2785  return COMPONENT_ERROR;
2786  }
2787 
2788  /* At the moment this feature is only implemented for LSM6DS3 */
2789  if ( ctx->who_am_i == LSM6DSM_ACC_GYRO_WHO_AM_I )
2790  {
2791  LSM6DSM_X_ExtDrv_t *extDriver = ( LSM6DSM_X_ExtDrv_t * )ctx->pExtVTable;
2792 
2793  if ( extDriver->Get_6D_Orientation_ZH == NULL )
2794  {
2795  return COMPONENT_ERROR;
2796  }
2797 
2798  else
2799  {
2800  return extDriver->Get_6D_Orientation_ZH( ctx, zh );
2801  }
2802  }
2803 
2804  else
2805  {
2806  return COMPONENT_ERROR;
2807  }
2808 }
2809 
2826 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
DrvStatusTypeDef BSP_ACCELERO_Get_Axes_Status(void *handle, uint8_t *xyz_enabled)
Get the accelerometer sensor axes status.
DrvStatusTypeDef BSP_ACCELERO_Enable_Pedometer_Ext(void *handle)
Enable the pedometer feature (available only for LSM6DS3 sensor)
DrvStatusTypeDef BSP_ACCELERO_IsInitialized(void *handle, uint8_t *status)
Check if the accelerometer sensor is initialized.
DrvStatusTypeDef BSP_ACCELERO_Get_Pedometer_Status_Ext(void *handle, uint8_t *status)
Get the pedometer status (available only for LSM6DS3 sensor)
DrvStatusTypeDef BSP_ACCELERO_Set_FS(void *handle, SensorFs_t fullScale)
Set the accelerometer sensor full scale.
DrvStatusTypeDef BSP_ACCELERO_IsEnabled(void *handle, uint8_t *status)
Check if the accelerometer sensor is enabled.
DrvStatusTypeDef BSP_ACCELERO_Enable_Tilt_Detection_Ext(void *handle)
Enable the tilt detection (available only for LSM6DS3 sensor)
DrvStatusTypeDef BSP_ACCELERO_Get_FS(void *handle, float *fullScale)
Get the accelerometer sensor full scale.
DrvStatusTypeDef BSP_ACCELERO_IsCombo(void *handle, uint8_t *status)
Check if the accelerometer sensor is combo.
DrvStatusTypeDef BSP_ACCELERO_Get_Single_Tap_Detection_Status_Ext(void *handle, uint8_t *status)
Get the single tap detection status (available only for LSM6DS3 sensor)
DrvStatusTypeDef BSP_ACCELERO_Set_Tap_Shock_Time_Ext(void *handle, uint8_t time)
Set the tap shock time window (available only for LSM6DS3 sensor)
DrvStatusTypeDef BSP_ACCELERO_Get_Tilt_Detection_Status_Ext(void *handle, uint8_t *status)
Get the tilt detection status (available only for LSM6DS3 sensor)
DrvStatusTypeDef BSP_ACCELERO_Set_Tap_Threshold_Ext(void *handle, uint8_t thr)
Set the tap threshold (available only for LSM6DS3 sensor)
DrvStatusTypeDef BSP_ACCELERO_Check_WhoAmI(void *handle)
Check the WHO_AM_I ID of the accelerometer sensor.
DrvStatusTypeDef BSP_ACCELERO_Get_6D_Orientation_Status_Ext(void *handle, uint8_t *status)
Get the status of the 6D orientation detection (available only for LSM6DS3 sensor) ...
DrvStatusTypeDef BSP_ACCELERO_Get_Double_Tap_Detection_Status_Ext(void *handle, uint8_t *status)
Get the double tap detection status (available only for LSM6DS3 sensor)
DrvStatusTypeDef BSP_ACCELERO_Get_6D_Orientation_YL_Ext(void *handle, uint8_t *yl)
Get the 6D orientation YL axis (available only for LSM6DS3 sensor)
This file contains definitions for the SensorTile_accelero.c.
uint8_t Sensor_IO_Write(void *handle, uint8_t WriteAddr, uint8_t *pBuffer, uint16_t nBytesToWrite)
Writes a buffer to the sensor.
Definition: SensorTile.c:427
DrvStatusTypeDef BSP_ACCELERO_Enable_Double_Tap_Detection_Ext(void *handle)
Enable the double tap detection (available only for LSM6DS3 sensor)
DrvStatusTypeDef BSP_ACCELERO_Get_6D_Orientation_YH_Ext(void *handle, uint8_t *yh)
Get the 6D orientation YH axis (available only for LSM6DS3 sensor)
DrvStatusTypeDef BSP_ACCELERO_DeInit(void **handle)
Deinitialize accelerometer sensor.
DrvStatusTypeDef BSP_ACCELERO_Disable_Free_Fall_Detection_Ext(void *handle)
Disable the free fall detection (available only for LSM6DS3 sensor)
DrvStatusTypeDef Sensor_IO_SPI_Init(void)
Configures sensor SPI interface.
Definition: SensorTile.c:293
DrvStatusTypeDef BSP_ACCELERO_Get_Wake_Up_Detection_Status_Ext(void *handle, uint8_t *status)
Get the status of the wake up detection (available only for LSM6DS3 sensor)
DrvStatusTypeDef BSP_ACCELERO_Disable_6D_Orientation_Ext(void *handle)
Disable the 6D orientation detection (available only for LSM6DS3 sensor)
DrvStatusTypeDef BSP_ACCELERO_Sensor_Disable(void *handle)
Disable accelerometer sensor.
DrvStatusTypeDef BSP_ACCELERO_Set_Pedometer_Threshold_Ext(void *handle, uint8_t thr)
Set the pedometer threshold (available only for LSM6DS3 sensor)
DrvStatusTypeDef BSP_ACCELERO_Write_Reg(void *handle, uint8_t reg, uint8_t data)
Write the data to register.
DrvStatusTypeDef BSP_ACCELERO_Set_Free_Fall_Threshold_Ext(void *handle, LSM6DSM_ACC_GYRO_FF_THS_t thr)
Set the free fall detection threshold (available only for LSM6DS3 sensor)
DrvStatusTypeDef BSP_ACCELERO_Read_Reg(void *handle, uint8_t reg, uint8_t *data)
Read the data from register.
DrvStatusTypeDef BSP_ACCELERO_Enable_6D_Orientation_Ext(void *handle)
Enable the 6D orientation detection (available only for LSM6DS3 sensor)
DrvStatusTypeDef BSP_ACCELERO_Get_ODR(void *handle, float *odr)
Get the accelerometer sensor output data rate.
DrvStatusTypeDef BSP_ACCELERO_Enable_Single_Tap_Detection_Ext(void *handle)
Enable the single tap detection (available only for LSM6DS3 sensor)
DrvStatusTypeDef BSP_ACCELERO_Set_ODR_Value(void *handle, float odr)
Set the accelerometer sensor output data rate.
DrvStatusTypeDef BSP_ACCELERO_Disable_Single_Tap_Detection_Ext(void *handle)
Disable the single tap detection (available only for LSM6DS3 sensor)
DrvStatusTypeDef BSP_ACCELERO_Get_6D_Orientation_ZL_Ext(void *handle, uint8_t *zl)
Get the 6D orientation ZL axis (available only for LSM6DS3 sensor)
DrvStatusTypeDef BSP_ACCELERO_Get_DRDY_Status(void *handle, uint8_t *status)
Get accelerometer data ready status.
DrvStatusTypeDef BSP_ACCELERO_Reset_Step_Counter_Ext(void *handle)
Reset of the step counter (available only for LSM6DS3 sensor)
DrvStatusTypeDef BSP_ACCELERO_Set_Tap_Duration_Time_Ext(void *handle, uint8_t time)
Set the tap duration of the time window (available only for LSM6DS3 sensor)
DrvStatusTypeDef BSP_ACCELERO_Get_6D_Orientation_XL_Ext(void *handle, uint8_t *xl)
Get the 6D orientation XL axis (available only for LSM6DS3 sensor)
DrvStatusTypeDef BSP_ACCELERO_Get_Sensitivity(void *handle, float *sensitivity)
Get the accelerometer sensor sensitivity.
DrvStatusTypeDef BSP_ACCELERO_Disable_Double_Tap_Detection_Ext(void *handle)
Disable the double tap detection (available only for LSM6DS3 sensor)
DrvStatusTypeDef BSP_ACCELERO_Get_6D_Orientation_ZH_Ext(void *handle, uint8_t *zh)
Get the 6D orientation ZH axis (available only for LSM6DS3 sensor)
DrvStatusTypeDef BSP_ACCELERO_Enable_Free_Fall_Detection_Ext(void *handle)
Enable the free fall detection (available only for LSM6DS3 sensor)
DrvStatusTypeDef BSP_ACCELERO_Disable_Wake_Up_Detection_Ext(void *handle)
Disable the wake up detection (available only for LSM6DS3 sensor)
DrvStatusTypeDef BSP_ACCELERO_Get_Axes(void *handle, SensorAxes_t *acceleration)
Get the accelerometer sensor axes.
DrvStatusTypeDef BSP_ACCELERO_Disable_Pedometer_Ext(void *handle)
Disable the pedometer feature (available only for LSM6DS3 sensor)
DrvStatusTypeDef BSP_ACCELERO_Set_Tap_Quiet_Time_Ext(void *handle, uint8_t time)
Set the tap quiet time window (available only for LSM6DS3 sensor)
DrvStatusTypeDef BSP_ACCELERO_Set_FS_Value(void *handle, float fullScale)
Set the accelerometer sensor full scale.
DrvStatusTypeDef LSM6DSM_Sensor_IO_ITConfig(void)
Configures sensor interrupts interface for LSM6DSM sensor.
Definition: SensorTile.c:664
DrvStatusTypeDef BSP_ACCELERO_Sensor_Enable(void *handle)
Enable accelerometer sensor.
DrvStatusTypeDef BSP_ACCELERO_Get_Free_Fall_Detection_Status_Ext(void *handle, uint8_t *status)
Get the status of the free fall detection (available only for LSM6DS3 sensor)
DrvStatusTypeDef BSP_ACCELERO_Init(ACCELERO_ID_t id, void **handle)
Initialize an accelerometer sensor.
DrvStatusTypeDef BSP_ACCELERO_Get_AxesRaw(void *handle, SensorAxesRaw_t *value)
Get the accelerometer sensor raw axes.
DrvStatusTypeDef BSP_ACCELERO_Set_Wake_Up_Threshold_Ext(void *handle, uint8_t thr)
Set the wake up threshold (available only for LSM6DS3 sensor)
DrvStatusTypeDef BSP_ACCELERO_Enable_Wake_Up_Detection_Ext(void *handle)
Enable the wake up detection (available only for LSM6DS3 sensor)
DrvStatusTypeDef BSP_ACCELERO_Set_Axes_Status(void *handle, uint8_t *enable_xyz)
Set the enabled/disabled status of the accelerometer sensor axes.
DrvStatusTypeDef BSP_ACCELERO_Get_Step_Count_Ext(void *handle, uint16_t *step_count)
Get the step counter (available only for LSM6DS3 sensor)
DrvStatusTypeDef BSP_ACCELERO_Get_6D_Orientation_XH_Ext(void *handle, uint8_t *xh)
Get the 6D orientation XH axis (available only for LSM6DS3 sensor)
DrvStatusTypeDef BSP_ACCELERO_Get_Instance(void *handle, uint8_t *instance)
Get the accelerometer sensor instance.
DrvStatusTypeDef BSP_ACCELERO_Set_ODR(void *handle, SensorOdr_t odr)
Set the accelerometer sensor output data rate.
DrvStatusTypeDef BSP_ACCELERO_Get_WhoAmI(void *handle, uint8_t *who_am_i)
Get the WHO_AM_I ID of the accelerometer sensor.
DrvStatusTypeDef BSP_ACCELERO_Disable_Tilt_Detection_Ext(void *handle)
Disable the tilt detection (available only for LSM6DS3 sensor)
Generated by   doxygen 1.8.13