stm32h7xx_hal_dfsdm.c
Go to the documentation of this file.
1 
267 /* Includes ------------------------------------------------------------------*/
268 #include "stm32h7xx_hal.h"
269 
273 #ifdef HAL_DFSDM_MODULE_ENABLED
274 
280 /* Private typedef -----------------------------------------------------------*/
281 /* Private define ------------------------------------------------------------*/
285 #define DFSDM_FLTCR1_MSB_RCH_OFFSET 8
286 #define DFSDM_MSB_MASK 0xFFFF0000U
287 #define DFSDM_LSB_MASK 0x0000FFFFU
288 #define DFSDM_CKAB_TIMEOUT 5000U
289 #define DFSDM1_CHANNEL_NUMBER 8U
290 #if defined(DFSDM2_Channel0)
291 #define DFSDM2_CHANNEL_NUMBER 2U
292 #endif /* DFSDM2_Channel0 */
293 
297 /* Private macro -------------------------------------------------------------*/
298 /* Private variables ---------------------------------------------------------*/
302 static __IO uint32_t v_dfsdm1ChannelCounter = 0;
303 static DFSDM_Channel_HandleTypeDef *a_dfsdm1ChannelHandle[DFSDM1_CHANNEL_NUMBER] = {NULL};
304 #if defined(DFSDM2_Channel0)
305 static __IO uint32_t v_dfsdm2ChannelCounter = 0;
306 static DFSDM_Channel_HandleTypeDef *a_dfsdm2ChannelHandle[DFSDM2_CHANNEL_NUMBER] = {NULL};
307 #endif /* DFSDM2_Channel0 */
308 
312 /* Private function prototypes -----------------------------------------------*/
316 static uint32_t DFSDM_GetInjChannelsNbr(uint32_t Channels);
317 static uint32_t DFSDM_GetChannelFromInstance(const DFSDM_Channel_TypeDef *Instance);
318 static void DFSDM_RegConvStart(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
319 static void DFSDM_RegConvStop(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
320 static void DFSDM_InjConvStart(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
321 static void DFSDM_InjConvStop(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
322 static void DFSDM_DMARegularHalfConvCplt(DMA_HandleTypeDef *hdma);
323 static void DFSDM_DMARegularConvCplt(DMA_HandleTypeDef *hdma);
324 static void DFSDM_DMAInjectedHalfConvCplt(DMA_HandleTypeDef *hdma);
325 static void DFSDM_DMAInjectedConvCplt(DMA_HandleTypeDef *hdma);
326 static void DFSDM_DMAError(DMA_HandleTypeDef *hdma);
331 /* Exported functions --------------------------------------------------------*/
357 {
358  __IO uint32_t *channelCounterPtr;
359  DFSDM_Channel_HandleTypeDef **channelHandleTable;
360  DFSDM_Channel_TypeDef *channel0Instance;
361 
362  /* Check DFSDM Channel handle */
363  if(hdfsdm_channel == NULL)
364  {
365  return HAL_ERROR;
366  }
367 
368  /* Check parameters */
380 
381 #if defined(DFSDM2_Channel0)
382  if (IS_DFSDM1_CHANNEL_INSTANCE(hdfsdm_channel->Instance))
383  {
384  channelCounterPtr = &v_dfsdm1ChannelCounter;
385  channelHandleTable = a_dfsdm1ChannelHandle;
386  channel0Instance = DFSDM1_Channel0;
387  }
388  else
389  {
390  channelCounterPtr = &v_dfsdm2ChannelCounter;
391  channelHandleTable = a_dfsdm2ChannelHandle;
392  channel0Instance = DFSDM2_Channel0;
393  }
394 #else /* DFSDM2_Channel0 */
395  channelCounterPtr = &v_dfsdm1ChannelCounter;
396  channelHandleTable = a_dfsdm1ChannelHandle;
397  channel0Instance = DFSDM1_Channel0;
398 #endif /* DFSDM2_Channel0 */
399 
400  /* Check that channel has not been already initialized */
401  if (channelHandleTable[DFSDM_GetChannelFromInstance(hdfsdm_channel->Instance)] != NULL)
402  {
403  return HAL_ERROR;
404  }
405 
406 #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
407  /* Reset callback pointers to the weak predefined callbacks */
408  hdfsdm_channel->CkabCallback = HAL_DFSDM_ChannelCkabCallback;
409  hdfsdm_channel->ScdCallback = HAL_DFSDM_ChannelScdCallback;
410 
411  /* Call MSP init function */
412  if(hdfsdm_channel->MspInitCallback == NULL)
413  {
414  hdfsdm_channel->MspInitCallback = HAL_DFSDM_ChannelMspInit;
415  }
416  hdfsdm_channel->MspInitCallback(hdfsdm_channel);
417 #else
418  /* Call MSP init function */
419  HAL_DFSDM_ChannelMspInit(hdfsdm_channel);
420 #endif
421 
422  /* Update the channel counter */
423  (*channelCounterPtr)++;
424 
425  /* Configure output serial clock and enable global DFSDM interface only for first channel */
426  if(*channelCounterPtr == 1U)
427  {
429  /* Set the output serial clock source */
430  channel0Instance->CHCFGR1 &= ~(DFSDM_CHCFGR1_CKOUTSRC);
431  channel0Instance->CHCFGR1 |= hdfsdm_channel->Init.OutputClock.Selection;
432 
433  /* Reset clock divider */
434  channel0Instance->CHCFGR1 &= ~(DFSDM_CHCFGR1_CKOUTDIV);
435  if(hdfsdm_channel->Init.OutputClock.Activation == ENABLE)
436  {
438  /* Set the output clock divider */
439  channel0Instance->CHCFGR1 |= (uint32_t)((hdfsdm_channel->Init.OutputClock.Divider - 1U) <<
441  }
442 
443  /* enable the DFSDM global interface */
444  channel0Instance->CHCFGR1 |= DFSDM_CHCFGR1_DFSDMEN;
445  }
446 
447  /* Set channel input parameters */
450  hdfsdm_channel->Instance->CHCFGR1 |= (hdfsdm_channel->Init.Input.Multiplexer |
451  hdfsdm_channel->Init.Input.DataPacking |
452  hdfsdm_channel->Init.Input.Pins);
453 
454  /* Set serial interface parameters */
456  hdfsdm_channel->Instance->CHCFGR1 |= (hdfsdm_channel->Init.SerialInterface.Type |
457  hdfsdm_channel->Init.SerialInterface.SpiClock);
458 
459  /* Set analog watchdog parameters */
461  hdfsdm_channel->Instance->CHAWSCDR |= (hdfsdm_channel->Init.Awd.FilterOrder |
462  ((hdfsdm_channel->Init.Awd.Oversampling - 1U) << DFSDM_CHAWSCDR_AWFOSR_Pos));
463 
464  /* Set channel offset and right bit shift */
465  hdfsdm_channel->Instance->CHCFGR2 &= ~(DFSDM_CHCFGR2_OFFSET | DFSDM_CHCFGR2_DTRBS);
466  hdfsdm_channel->Instance->CHCFGR2 |= (((uint32_t) hdfsdm_channel->Init.Offset << DFSDM_CHCFGR2_OFFSET_Pos) |
467  (hdfsdm_channel->Init.RightBitShift << DFSDM_CHCFGR2_DTRBS_Pos));
468 
469  /* Enable DFSDM channel */
470  hdfsdm_channel->Instance->CHCFGR1 |= DFSDM_CHCFGR1_CHEN;
471 
472  /* Set DFSDM Channel to ready state */
473  hdfsdm_channel->State = HAL_DFSDM_CHANNEL_STATE_READY;
474 
475  /* Store channel handle in DFSDM channel handle table */
476  channelHandleTable[DFSDM_GetChannelFromInstance(hdfsdm_channel->Instance)] = hdfsdm_channel;
477 
478  return HAL_OK;
479 }
480 
487 {
488  __IO uint32_t *channelCounterPtr;
489  DFSDM_Channel_HandleTypeDef **channelHandleTable;
490  DFSDM_Channel_TypeDef *channel0Instance;
491 
492  /* Check DFSDM Channel handle */
493  if(hdfsdm_channel == NULL)
494  {
495  return HAL_ERROR;
496  }
497 
498  /* Check parameters */
500 
501 #if defined(DFSDM2_Channel0)
502  if (IS_DFSDM1_CHANNEL_INSTANCE(hdfsdm_channel->Instance))
503  {
504  channelCounterPtr = &v_dfsdm1ChannelCounter;
505  channelHandleTable = a_dfsdm1ChannelHandle;
506  channel0Instance = DFSDM1_Channel0;
507  }
508  else
509  {
510  channelCounterPtr = &v_dfsdm2ChannelCounter;
511  channelHandleTable = a_dfsdm2ChannelHandle;
512  channel0Instance = DFSDM2_Channel0;
513  }
514 #else /* DFSDM2_Channel0 */
515  channelCounterPtr = &v_dfsdm1ChannelCounter;
516  channelHandleTable = a_dfsdm1ChannelHandle;
517  channel0Instance = DFSDM1_Channel0;
518 #endif /* DFSDM2_Channel0 */
519 
520  /* Check that channel has not been already deinitialized */
521  if (channelHandleTable[DFSDM_GetChannelFromInstance(hdfsdm_channel->Instance)] == NULL)
522  {
523  return HAL_ERROR;
524  }
525 
526  /* Disable the DFSDM channel */
527  hdfsdm_channel->Instance->CHCFGR1 &= ~(DFSDM_CHCFGR1_CHEN);
528 
529  /* Update the channel counter */
530  (*channelCounterPtr)--;
531 
532  /* Disable global DFSDM at deinit of last channel */
533  if (*channelCounterPtr == 0U)
534  {
535  channel0Instance->CHCFGR1 &= ~(DFSDM_CHCFGR1_DFSDMEN);
536  }
537 
538  /* Call MSP deinit function */
539 #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
540  if(hdfsdm_channel->MspDeInitCallback == NULL)
541  {
542  hdfsdm_channel->MspDeInitCallback = HAL_DFSDM_ChannelMspDeInit;
543  }
544  hdfsdm_channel->MspDeInitCallback(hdfsdm_channel);
545 #else
546  HAL_DFSDM_ChannelMspDeInit(hdfsdm_channel);
547 #endif
548 
549  /* Set DFSDM Channel in reset state */
550  hdfsdm_channel->State = HAL_DFSDM_CHANNEL_STATE_RESET;
551 
552  /* Reset channel handle in DFSDM channel handle table */
553  channelHandleTable[DFSDM_GetChannelFromInstance(hdfsdm_channel->Instance)] = (DFSDM_Channel_HandleTypeDef *) NULL;
554 
555  return HAL_OK;
556 }
557 
563 __weak void HAL_DFSDM_ChannelMspInit(DFSDM_Channel_HandleTypeDef *hdfsdm_channel)
564 {
565  /* Prevent unused argument(s) compilation warning */
566  UNUSED(hdfsdm_channel);
567 
568  /* NOTE : This function should not be modified, when the function is needed,
569  the HAL_DFSDM_ChannelMspInit could be implemented in the user file.
570  */
571 }
572 
578 __weak void HAL_DFSDM_ChannelMspDeInit(DFSDM_Channel_HandleTypeDef *hdfsdm_channel)
579 {
580  /* Prevent unused argument(s) compilation warning */
581  UNUSED(hdfsdm_channel);
582 
583  /* NOTE : This function should not be modified, when the function is needed,
584  the HAL_DFSDM_ChannelMspDeInit could be implemented in the user file.
585  */
586 }
587 
588 #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
589 
602 HAL_StatusTypeDef HAL_DFSDM_Channel_RegisterCallback(DFSDM_Channel_HandleTypeDef *hdfsdm_channel,
603  HAL_DFSDM_Channel_CallbackIDTypeDef CallbackID,
604  pDFSDM_Channel_CallbackTypeDef pCallback)
605 {
606  HAL_StatusTypeDef status = HAL_OK;
607 
608  if(pCallback == NULL)
609  {
610  /* update return status */
611  status = HAL_ERROR;
612  }
613  else
614  {
615  if(HAL_DFSDM_CHANNEL_STATE_READY == hdfsdm_channel->State)
616  {
617  switch (CallbackID)
618  {
619  case HAL_DFSDM_CHANNEL_CKAB_CB_ID :
620  hdfsdm_channel->CkabCallback = pCallback;
621  break;
622  case HAL_DFSDM_CHANNEL_SCD_CB_ID :
623  hdfsdm_channel->ScdCallback = pCallback;
624  break;
625  case HAL_DFSDM_CHANNEL_MSPINIT_CB_ID :
626  hdfsdm_channel->MspInitCallback = pCallback;
627  break;
628  case HAL_DFSDM_CHANNEL_MSPDEINIT_CB_ID :
629  hdfsdm_channel->MspDeInitCallback = pCallback;
630  break;
631  default :
632  /* update return status */
633  status = HAL_ERROR;
634  break;
635  }
636  }
637  else if(HAL_DFSDM_CHANNEL_STATE_RESET == hdfsdm_channel->State)
638  {
639  switch (CallbackID)
640  {
641  case HAL_DFSDM_CHANNEL_MSPINIT_CB_ID :
642  hdfsdm_channel->MspInitCallback = pCallback;
643  break;
644  case HAL_DFSDM_CHANNEL_MSPDEINIT_CB_ID :
645  hdfsdm_channel->MspDeInitCallback = pCallback;
646  break;
647  default :
648  /* update return status */
649  status = HAL_ERROR;
650  break;
651  }
652  }
653  else
654  {
655  /* update return status */
656  status = HAL_ERROR;
657  }
658  }
659  return status;
660 }
661 
674 HAL_StatusTypeDef HAL_DFSDM_Channel_UnRegisterCallback(DFSDM_Channel_HandleTypeDef *hdfsdm_channel,
675  HAL_DFSDM_Channel_CallbackIDTypeDef CallbackID)
676 {
677  HAL_StatusTypeDef status = HAL_OK;
678 
679  if(HAL_DFSDM_CHANNEL_STATE_READY == hdfsdm_channel->State)
680  {
681  switch (CallbackID)
682  {
683  case HAL_DFSDM_CHANNEL_CKAB_CB_ID :
684  hdfsdm_channel->CkabCallback = HAL_DFSDM_ChannelCkabCallback;
685  break;
686  case HAL_DFSDM_CHANNEL_SCD_CB_ID :
687  hdfsdm_channel->ScdCallback = HAL_DFSDM_ChannelScdCallback;
688  break;
689  case HAL_DFSDM_CHANNEL_MSPINIT_CB_ID :
690  hdfsdm_channel->MspInitCallback = HAL_DFSDM_ChannelMspInit;
691  break;
692  case HAL_DFSDM_CHANNEL_MSPDEINIT_CB_ID :
693  hdfsdm_channel->MspDeInitCallback = HAL_DFSDM_ChannelMspDeInit;
694  break;
695  default :
696  /* update return status */
697  status = HAL_ERROR;
698  break;
699  }
700  }
701  else if(HAL_DFSDM_CHANNEL_STATE_RESET == hdfsdm_channel->State)
702  {
703  switch (CallbackID)
704  {
705  case HAL_DFSDM_CHANNEL_MSPINIT_CB_ID :
706  hdfsdm_channel->MspInitCallback = HAL_DFSDM_ChannelMspInit;
707  break;
708  case HAL_DFSDM_CHANNEL_MSPDEINIT_CB_ID :
709  hdfsdm_channel->MspDeInitCallback = HAL_DFSDM_ChannelMspDeInit;
710  break;
711  default :
712  /* update return status */
713  status = HAL_ERROR;
714  break;
715  }
716  }
717  else
718  {
719  /* update return status */
720  status = HAL_ERROR;
721  }
722  return status;
723 }
724 #endif /* USE_HAL_DFSDM_REGISTER_CALLBACKS */
725 
756 {
757  HAL_StatusTypeDef status = HAL_OK;
758  uint32_t channel;
759  uint32_t tickstart;
760  DFSDM_Filter_TypeDef *filter0Instance;
761 
762  /* Check parameters */
764 
765 #if defined(DFSDM2_Channel0)
766  if (IS_DFSDM1_CHANNEL_INSTANCE(hdfsdm_channel->Instance))
767  {
768  filter0Instance = DFSDM1_Filter0;
769  }
770  else
771  {
772  filter0Instance = DFSDM2_Filter0;
773  }
774 #else /* DFSDM2_Channel0 */
775  filter0Instance = DFSDM1_Filter0;
776 #endif /* DFSDM2_Channel0 */
777 
778  /* Check DFSDM channel state */
779  if(hdfsdm_channel->State != HAL_DFSDM_CHANNEL_STATE_READY)
780  {
781  /* Return error status */
782  status = HAL_ERROR;
783  }
784  else
785  {
786  /* Get channel number from channel instance */
787  channel = DFSDM_GetChannelFromInstance(hdfsdm_channel->Instance);
788 
789  /* Get timeout */
790  tickstart = HAL_GetTick();
791 
792  /* Clear clock absence flag */
793  while ((((filter0Instance->FLTISR & DFSDM_FLTISR_CKABF) >> (DFSDM_FLTISR_CKABF_Pos + channel)) & 1U) != 0U)
794  {
795  filter0Instance->FLTICR = (1UL << (DFSDM_FLTICR_CLRCKABF_Pos + channel));
796 
797  /* Check the Timeout */
798  if((HAL_GetTick()-tickstart) > DFSDM_CKAB_TIMEOUT)
799  {
800  /* Set timeout status */
801  status = HAL_TIMEOUT;
802  break;
803  }
804  }
805 
806  if(status == HAL_OK)
807  {
808  /* Start clock absence detection */
809  hdfsdm_channel->Instance->CHCFGR1 |= DFSDM_CHCFGR1_CKABEN;
810  }
811  }
812  /* Return function status */
813  return status;
814 }
815 
823  uint32_t Timeout)
824 {
825  uint32_t tickstart;
826  uint32_t channel;
827  DFSDM_Filter_TypeDef *filter0Instance;
828 
829  /* Check parameters */
831 
832 #if defined(DFSDM2_Channel0)
833  if (IS_DFSDM1_CHANNEL_INSTANCE(hdfsdm_channel->Instance))
834  {
835  filter0Instance = DFSDM1_Filter0;
836  }
837  else
838  {
839  filter0Instance = DFSDM2_Filter0;
840  }
841 #else /* DFSDM2_Channel0 */
842  filter0Instance = DFSDM1_Filter0;
843 #endif /* DFSDM2_Channel0 */
844 
845  /* Check DFSDM channel state */
846  if(hdfsdm_channel->State != HAL_DFSDM_CHANNEL_STATE_READY)
847  {
848  /* Return error status */
849  return HAL_ERROR;
850  }
851  else
852  {
853  /* Get channel number from channel instance */
854  channel = DFSDM_GetChannelFromInstance(hdfsdm_channel->Instance);
855 
856  /* Get timeout */
857  tickstart = HAL_GetTick();
858 
859  /* Wait clock absence detection */
860  while ((((filter0Instance->FLTISR & DFSDM_FLTISR_CKABF) >> (DFSDM_FLTISR_CKABF_Pos + channel)) & 1U) == 0U)
861  {
862  /* Check the Timeout */
863  if(Timeout != HAL_MAX_DELAY)
864  {
865  if(((HAL_GetTick()-tickstart) > Timeout) || (Timeout == 0U))
866  {
867  /* Return timeout status */
868  return HAL_TIMEOUT;
869  }
870  }
871  }
872 
873  /* Clear clock absence detection flag */
874  filter0Instance->FLTICR = (1UL << (DFSDM_FLTICR_CLRCKABF_Pos + channel));
875 
876  /* Return function status */
877  return HAL_OK;
878  }
879 }
880 
887 {
888  HAL_StatusTypeDef status = HAL_OK;
889  uint32_t channel;
890  DFSDM_Filter_TypeDef *filter0Instance;
891 
892  /* Check parameters */
894 
895 #if defined(DFSDM2_Channel0)
896  if (IS_DFSDM1_CHANNEL_INSTANCE(hdfsdm_channel->Instance))
897  {
898  filter0Instance = DFSDM1_Filter0;
899  }
900  else
901  {
902  filter0Instance = DFSDM2_Filter0;
903  }
904 #else /* DFSDM2_Channel0 */
905  filter0Instance = DFSDM1_Filter0;
906 #endif /* DFSDM2_Channel0 */
907 
908  /* Check DFSDM channel state */
909  if(hdfsdm_channel->State != HAL_DFSDM_CHANNEL_STATE_READY)
910  {
911  /* Return error status */
912  status = HAL_ERROR;
913  }
914  else
915  {
916  /* Stop clock absence detection */
917  hdfsdm_channel->Instance->CHCFGR1 &= ~(DFSDM_CHCFGR1_CKABEN);
918 
919  /* Clear clock absence flag */
920  channel = DFSDM_GetChannelFromInstance(hdfsdm_channel->Instance);
921  filter0Instance->FLTICR = (1UL << (DFSDM_FLTICR_CLRCKABF_Pos + channel));
922  }
923  /* Return function status */
924  return status;
925 }
926 
937 {
938  HAL_StatusTypeDef status = HAL_OK;
939  uint32_t channel;
940  uint32_t tickstart;
941  DFSDM_Filter_TypeDef *filter0Instance;
942 
943  /* Check parameters */
945 
946 #if defined(DFSDM2_Channel0)
947  if (IS_DFSDM1_CHANNEL_INSTANCE(hdfsdm_channel->Instance))
948  {
949  filter0Instance = DFSDM1_Filter0;
950  }
951  else
952  {
953  filter0Instance = DFSDM2_Filter0;
954  }
955 #else /* DFSDM2_Channel0 */
956  filter0Instance = DFSDM1_Filter0;
957 #endif /* DFSDM2_Channel0 */
958 
959  /* Check DFSDM channel state */
960  if(hdfsdm_channel->State != HAL_DFSDM_CHANNEL_STATE_READY)
961  {
962  /* Return error status */
963  status = HAL_ERROR;
964  }
965  else
966  {
967  /* Get channel number from channel instance */
968  channel = DFSDM_GetChannelFromInstance(hdfsdm_channel->Instance);
969 
970  /* Get timeout */
971  tickstart = HAL_GetTick();
972 
973  /* Clear clock absence flag */
974  while ((((filter0Instance->FLTISR & DFSDM_FLTISR_CKABF) >> (DFSDM_FLTISR_CKABF_Pos + channel)) & 1U) != 0U)
975  {
976  filter0Instance->FLTICR = (1UL << (DFSDM_FLTICR_CLRCKABF_Pos + channel));
977 
978  /* Check the Timeout */
979  if((HAL_GetTick()-tickstart) > DFSDM_CKAB_TIMEOUT)
980  {
981  /* Set timeout status */
982  status = HAL_TIMEOUT;
983  break;
984  }
985  }
986 
987  if(status == HAL_OK)
988  {
989  /* Activate clock absence detection interrupt */
990  filter0Instance->FLTCR2 |= DFSDM_FLTCR2_CKABIE;
991 
992  /* Start clock absence detection */
993  hdfsdm_channel->Instance->CHCFGR1 |= DFSDM_CHCFGR1_CKABEN;
994  }
995  }
996  /* Return function status */
997  return status;
998 }
999 
1006 {
1007  /* Prevent unused argument(s) compilation warning */
1008  UNUSED(hdfsdm_channel);
1009 
1010  /* NOTE : This function should not be modified, when the callback is needed,
1011  the HAL_DFSDM_ChannelCkabCallback could be implemented in the user file
1012  */
1013 }
1014 
1022 {
1023  HAL_StatusTypeDef status = HAL_OK;
1024  uint32_t channel;
1025  DFSDM_Filter_TypeDef *filter0Instance;
1026 
1027  /* Check parameters */
1029 
1030 #if defined(DFSDM2_Channel0)
1031  if (IS_DFSDM1_CHANNEL_INSTANCE(hdfsdm_channel->Instance))
1032  {
1033  filter0Instance = DFSDM1_Filter0;
1034  }
1035  else
1036  {
1037  filter0Instance = DFSDM2_Filter0;
1038  }
1039 #else /* DFSDM2_Channel0 */
1040  filter0Instance = DFSDM1_Filter0;
1041 #endif /* DFSDM2_Channel0 */
1042 
1043  /* Check DFSDM channel state */
1044  if(hdfsdm_channel->State != HAL_DFSDM_CHANNEL_STATE_READY)
1045  {
1046  /* Return error status */
1047  status = HAL_ERROR;
1048  }
1049  else
1050  {
1051  /* Stop clock absence detection */
1052  hdfsdm_channel->Instance->CHCFGR1 &= ~(DFSDM_CHCFGR1_CKABEN);
1053 
1054  /* Clear clock absence flag */
1055  channel = DFSDM_GetChannelFromInstance(hdfsdm_channel->Instance);
1056  filter0Instance->FLTICR = (1UL << (DFSDM_FLTICR_CLRCKABF_Pos + channel));
1057 
1058  /* Disable clock absence detection interrupt */
1059  filter0Instance->FLTCR2 &= ~(DFSDM_FLTCR2_CKABIE);
1060  }
1061  /* Return function status */
1062  return status;
1063 }
1064 
1076  uint32_t Threshold,
1077  uint32_t BreakSignal)
1078 {
1079  HAL_StatusTypeDef status = HAL_OK;
1080 
1081  /* Check parameters */
1084  assert_param(IS_DFSDM_BREAK_SIGNALS(BreakSignal));
1085 
1086  /* Check DFSDM channel state */
1087  if(hdfsdm_channel->State != HAL_DFSDM_CHANNEL_STATE_READY)
1088  {
1089  /* Return error status */
1090  status = HAL_ERROR;
1091  }
1092  else
1093  {
1094  /* Configure threshold and break signals */
1095  hdfsdm_channel->Instance->CHAWSCDR &= ~(DFSDM_CHAWSCDR_BKSCD | DFSDM_CHAWSCDR_SCDT);
1096  hdfsdm_channel->Instance->CHAWSCDR |= ((BreakSignal << DFSDM_CHAWSCDR_BKSCD_Pos) | \
1097  Threshold);
1098 
1099  /* Start short circuit detection */
1100  hdfsdm_channel->Instance->CHCFGR1 |= DFSDM_CHCFGR1_SCDEN;
1101  }
1102  /* Return function status */
1103  return status;
1104 }
1105 
1113  uint32_t Timeout)
1114 {
1115  uint32_t tickstart;
1116  uint32_t channel;
1117  DFSDM_Filter_TypeDef *filter0Instance;
1118 
1119  /* Check parameters */
1121 
1122 #if defined(DFSDM2_Channel0)
1123  if (IS_DFSDM1_CHANNEL_INSTANCE(hdfsdm_channel->Instance))
1124  {
1125  filter0Instance = DFSDM1_Filter0;
1126  }
1127  else
1128  {
1129  filter0Instance = DFSDM2_Filter0;
1130  }
1131 #else /* DFSDM2_Channel0 */
1132  filter0Instance = DFSDM1_Filter0;
1133 #endif /* DFSDM2_Channel0 */
1134 
1135  /* Check DFSDM channel state */
1136  if(hdfsdm_channel->State != HAL_DFSDM_CHANNEL_STATE_READY)
1137  {
1138  /* Return error status */
1139  return HAL_ERROR;
1140  }
1141  else
1142  {
1143  /* Get channel number from channel instance */
1144  channel = DFSDM_GetChannelFromInstance(hdfsdm_channel->Instance);
1145 
1146  /* Get timeout */
1147  tickstart = HAL_GetTick();
1148 
1149  /* Wait short circuit detection */
1150  while (((filter0Instance->FLTISR & DFSDM_FLTISR_SCDF) >> (DFSDM_FLTISR_SCDF_Pos + channel)) == 0U)
1151  {
1152  /* Check the Timeout */
1153  if(Timeout != HAL_MAX_DELAY)
1154  {
1155  if(((HAL_GetTick()-tickstart) > Timeout) || (Timeout == 0U))
1156  {
1157  /* Return timeout status */
1158  return HAL_TIMEOUT;
1159  }
1160  }
1161  }
1162 
1163  /* Clear short circuit detection flag */
1164  filter0Instance->FLTICR = (1UL << (DFSDM_FLTICR_CLRSCDF_Pos + channel));
1165 
1166  /* Return function status */
1167  return HAL_OK;
1168  }
1169 }
1170 
1177 {
1178  HAL_StatusTypeDef status = HAL_OK;
1179  uint32_t channel;
1180  DFSDM_Filter_TypeDef *filter0Instance;
1181 
1182  /* Check parameters */
1184 
1185 #if defined(DFSDM2_Channel0)
1186  if (IS_DFSDM1_CHANNEL_INSTANCE(hdfsdm_channel->Instance))
1187  {
1188  filter0Instance = DFSDM1_Filter0;
1189  }
1190  else
1191  {
1192  filter0Instance = DFSDM2_Filter0;
1193  }
1194 #else /* DFSDM2_Channel0 */
1195  filter0Instance = DFSDM1_Filter0;
1196 #endif /* DFSDM2_Channel0 */
1197 
1198  /* Check DFSDM channel state */
1199  if(hdfsdm_channel->State != HAL_DFSDM_CHANNEL_STATE_READY)
1200  {
1201  /* Return error status */
1202  status = HAL_ERROR;
1203  }
1204  else
1205  {
1206  /* Stop short circuit detection */
1207  hdfsdm_channel->Instance->CHCFGR1 &= ~(DFSDM_CHCFGR1_SCDEN);
1208 
1209  /* Clear short circuit detection flag */
1210  channel = DFSDM_GetChannelFromInstance(hdfsdm_channel->Instance);
1211  filter0Instance->FLTICR = (1UL << (DFSDM_FLTICR_CLRSCDF_Pos + channel));
1212  }
1213  /* Return function status */
1214  return status;
1215 }
1216 
1228  uint32_t Threshold,
1229  uint32_t BreakSignal)
1230 {
1231  HAL_StatusTypeDef status = HAL_OK;
1232  DFSDM_Filter_TypeDef *filter0Instance;
1233 
1234  /* Check parameters */
1237  assert_param(IS_DFSDM_BREAK_SIGNALS(BreakSignal));
1238 
1239 #if defined(DFSDM2_Channel0)
1240  if (IS_DFSDM1_CHANNEL_INSTANCE(hdfsdm_channel->Instance))
1241  {
1242  filter0Instance = DFSDM1_Filter0;
1243  }
1244  else
1245  {
1246  filter0Instance = DFSDM2_Filter0;
1247  }
1248 #else /* DFSDM2_Channel0 */
1249  filter0Instance = DFSDM1_Filter0;
1250 #endif /* DFSDM2_Channel0 */
1251 
1252  /* Check DFSDM channel state */
1253  if(hdfsdm_channel->State != HAL_DFSDM_CHANNEL_STATE_READY)
1254  {
1255  /* Return error status */
1256  status = HAL_ERROR;
1257  }
1258  else
1259  {
1260  /* Activate short circuit detection interrupt */
1261  filter0Instance->FLTCR2 |= DFSDM_FLTCR2_SCDIE;
1262 
1263  /* Configure threshold and break signals */
1264  hdfsdm_channel->Instance->CHAWSCDR &= ~(DFSDM_CHAWSCDR_BKSCD | DFSDM_CHAWSCDR_SCDT);
1265  hdfsdm_channel->Instance->CHAWSCDR |= ((BreakSignal << DFSDM_CHAWSCDR_BKSCD_Pos) | \
1266  Threshold);
1267 
1268  /* Start short circuit detection */
1269  hdfsdm_channel->Instance->CHCFGR1 |= DFSDM_CHCFGR1_SCDEN;
1270  }
1271  /* Return function status */
1272  return status;
1273 }
1274 
1280 __weak void HAL_DFSDM_ChannelScdCallback(DFSDM_Channel_HandleTypeDef *hdfsdm_channel)
1281 {
1282  /* Prevent unused argument(s) compilation warning */
1283  UNUSED(hdfsdm_channel);
1284 
1285  /* NOTE : This function should not be modified, when the callback is needed,
1286  the HAL_DFSDM_ChannelScdCallback could be implemented in the user file
1287  */
1288 }
1289 
1297 {
1298  HAL_StatusTypeDef status = HAL_OK;
1299  uint32_t channel;
1300  DFSDM_Filter_TypeDef *filter0Instance;
1301 
1302  /* Check parameters */
1304 
1305 #if defined(DFSDM2_Channel0)
1306  if (IS_DFSDM1_CHANNEL_INSTANCE(hdfsdm_channel->Instance))
1307  {
1308  filter0Instance = DFSDM1_Filter0;
1309  }
1310  else
1311  {
1312  filter0Instance = DFSDM2_Filter0;
1313  }
1314 #else /* DFSDM2_Channel0 */
1315  filter0Instance = DFSDM1_Filter0;
1316 #endif /* DFSDM2_Channel0 */
1317 
1318  /* Check DFSDM channel state */
1319  if(hdfsdm_channel->State != HAL_DFSDM_CHANNEL_STATE_READY)
1320  {
1321  /* Return error status */
1322  status = HAL_ERROR;
1323  }
1324  else
1325  {
1326  /* Stop short circuit detection */
1327  hdfsdm_channel->Instance->CHCFGR1 &= ~(DFSDM_CHCFGR1_SCDEN);
1328 
1329  /* Clear short circuit detection flag */
1330  channel = DFSDM_GetChannelFromInstance(hdfsdm_channel->Instance);
1331  filter0Instance->FLTICR = (1UL << (DFSDM_FLTICR_CLRSCDF_Pos + channel));
1332 
1333  /* Disable short circuit detection interrupt */
1334  filter0Instance->FLTCR2 &= ~(DFSDM_FLTCR2_SCDIE);
1335  }
1336  /* Return function status */
1337  return status;
1338 }
1339 
1346 {
1347  return (int16_t) hdfsdm_channel->Instance->CHWDATAR;
1348 }
1349 
1358  int32_t Offset)
1359 {
1360  HAL_StatusTypeDef status = HAL_OK;
1361 
1362  /* Check parameters */
1365 
1366  /* Check DFSDM channel state */
1367  if(hdfsdm_channel->State != HAL_DFSDM_CHANNEL_STATE_READY)
1368  {
1369  /* Return error status */
1370  status = HAL_ERROR;
1371  }
1372  else
1373  {
1374  /* Modify channel offset */
1375  hdfsdm_channel->Instance->CHCFGR2 &= ~(DFSDM_CHCFGR2_OFFSET);
1376  hdfsdm_channel->Instance->CHCFGR2 |= ((uint32_t) Offset << DFSDM_CHCFGR2_OFFSET_Pos);
1377  }
1378  /* Return function status */
1379  return status;
1380 }
1381 
1405 {
1406  /* Return DFSDM channel handle state */
1407  return hdfsdm_channel->State;
1408 }
1409 
1435 {
1436  const DFSDM_Filter_TypeDef *filter0Instance;
1437 
1438  /* Check DFSDM Channel handle */
1439  if(hdfsdm_filter == NULL)
1440  {
1441  return HAL_ERROR;
1442  }
1443 
1444  /* Check parameters */
1455 
1456 #if defined(DFSDM2_Channel0)
1457  if (IS_DFSDM1_FILTER_INSTANCE(hdfsdm_filter->Instance))
1458  {
1459  filter0Instance = DFSDM1_Filter0;
1460  }
1461  else
1462  {
1463  filter0Instance = DFSDM2_Filter0;
1464  }
1465 #else /* DFSDM2_Channel0 */
1466  filter0Instance = DFSDM1_Filter0;
1467 #endif /* DFSDM2_Channel0 */
1468 
1469  /* Check parameters compatibility */
1470  if ((hdfsdm_filter->Instance == filter0Instance) &&
1471  ((hdfsdm_filter->Init.RegularParam.Trigger == DFSDM_FILTER_SYNC_TRIGGER) ||
1472  (hdfsdm_filter->Init.InjectedParam.Trigger == DFSDM_FILTER_SYNC_TRIGGER)))
1473  {
1474  return HAL_ERROR;
1475  }
1476 
1477  /* Initialize DFSDM filter variables with default values */
1478  hdfsdm_filter->RegularContMode = DFSDM_CONTINUOUS_CONV_OFF;
1479  hdfsdm_filter->InjectedChannelsNbr = 1;
1480  hdfsdm_filter->InjConvRemaining = 1;
1481  hdfsdm_filter->ErrorCode = DFSDM_FILTER_ERROR_NONE;
1482 
1483 #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
1484  /* Reset callback pointers to the weak predefined callbacks */
1485  hdfsdm_filter->AwdCallback = HAL_DFSDM_FilterAwdCallback;
1486  hdfsdm_filter->RegConvCpltCallback = HAL_DFSDM_FilterRegConvCpltCallback;
1487  hdfsdm_filter->RegConvHalfCpltCallback = HAL_DFSDM_FilterRegConvHalfCpltCallback;
1488  hdfsdm_filter->InjConvCpltCallback = HAL_DFSDM_FilterInjConvCpltCallback;
1489  hdfsdm_filter->InjConvHalfCpltCallback = HAL_DFSDM_FilterInjConvHalfCpltCallback;
1490  hdfsdm_filter->ErrorCallback = HAL_DFSDM_FilterErrorCallback;
1491 
1492  /* Call MSP init function */
1493  if(hdfsdm_filter->MspInitCallback == NULL)
1494  {
1495  hdfsdm_filter->MspInitCallback = HAL_DFSDM_FilterMspInit;
1496  }
1497  hdfsdm_filter->MspInitCallback(hdfsdm_filter);
1498 #else
1499  /* Call MSP init function */
1500  HAL_DFSDM_FilterMspInit(hdfsdm_filter);
1501 #endif
1502 
1503  /* Set regular parameters */
1504  hdfsdm_filter->Instance->FLTCR1 &= ~(DFSDM_FLTCR1_RSYNC);
1505  if(hdfsdm_filter->Init.RegularParam.FastMode == ENABLE)
1506  {
1507  hdfsdm_filter->Instance->FLTCR1 |= DFSDM_FLTCR1_FAST;
1508  }
1509  else
1510  {
1511  hdfsdm_filter->Instance->FLTCR1 &= ~(DFSDM_FLTCR1_FAST);
1512  }
1513 
1514  if(hdfsdm_filter->Init.RegularParam.DmaMode == ENABLE)
1515  {
1516  hdfsdm_filter->Instance->FLTCR1 |= DFSDM_FLTCR1_RDMAEN;
1517  }
1518  else
1519  {
1520  hdfsdm_filter->Instance->FLTCR1 &= ~(DFSDM_FLTCR1_RDMAEN);
1521  }
1522 
1523  /* Set injected parameters */
1525  if(hdfsdm_filter->Init.InjectedParam.Trigger == DFSDM_FILTER_EXT_TRIGGER)
1526  {
1529  hdfsdm_filter->Instance->FLTCR1 |= (hdfsdm_filter->Init.InjectedParam.ExtTrigger);
1530  }
1531 
1532  if(hdfsdm_filter->Init.InjectedParam.ScanMode == ENABLE)
1533  {
1534  hdfsdm_filter->Instance->FLTCR1 |= DFSDM_FLTCR1_JSCAN;
1535  }
1536  else
1537  {
1538  hdfsdm_filter->Instance->FLTCR1 &= ~(DFSDM_FLTCR1_JSCAN);
1539  }
1540 
1541  if(hdfsdm_filter->Init.InjectedParam.DmaMode == ENABLE)
1542  {
1543  hdfsdm_filter->Instance->FLTCR1 |= DFSDM_FLTCR1_JDMAEN;
1544  }
1545  else
1546  {
1547  hdfsdm_filter->Instance->FLTCR1 &= ~(DFSDM_FLTCR1_JDMAEN);
1548  }
1549 
1550  /* Set filter parameters */
1552  hdfsdm_filter->Instance->FLTFCR |= (hdfsdm_filter->Init.FilterParam.SincOrder |
1553  ((hdfsdm_filter->Init.FilterParam.Oversampling - 1U) << DFSDM_FLTFCR_FOSR_Pos) |
1554  (hdfsdm_filter->Init.FilterParam.IntOversampling - 1U));
1555 
1556  /* Store regular and injected triggers and injected scan mode*/
1557  hdfsdm_filter->RegularTrigger = hdfsdm_filter->Init.RegularParam.Trigger;
1558  hdfsdm_filter->InjectedTrigger = hdfsdm_filter->Init.InjectedParam.Trigger;
1559  hdfsdm_filter->ExtTriggerEdge = hdfsdm_filter->Init.InjectedParam.ExtTriggerEdge;
1560  hdfsdm_filter->InjectedScanMode = hdfsdm_filter->Init.InjectedParam.ScanMode;
1561 
1562  /* Enable DFSDM filter */
1563  hdfsdm_filter->Instance->FLTCR1 |= DFSDM_FLTCR1_DFEN;
1564 
1565  /* Set DFSDM filter to ready state */
1566  hdfsdm_filter->State = HAL_DFSDM_FILTER_STATE_READY;
1567 
1568  return HAL_OK;
1569 }
1570 
1577 {
1578  /* Check DFSDM filter handle */
1579  if(hdfsdm_filter == NULL)
1580  {
1581  return HAL_ERROR;
1582  }
1583 
1584  /* Check parameters */
1586 
1587  /* Disable the DFSDM filter */
1588  hdfsdm_filter->Instance->FLTCR1 &= ~(DFSDM_FLTCR1_DFEN);
1589 
1590  /* Call MSP deinit function */
1591 #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
1592  if(hdfsdm_filter->MspDeInitCallback == NULL)
1593  {
1594  hdfsdm_filter->MspDeInitCallback = HAL_DFSDM_FilterMspDeInit;
1595  }
1596  hdfsdm_filter->MspDeInitCallback(hdfsdm_filter);
1597 #else
1598  HAL_DFSDM_FilterMspDeInit(hdfsdm_filter);
1599 #endif
1600 
1601  /* Set DFSDM filter in reset state */
1602  hdfsdm_filter->State = HAL_DFSDM_FILTER_STATE_RESET;
1603 
1604  return HAL_OK;
1605 }
1606 
1612 __weak void HAL_DFSDM_FilterMspInit(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
1613 {
1614  /* Prevent unused argument(s) compilation warning */
1615  UNUSED(hdfsdm_filter);
1616 
1617  /* NOTE : This function should not be modified, when the function is needed,
1618  the HAL_DFSDM_FilterMspInit could be implemented in the user file.
1619  */
1620 }
1621 
1627 __weak void HAL_DFSDM_FilterMspDeInit(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
1628 {
1629  /* Prevent unused argument(s) compilation warning */
1630  UNUSED(hdfsdm_filter);
1631 
1632  /* NOTE : This function should not be modified, when the function is needed,
1633  the HAL_DFSDM_FilterMspDeInit could be implemented in the user file.
1634  */
1635 }
1636 
1637 #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
1638 
1654 HAL_StatusTypeDef HAL_DFSDM_Filter_RegisterCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter,
1655  HAL_DFSDM_Filter_CallbackIDTypeDef CallbackID,
1656  pDFSDM_Filter_CallbackTypeDef pCallback)
1657 {
1658  HAL_StatusTypeDef status = HAL_OK;
1659 
1660  if(pCallback == NULL)
1661  {
1662  /* update the error code */
1663  hdfsdm_filter->ErrorCode = DFSDM_FILTER_ERROR_INVALID_CALLBACK;
1664  /* update return status */
1665  status = HAL_ERROR;
1666  }
1667  else
1668  {
1669  if(HAL_DFSDM_FILTER_STATE_READY == hdfsdm_filter->State)
1670  {
1671  switch (CallbackID)
1672  {
1673  case HAL_DFSDM_FILTER_REGCONV_COMPLETE_CB_ID :
1674  hdfsdm_filter->RegConvCpltCallback = pCallback;
1675  break;
1676  case HAL_DFSDM_FILTER_REGCONV_HALFCOMPLETE_CB_ID :
1677  hdfsdm_filter->RegConvHalfCpltCallback = pCallback;
1678  break;
1679  case HAL_DFSDM_FILTER_INJCONV_COMPLETE_CB_ID :
1680  hdfsdm_filter->InjConvCpltCallback = pCallback;
1681  break;
1682  case HAL_DFSDM_FILTER_INJCONV_HALFCOMPLETE_CB_ID :
1683  hdfsdm_filter->InjConvHalfCpltCallback = pCallback;
1684  break;
1685  case HAL_DFSDM_FILTER_ERROR_CB_ID :
1686  hdfsdm_filter->ErrorCallback = pCallback;
1687  break;
1688  case HAL_DFSDM_FILTER_MSPINIT_CB_ID :
1689  hdfsdm_filter->MspInitCallback = pCallback;
1690  break;
1691  case HAL_DFSDM_FILTER_MSPDEINIT_CB_ID :
1692  hdfsdm_filter->MspDeInitCallback = pCallback;
1693  break;
1694  default :
1695  /* update the error code */
1696  hdfsdm_filter->ErrorCode = DFSDM_FILTER_ERROR_INVALID_CALLBACK;
1697  /* update return status */
1698  status = HAL_ERROR;
1699  break;
1700  }
1701  }
1702  else if(HAL_DFSDM_FILTER_STATE_RESET == hdfsdm_filter->State)
1703  {
1704  switch (CallbackID)
1705  {
1706  case HAL_DFSDM_FILTER_MSPINIT_CB_ID :
1707  hdfsdm_filter->MspInitCallback = pCallback;
1708  break;
1709  case HAL_DFSDM_FILTER_MSPDEINIT_CB_ID :
1710  hdfsdm_filter->MspDeInitCallback = pCallback;
1711  break;
1712  default :
1713  /* update the error code */
1714  hdfsdm_filter->ErrorCode = DFSDM_FILTER_ERROR_INVALID_CALLBACK;
1715  /* update return status */
1716  status = HAL_ERROR;
1717  break;
1718  }
1719  }
1720  else
1721  {
1722  /* update the error code */
1723  hdfsdm_filter->ErrorCode = DFSDM_FILTER_ERROR_INVALID_CALLBACK;
1724  /* update return status */
1725  status = HAL_ERROR;
1726  }
1727  }
1728  return status;
1729 }
1730 
1746 HAL_StatusTypeDef HAL_DFSDM_Filter_UnRegisterCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter,
1747  HAL_DFSDM_Filter_CallbackIDTypeDef CallbackID)
1748 {
1749  HAL_StatusTypeDef status = HAL_OK;
1750 
1751  if(HAL_DFSDM_FILTER_STATE_READY == hdfsdm_filter->State)
1752  {
1753  switch (CallbackID)
1754  {
1755  case HAL_DFSDM_FILTER_REGCONV_COMPLETE_CB_ID :
1756  hdfsdm_filter->RegConvCpltCallback = HAL_DFSDM_FilterRegConvCpltCallback;
1757  break;
1758  case HAL_DFSDM_FILTER_REGCONV_HALFCOMPLETE_CB_ID :
1759  hdfsdm_filter->RegConvHalfCpltCallback = HAL_DFSDM_FilterRegConvHalfCpltCallback;
1760  break;
1761  case HAL_DFSDM_FILTER_INJCONV_COMPLETE_CB_ID :
1762  hdfsdm_filter->InjConvCpltCallback = HAL_DFSDM_FilterInjConvCpltCallback;
1763  break;
1764  case HAL_DFSDM_FILTER_INJCONV_HALFCOMPLETE_CB_ID :
1765  hdfsdm_filter->InjConvHalfCpltCallback = HAL_DFSDM_FilterInjConvHalfCpltCallback;
1766  break;
1767  case HAL_DFSDM_FILTER_ERROR_CB_ID :
1768  hdfsdm_filter->ErrorCallback = HAL_DFSDM_FilterErrorCallback;
1769  break;
1770  case HAL_DFSDM_FILTER_MSPINIT_CB_ID :
1771  hdfsdm_filter->MspInitCallback = HAL_DFSDM_FilterMspInit;
1772  break;
1773  case HAL_DFSDM_FILTER_MSPDEINIT_CB_ID :
1774  hdfsdm_filter->MspDeInitCallback = HAL_DFSDM_FilterMspDeInit;
1775  break;
1776  default :
1777  /* update the error code */
1778  hdfsdm_filter->ErrorCode = DFSDM_FILTER_ERROR_INVALID_CALLBACK;
1779  /* update return status */
1780  status = HAL_ERROR;
1781  break;
1782  }
1783  }
1784  else if(HAL_DFSDM_FILTER_STATE_RESET == hdfsdm_filter->State)
1785  {
1786  switch (CallbackID)
1787  {
1788  case HAL_DFSDM_FILTER_MSPINIT_CB_ID :
1789  hdfsdm_filter->MspInitCallback = HAL_DFSDM_FilterMspInit;
1790  break;
1791  case HAL_DFSDM_FILTER_MSPDEINIT_CB_ID :
1792  hdfsdm_filter->MspDeInitCallback = HAL_DFSDM_FilterMspDeInit;
1793  break;
1794  default :
1795  /* update the error code */
1796  hdfsdm_filter->ErrorCode = DFSDM_FILTER_ERROR_INVALID_CALLBACK;
1797  /* update return status */
1798  status = HAL_ERROR;
1799  break;
1800  }
1801  }
1802  else
1803  {
1804  /* update the error code */
1805  hdfsdm_filter->ErrorCode = DFSDM_FILTER_ERROR_INVALID_CALLBACK;
1806  /* update return status */
1807  status = HAL_ERROR;
1808  }
1809  return status;
1810 }
1811 
1819 HAL_StatusTypeDef HAL_DFSDM_Filter_RegisterAwdCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter,
1820  pDFSDM_Filter_AwdCallbackTypeDef pCallback)
1821 {
1822  HAL_StatusTypeDef status = HAL_OK;
1823 
1824  if(pCallback == NULL)
1825  {
1826  /* update the error code */
1827  hdfsdm_filter->ErrorCode = DFSDM_FILTER_ERROR_INVALID_CALLBACK;
1828  /* update return status */
1829  status = HAL_ERROR;
1830  }
1831  else
1832  {
1833  if(HAL_DFSDM_FILTER_STATE_READY == hdfsdm_filter->State)
1834  {
1835  hdfsdm_filter->AwdCallback = pCallback;
1836  }
1837  else
1838  {
1839  /* update the error code */
1840  hdfsdm_filter->ErrorCode = DFSDM_FILTER_ERROR_INVALID_CALLBACK;
1841  /* update return status */
1842  status = HAL_ERROR;
1843  }
1844  }
1845  return status;
1846 }
1847 
1854 HAL_StatusTypeDef HAL_DFSDM_Filter_UnRegisterAwdCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
1855 {
1856  HAL_StatusTypeDef status = HAL_OK;
1857 
1858  if(HAL_DFSDM_FILTER_STATE_READY == hdfsdm_filter->State)
1859  {
1860  hdfsdm_filter->AwdCallback = HAL_DFSDM_FilterAwdCallback;
1861  }
1862  else
1863  {
1864  /* update the error code */
1865  hdfsdm_filter->ErrorCode = DFSDM_FILTER_ERROR_INVALID_CALLBACK;
1866  /* update return status */
1867  status = HAL_ERROR;
1868  }
1869  return status;
1870 }
1871 #endif /* USE_HAL_DFSDM_REGISTER_CALLBACKS */
1872 
1902  uint32_t Channel,
1903  uint32_t ContinuousMode)
1904 {
1905  HAL_StatusTypeDef status = HAL_OK;
1906 
1907  /* Check parameters */
1910  assert_param(IS_DFSDM_CONTINUOUS_MODE(ContinuousMode));
1911 
1912  /* Check DFSDM filter state */
1913  if((hdfsdm_filter->State != HAL_DFSDM_FILTER_STATE_RESET) &&
1914  (hdfsdm_filter->State != HAL_DFSDM_FILTER_STATE_ERROR))
1915  {
1916  /* Configure channel and continuous mode for regular conversion */
1917  hdfsdm_filter->Instance->FLTCR1 &= ~(DFSDM_FLTCR1_RCH | DFSDM_FLTCR1_RCONT);
1918  if(ContinuousMode == DFSDM_CONTINUOUS_CONV_ON)
1919  {
1920  hdfsdm_filter->Instance->FLTCR1 |= (uint32_t) (((Channel & DFSDM_MSB_MASK) << DFSDM_FLTCR1_MSB_RCH_OFFSET) |
1922  }
1923  else
1924  {
1925  hdfsdm_filter->Instance->FLTCR1 |= (uint32_t) ((Channel & DFSDM_MSB_MASK) << DFSDM_FLTCR1_MSB_RCH_OFFSET);
1926  }
1927  /* Store continuous mode information */
1928  hdfsdm_filter->RegularContMode = ContinuousMode;
1929  }
1930  else
1931  {
1932  status = HAL_ERROR;
1933  }
1934 
1935  /* Return function status */
1936  return status;
1937 }
1938 
1947  uint32_t Channel)
1948 {
1949  HAL_StatusTypeDef status = HAL_OK;
1950 
1951  /* Check parameters */
1954 
1955  /* Check DFSDM filter state */
1956  if((hdfsdm_filter->State != HAL_DFSDM_FILTER_STATE_RESET) &&
1957  (hdfsdm_filter->State != HAL_DFSDM_FILTER_STATE_ERROR))
1958  {
1959  /* Configure channel for injected conversion */
1960  hdfsdm_filter->Instance->FLTJCHGR = (uint32_t) (Channel & DFSDM_LSB_MASK);
1961  /* Store number of injected channels */
1962  hdfsdm_filter->InjectedChannelsNbr = DFSDM_GetInjChannelsNbr(Channel);
1963  /* Update number of injected channels remaining */
1964  hdfsdm_filter->InjConvRemaining = (hdfsdm_filter->InjectedScanMode == ENABLE) ? \
1965  hdfsdm_filter->InjectedChannelsNbr : 1U;
1966  }
1967  else
1968  {
1969  status = HAL_ERROR;
1970  }
1971  /* Return function status */
1972  return status;
1973 }
1974 
2017 {
2018  HAL_StatusTypeDef status = HAL_OK;
2019 
2020  /* Check parameters */
2022 
2023  /* Check DFSDM filter state */
2024  if((hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_READY) || \
2025  (hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_INJ))
2026  {
2027  /* Start regular conversion */
2028  DFSDM_RegConvStart(hdfsdm_filter);
2029  }
2030  else
2031  {
2032  status = HAL_ERROR;
2033  }
2034  /* Return function status */
2035  return status;
2036 }
2037 
2046  uint32_t Timeout)
2047 {
2048  uint32_t tickstart;
2049 
2050  /* Check parameters */
2052 
2053  /* Check DFSDM filter state */
2054  if((hdfsdm_filter->State != HAL_DFSDM_FILTER_STATE_REG) && \
2055  (hdfsdm_filter->State != HAL_DFSDM_FILTER_STATE_REG_INJ))
2056  {
2057  /* Return error status */
2058  return HAL_ERROR;
2059  }
2060  else
2061  {
2062  /* Get timeout */
2063  tickstart = HAL_GetTick();
2064 
2065  /* Wait end of regular conversion */
2066  while((hdfsdm_filter->Instance->FLTISR & DFSDM_FLTISR_REOCF) != DFSDM_FLTISR_REOCF)
2067  {
2068  /* Check the Timeout */
2069  if(Timeout != HAL_MAX_DELAY)
2070  {
2071  if(((HAL_GetTick() - tickstart) > Timeout) || (Timeout == 0U))
2072  {
2073  /* Return timeout status */
2074  return HAL_TIMEOUT;
2075  }
2076  }
2077  }
2078  /* Check if overrun occurs */
2079  if((hdfsdm_filter->Instance->FLTISR & DFSDM_FLTISR_ROVRF) == DFSDM_FLTISR_ROVRF)
2080  {
2081  /* Update error code and call error callback */
2083 #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
2084  hdfsdm_filter->ErrorCallback(hdfsdm_filter);
2085 #else
2086  HAL_DFSDM_FilterErrorCallback(hdfsdm_filter);
2087 #endif
2088 
2089  /* Clear regular overrun flag */
2090  hdfsdm_filter->Instance->FLTICR = DFSDM_FLTICR_CLRROVRF;
2091  }
2092  /* Update DFSDM filter state only if not continuous conversion and SW trigger */
2093  if((hdfsdm_filter->RegularContMode == DFSDM_CONTINUOUS_CONV_OFF) && \
2094  (hdfsdm_filter->RegularTrigger == DFSDM_FILTER_SW_TRIGGER))
2095  {
2096  hdfsdm_filter->State = (hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_REG) ? \
2098  }
2099  /* Return function status */
2100  return HAL_OK;
2101  }
2102 }
2103 
2111 {
2112  HAL_StatusTypeDef status = HAL_OK;
2113 
2114  /* Check parameters */
2116 
2117  /* Check DFSDM filter state */
2118  if((hdfsdm_filter->State != HAL_DFSDM_FILTER_STATE_REG) && \
2119  (hdfsdm_filter->State != HAL_DFSDM_FILTER_STATE_REG_INJ))
2120  {
2121  /* Return error status */
2122  status = HAL_ERROR;
2123  }
2124  else
2125  {
2126  /* Stop regular conversion */
2127  DFSDM_RegConvStop(hdfsdm_filter);
2128  }
2129  /* Return function status */
2130  return status;
2131 }
2132 
2141 {
2142  HAL_StatusTypeDef status = HAL_OK;
2143 
2144  /* Check parameters */
2146 
2147  /* Check DFSDM filter state */
2148  if((hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_READY) || \
2149  (hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_INJ))
2150  {
2151  /* Enable interrupts for regular conversions */
2152  hdfsdm_filter->Instance->FLTCR2 |= (DFSDM_FLTCR2_REOCIE | DFSDM_FLTCR2_ROVRIE);
2153 
2154  /* Start regular conversion */
2155  DFSDM_RegConvStart(hdfsdm_filter);
2156  }
2157  else
2158  {
2159  status = HAL_ERROR;
2160  }
2161  /* Return function status */
2162  return status;
2163 }
2164 
2172 {
2173  HAL_StatusTypeDef status = HAL_OK;
2174 
2175  /* Check parameters */
2177 
2178  /* Check DFSDM filter state */
2179  if((hdfsdm_filter->State != HAL_DFSDM_FILTER_STATE_REG) && \
2180  (hdfsdm_filter->State != HAL_DFSDM_FILTER_STATE_REG_INJ))
2181  {
2182  /* Return error status */
2183  status = HAL_ERROR;
2184  }
2185  else
2186  {
2187  /* Disable interrupts for regular conversions */
2188  hdfsdm_filter->Instance->FLTCR2 &= ~(DFSDM_FLTCR2_REOCIE | DFSDM_FLTCR2_ROVRIE);
2189 
2190  /* Stop regular conversion */
2191  DFSDM_RegConvStop(hdfsdm_filter);
2192  }
2193  /* Return function status */
2194  return status;
2195 }
2196 
2210  int32_t *pData,
2211  uint32_t Length)
2212 {
2213  HAL_StatusTypeDef status = HAL_OK;
2214 
2215  /* Check parameters */
2217 
2218  /* Check destination address and length */
2219  if((pData == NULL) || (Length == 0U))
2220  {
2221  status = HAL_ERROR;
2222  }
2223  /* Check that DMA is enabled for regular conversion */
2224  else if((hdfsdm_filter->Instance->FLTCR1 & DFSDM_FLTCR1_RDMAEN) != DFSDM_FLTCR1_RDMAEN)
2225  {
2226  status = HAL_ERROR;
2227  }
2228  /* Check parameters compatibility */
2229  else if((hdfsdm_filter->RegularTrigger == DFSDM_FILTER_SW_TRIGGER) && \
2230  (hdfsdm_filter->RegularContMode == DFSDM_CONTINUOUS_CONV_OFF) && \
2231  (hdfsdm_filter->hdmaReg->Init.Mode == DMA_NORMAL) && \
2232  (Length != 1U))
2233  {
2234  status = HAL_ERROR;
2235  }
2236  else if((hdfsdm_filter->RegularTrigger == DFSDM_FILTER_SW_TRIGGER) && \
2237  (hdfsdm_filter->RegularContMode == DFSDM_CONTINUOUS_CONV_OFF) && \
2238  (hdfsdm_filter->hdmaReg->Init.Mode == DMA_CIRCULAR))
2239  {
2240  status = HAL_ERROR;
2241  }
2242  /* Check DFSDM filter state */
2243  else if((hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_READY) || \
2244  (hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_INJ))
2245  {
2246  /* Set callbacks on DMA handler */
2247  hdfsdm_filter->hdmaReg->XferCpltCallback = DFSDM_DMARegularConvCplt;
2248  hdfsdm_filter->hdmaReg->XferErrorCallback = DFSDM_DMAError;
2249  hdfsdm_filter->hdmaReg->XferHalfCpltCallback = (hdfsdm_filter->hdmaReg->Init.Mode == DMA_CIRCULAR) ?\
2250  DFSDM_DMARegularHalfConvCplt : NULL;
2251 
2252  /* Start DMA in interrupt mode */
2253  if(HAL_DMA_Start_IT(hdfsdm_filter->hdmaReg, (uint32_t)&hdfsdm_filter->Instance->FLTRDATAR, \
2254  (uint32_t) pData, Length) != HAL_OK)
2255  {
2256  /* Set DFSDM filter in error state */
2257  hdfsdm_filter->State = HAL_DFSDM_FILTER_STATE_ERROR;
2258  status = HAL_ERROR;
2259  }
2260  else
2261  {
2262  /* Start regular conversion */
2263  DFSDM_RegConvStart(hdfsdm_filter);
2264  }
2265  }
2266  else
2267  {
2268  status = HAL_ERROR;
2269  }
2270  /* Return function status */
2271  return status;
2272 }
2273 
2287  int16_t *pData,
2288  uint32_t Length)
2289 {
2290  HAL_StatusTypeDef status = HAL_OK;
2291 
2292  /* Check parameters */
2294 
2295  /* Check destination address and length */
2296  if((pData == NULL) || (Length == 0U))
2297  {
2298  status = HAL_ERROR;
2299  }
2300  /* Check that DMA is enabled for regular conversion */
2301  else if((hdfsdm_filter->Instance->FLTCR1 & DFSDM_FLTCR1_RDMAEN) != DFSDM_FLTCR1_RDMAEN)
2302  {
2303  status = HAL_ERROR;
2304  }
2305  /* Check parameters compatibility */
2306  else if((hdfsdm_filter->RegularTrigger == DFSDM_FILTER_SW_TRIGGER) && \
2307  (hdfsdm_filter->RegularContMode == DFSDM_CONTINUOUS_CONV_OFF) && \
2308  (hdfsdm_filter->hdmaReg->Init.Mode == DMA_NORMAL) && \
2309  (Length != 1U))
2310  {
2311  status = HAL_ERROR;
2312  }
2313  else if((hdfsdm_filter->RegularTrigger == DFSDM_FILTER_SW_TRIGGER) && \
2314  (hdfsdm_filter->RegularContMode == DFSDM_CONTINUOUS_CONV_OFF) && \
2315  (hdfsdm_filter->hdmaReg->Init.Mode == DMA_CIRCULAR))
2316  {
2317  status = HAL_ERROR;
2318  }
2319  /* Check DFSDM filter state */
2320  else if((hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_READY) || \
2321  (hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_INJ))
2322  {
2323  /* Set callbacks on DMA handler */
2324  hdfsdm_filter->hdmaReg->XferCpltCallback = DFSDM_DMARegularConvCplt;
2325  hdfsdm_filter->hdmaReg->XferErrorCallback = DFSDM_DMAError;
2326  hdfsdm_filter->hdmaReg->XferHalfCpltCallback = (hdfsdm_filter->hdmaReg->Init.Mode == DMA_CIRCULAR) ?\
2327  DFSDM_DMARegularHalfConvCplt : NULL;
2328 
2329  /* Start DMA in interrupt mode */
2330  if(HAL_DMA_Start_IT(hdfsdm_filter->hdmaReg, (uint32_t)(&hdfsdm_filter->Instance->FLTRDATAR) + 2U, \
2331  (uint32_t) pData, Length) != HAL_OK)
2332  {
2333  /* Set DFSDM filter in error state */
2334  hdfsdm_filter->State = HAL_DFSDM_FILTER_STATE_ERROR;
2335  status = HAL_ERROR;
2336  }
2337  else
2338  {
2339  /* Start regular conversion */
2340  DFSDM_RegConvStart(hdfsdm_filter);
2341  }
2342  }
2343  else
2344  {
2345  status = HAL_ERROR;
2346  }
2347  /* Return function status */
2348  return status;
2349 }
2350 
2358 {
2359  HAL_StatusTypeDef status = HAL_OK;
2360 
2361  /* Check parameters */
2363 
2364  /* Check DFSDM filter state */
2365  if((hdfsdm_filter->State != HAL_DFSDM_FILTER_STATE_REG) && \
2366  (hdfsdm_filter->State != HAL_DFSDM_FILTER_STATE_REG_INJ))
2367  {
2368  /* Return error status */
2369  status = HAL_ERROR;
2370  }
2371  else
2372  {
2373  /* Stop current DMA transfer */
2374  if(HAL_DMA_Abort(hdfsdm_filter->hdmaReg) != HAL_OK)
2375  {
2376  /* Set DFSDM filter in error state */
2377  hdfsdm_filter->State = HAL_DFSDM_FILTER_STATE_ERROR;
2378  status = HAL_ERROR;
2379  }
2380  else
2381  {
2382  /* Stop regular conversion */
2383  DFSDM_RegConvStop(hdfsdm_filter);
2384  }
2385  }
2386  /* Return function status */
2387  return status;
2388 }
2389 
2397  uint32_t *Channel)
2398 {
2399  uint32_t reg;
2400  int32_t value;
2401 
2402  /* Check parameters */
2404  assert_param(Channel != (void *)0);
2405 
2406  /* Get value of data register for regular channel */
2407  reg = hdfsdm_filter->Instance->FLTRDATAR;
2408 
2409  /* Extract channel and regular conversion value */
2410  *Channel = (reg & DFSDM_FLTRDATAR_RDATACH);
2411  /* Regular conversion value is a signed value located on 24 MSB of register */
2412  /* So after applying a mask on these bits we have to perform a division by 256 (2 raised to the power of 8) */
2413  reg &= DFSDM_FLTRDATAR_RDATA;
2414  value = ((int32_t)reg) / 256;
2415 
2416  /* return regular conversion value */
2417  return value;
2418 }
2419 
2428 {
2429  HAL_StatusTypeDef status = HAL_OK;
2430 
2431  /* Check parameters */
2433 
2434  /* Check DFSDM filter state */
2435  if((hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_READY) || \
2436  (hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_REG))
2437  {
2438  /* Start injected conversion */
2439  DFSDM_InjConvStart(hdfsdm_filter);
2440  }
2441  else
2442  {
2443  status = HAL_ERROR;
2444  }
2445  /* Return function status */
2446  return status;
2447 }
2448 
2457  uint32_t Timeout)
2458 {
2459  uint32_t tickstart;
2460 
2461  /* Check parameters */
2463 
2464  /* Check DFSDM filter state */
2465  if((hdfsdm_filter->State != HAL_DFSDM_FILTER_STATE_INJ) && \
2466  (hdfsdm_filter->State != HAL_DFSDM_FILTER_STATE_REG_INJ))
2467  {
2468  /* Return error status */
2469  return HAL_ERROR;
2470  }
2471  else
2472  {
2473  /* Get timeout */
2474  tickstart = HAL_GetTick();
2475 
2476  /* Wait end of injected conversions */
2477  while((hdfsdm_filter->Instance->FLTISR & DFSDM_FLTISR_JEOCF) != DFSDM_FLTISR_JEOCF)
2478  {
2479  /* Check the Timeout */
2480  if(Timeout != HAL_MAX_DELAY)
2481  {
2482  if(((HAL_GetTick() - tickstart) > Timeout) || (Timeout == 0U))
2483  {
2484  /* Return timeout status */
2485  return HAL_TIMEOUT;
2486  }
2487  }
2488  }
2489  /* Check if overrun occurs */
2490  if((hdfsdm_filter->Instance->FLTISR & DFSDM_FLTISR_JOVRF) == DFSDM_FLTISR_JOVRF)
2491  {
2492  /* Update error code and call error callback */
2494 #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
2495  hdfsdm_filter->ErrorCallback(hdfsdm_filter);
2496 #else
2497  HAL_DFSDM_FilterErrorCallback(hdfsdm_filter);
2498 #endif
2499 
2500  /* Clear injected overrun flag */
2501  hdfsdm_filter->Instance->FLTICR = DFSDM_FLTICR_CLRJOVRF;
2502  }
2503 
2504  /* Update remaining injected conversions */
2505  hdfsdm_filter->InjConvRemaining--;
2506  if(hdfsdm_filter->InjConvRemaining == 0U)
2507  {
2508  /* Update DFSDM filter state only if trigger is software */
2509  if(hdfsdm_filter->InjectedTrigger == DFSDM_FILTER_SW_TRIGGER)
2510  {
2511  hdfsdm_filter->State = (hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_INJ) ? \
2513  }
2514 
2515  /* end of injected sequence, reset the value */
2516  hdfsdm_filter->InjConvRemaining = (hdfsdm_filter->InjectedScanMode == ENABLE) ? \
2517  hdfsdm_filter->InjectedChannelsNbr : 1U;
2518  }
2519 
2520  /* Return function status */
2521  return HAL_OK;
2522  }
2523 }
2524 
2532 {
2533  HAL_StatusTypeDef status = HAL_OK;
2534 
2535  /* Check parameters */
2537 
2538  /* Check DFSDM filter state */
2539  if((hdfsdm_filter->State != HAL_DFSDM_FILTER_STATE_INJ) && \
2540  (hdfsdm_filter->State != HAL_DFSDM_FILTER_STATE_REG_INJ))
2541  {
2542  /* Return error status */
2543  status = HAL_ERROR;
2544  }
2545  else
2546  {
2547  /* Stop injected conversion */
2548  DFSDM_InjConvStop(hdfsdm_filter);
2549  }
2550  /* Return function status */
2551  return status;
2552 }
2553 
2562 {
2563  HAL_StatusTypeDef status = HAL_OK;
2564 
2565  /* Check parameters */
2567 
2568  /* Check DFSDM filter state */
2569  if((hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_READY) || \
2570  (hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_REG))
2571  {
2572  /* Enable interrupts for injected conversions */
2573  hdfsdm_filter->Instance->FLTCR2 |= (DFSDM_FLTCR2_JEOCIE | DFSDM_FLTCR2_JOVRIE);
2574 
2575  /* Start injected conversion */
2576  DFSDM_InjConvStart(hdfsdm_filter);
2577  }
2578  else
2579  {
2580  status = HAL_ERROR;
2581  }
2582  /* Return function status */
2583  return status;
2584 }
2585 
2593 {
2594  HAL_StatusTypeDef status = HAL_OK;
2595 
2596  /* Check parameters */
2598 
2599  /* Check DFSDM filter state */
2600  if((hdfsdm_filter->State != HAL_DFSDM_FILTER_STATE_INJ) && \
2601  (hdfsdm_filter->State != HAL_DFSDM_FILTER_STATE_REG_INJ))
2602  {
2603  /* Return error status */
2604  status = HAL_ERROR;
2605  }
2606  else
2607  {
2608  /* Disable interrupts for injected conversions */
2609  hdfsdm_filter->Instance->FLTCR2 &= ~(DFSDM_FLTCR2_JEOCIE | DFSDM_FLTCR2_JOVRIE);
2610 
2611  /* Stop injected conversion */
2612  DFSDM_InjConvStop(hdfsdm_filter);
2613  }
2614  /* Return function status */
2615  return status;
2616 }
2617 
2631  int32_t *pData,
2632  uint32_t Length)
2633 {
2634  HAL_StatusTypeDef status = HAL_OK;
2635 
2636  /* Check parameters */
2638 
2639  /* Check destination address and length */
2640  if((pData == NULL) || (Length == 0U))
2641  {
2642  status = HAL_ERROR;
2643  }
2644  /* Check that DMA is enabled for injected conversion */
2645  else if((hdfsdm_filter->Instance->FLTCR1 & DFSDM_FLTCR1_JDMAEN) != DFSDM_FLTCR1_JDMAEN)
2646  {
2647  status = HAL_ERROR;
2648  }
2649  /* Check parameters compatibility */
2650  else if((hdfsdm_filter->InjectedTrigger == DFSDM_FILTER_SW_TRIGGER) && \
2651  (hdfsdm_filter->hdmaInj->Init.Mode == DMA_NORMAL) && \
2652  (Length > hdfsdm_filter->InjConvRemaining))
2653  {
2654  status = HAL_ERROR;
2655  }
2656  else if((hdfsdm_filter->InjectedTrigger == DFSDM_FILTER_SW_TRIGGER) && \
2657  (hdfsdm_filter->hdmaInj->Init.Mode == DMA_CIRCULAR))
2658  {
2659  status = HAL_ERROR;
2660  }
2661  /* Check DFSDM filter state */
2662  else if((hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_READY) || \
2663  (hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_REG))
2664  {
2665  /* Set callbacks on DMA handler */
2666  hdfsdm_filter->hdmaInj->XferCpltCallback = DFSDM_DMAInjectedConvCplt;
2667  hdfsdm_filter->hdmaInj->XferErrorCallback = DFSDM_DMAError;
2668  hdfsdm_filter->hdmaInj->XferHalfCpltCallback = (hdfsdm_filter->hdmaInj->Init.Mode == DMA_CIRCULAR) ?\
2669  DFSDM_DMAInjectedHalfConvCplt : NULL;
2670 
2671  /* Start DMA in interrupt mode */
2672  if(HAL_DMA_Start_IT(hdfsdm_filter->hdmaInj, (uint32_t)&hdfsdm_filter->Instance->FLTJDATAR, \
2673  (uint32_t) pData, Length) != HAL_OK)
2674  {
2675  /* Set DFSDM filter in error state */
2676  hdfsdm_filter->State = HAL_DFSDM_FILTER_STATE_ERROR;
2677  status = HAL_ERROR;
2678  }
2679  else
2680  {
2681  /* Start injected conversion */
2682  DFSDM_InjConvStart(hdfsdm_filter);
2683  }
2684  }
2685  else
2686  {
2687  status = HAL_ERROR;
2688  }
2689  /* Return function status */
2690  return status;
2691 }
2692 
2706  int16_t *pData,
2707  uint32_t Length)
2708 {
2709  HAL_StatusTypeDef status = HAL_OK;
2710 
2711  /* Check parameters */
2713 
2714  /* Check destination address and length */
2715  if((pData == NULL) || (Length == 0U))
2716  {
2717  status = HAL_ERROR;
2718  }
2719  /* Check that DMA is enabled for injected conversion */
2720  else if((hdfsdm_filter->Instance->FLTCR1 & DFSDM_FLTCR1_JDMAEN) != DFSDM_FLTCR1_JDMAEN)
2721  {
2722  status = HAL_ERROR;
2723  }
2724  /* Check parameters compatibility */
2725  else if((hdfsdm_filter->InjectedTrigger == DFSDM_FILTER_SW_TRIGGER) && \
2726  (hdfsdm_filter->hdmaInj->Init.Mode == DMA_NORMAL) && \
2727  (Length > hdfsdm_filter->InjConvRemaining))
2728  {
2729  status = HAL_ERROR;
2730  }
2731  else if((hdfsdm_filter->InjectedTrigger == DFSDM_FILTER_SW_TRIGGER) && \
2732  (hdfsdm_filter->hdmaInj->Init.Mode == DMA_CIRCULAR))
2733  {
2734  status = HAL_ERROR;
2735  }
2736  /* Check DFSDM filter state */
2737  else if((hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_READY) || \
2738  (hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_REG))
2739  {
2740  /* Set callbacks on DMA handler */
2741  hdfsdm_filter->hdmaInj->XferCpltCallback = DFSDM_DMAInjectedConvCplt;
2742  hdfsdm_filter->hdmaInj->XferErrorCallback = DFSDM_DMAError;
2743  hdfsdm_filter->hdmaInj->XferHalfCpltCallback = (hdfsdm_filter->hdmaInj->Init.Mode == DMA_CIRCULAR) ?\
2744  DFSDM_DMAInjectedHalfConvCplt : NULL;
2745 
2746  /* Start DMA in interrupt mode */
2747  if(HAL_DMA_Start_IT(hdfsdm_filter->hdmaInj, (uint32_t)(&hdfsdm_filter->Instance->FLTJDATAR) + 2U, \
2748  (uint32_t) pData, Length) != HAL_OK)
2749  {
2750  /* Set DFSDM filter in error state */
2751  hdfsdm_filter->State = HAL_DFSDM_FILTER_STATE_ERROR;
2752  status = HAL_ERROR;
2753  }
2754  else
2755  {
2756  /* Start injected conversion */
2757  DFSDM_InjConvStart(hdfsdm_filter);
2758  }
2759  }
2760  else
2761  {
2762  status = HAL_ERROR;
2763  }
2764  /* Return function status */
2765  return status;
2766 }
2767 
2775 {
2776  HAL_StatusTypeDef status = HAL_OK;
2777 
2778  /* Check parameters */
2780 
2781  /* Check DFSDM filter state */
2782  if((hdfsdm_filter->State != HAL_DFSDM_FILTER_STATE_INJ) && \
2783  (hdfsdm_filter->State != HAL_DFSDM_FILTER_STATE_REG_INJ))
2784  {
2785  /* Return error status */
2786  status = HAL_ERROR;
2787  }
2788  else
2789  {
2790  /* Stop current DMA transfer */
2791  if(HAL_DMA_Abort(hdfsdm_filter->hdmaInj) != HAL_OK)
2792  {
2793  /* Set DFSDM filter in error state */
2794  hdfsdm_filter->State = HAL_DFSDM_FILTER_STATE_ERROR;
2795  status = HAL_ERROR;
2796  }
2797  else
2798  {
2799  /* Stop regular conversion */
2800  DFSDM_InjConvStop(hdfsdm_filter);
2801  }
2802  }
2803  /* Return function status */
2804  return status;
2805 }
2806 
2814  uint32_t *Channel)
2815 {
2816  uint32_t reg;
2817  int32_t value;
2818 
2819  /* Check parameters */
2821  assert_param(Channel != (void *)0);
2822 
2823  /* Get value of data register for injected channel */
2824  reg = hdfsdm_filter->Instance->FLTJDATAR;
2825 
2826  /* Extract channel and injected conversion value */
2827  *Channel = (reg & DFSDM_FLTJDATAR_JDATACH);
2828  /* Injected conversion value is a signed value located on 24 MSB of register */
2829  /* So after applying a mask on these bits we have to perform a division by 256 (2 raised to the power of 8) */
2830  reg &= DFSDM_FLTJDATAR_JDATA;
2831  value = ((int32_t)reg) / 256;
2832 
2833  /* return regular conversion value */
2834  return value;
2835 }
2836 
2844  DFSDM_Filter_AwdParamTypeDef *awdParam)
2845 {
2846  HAL_StatusTypeDef status = HAL_OK;
2847 
2848  /* Check parameters */
2856 
2857  /* Check DFSDM filter state */
2858  if((hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_RESET) || \
2859  (hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_ERROR))
2860  {
2861  /* Return error status */
2862  status = HAL_ERROR;
2863  }
2864  else
2865  {
2866  /* Set analog watchdog data source */
2867  hdfsdm_filter->Instance->FLTCR1 &= ~(DFSDM_FLTCR1_AWFSEL);
2868  hdfsdm_filter->Instance->FLTCR1 |= awdParam->DataSource;
2869 
2870  /* Set thresholds and break signals */
2872  hdfsdm_filter->Instance->FLTAWHTR |= (((uint32_t) awdParam->HighThreshold << DFSDM_FLTAWHTR_AWHT_Pos) | \
2873  awdParam->HighBreakSignal);
2875  hdfsdm_filter->Instance->FLTAWLTR |= (((uint32_t) awdParam->LowThreshold << DFSDM_FLTAWLTR_AWLT_Pos) | \
2876  awdParam->LowBreakSignal);
2877 
2878  /* Set channels and interrupt for analog watchdog */
2879  hdfsdm_filter->Instance->FLTCR2 &= ~(DFSDM_FLTCR2_AWDCH);
2880  hdfsdm_filter->Instance->FLTCR2 |= (((awdParam->Channel & DFSDM_LSB_MASK) << DFSDM_FLTCR2_AWDCH_Pos) | \
2881  DFSDM_FLTCR2_AWDIE);
2882  }
2883  /* Return function status */
2884  return status;
2885 }
2886 
2893 {
2894  HAL_StatusTypeDef status = HAL_OK;
2895 
2896  /* Check parameters */
2898 
2899  /* Check DFSDM filter state */
2900  if((hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_RESET) || \
2901  (hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_ERROR))
2902  {
2903  /* Return error status */
2904  status = HAL_ERROR;
2905  }
2906  else
2907  {
2908  /* Reset channels for analog watchdog and deactivate interrupt */
2909  hdfsdm_filter->Instance->FLTCR2 &= ~(DFSDM_FLTCR2_AWDCH | DFSDM_FLTCR2_AWDIE);
2910 
2911  /* Clear all analog watchdog flags */
2913 
2914  /* Reset thresholds and break signals */
2917 
2918  /* Reset analog watchdog data source */
2919  hdfsdm_filter->Instance->FLTCR1 &= ~(DFSDM_FLTCR1_AWFSEL);
2920  }
2921  /* Return function status */
2922  return status;
2923 }
2924 
2933  uint32_t Channel)
2934 {
2935  HAL_StatusTypeDef status = HAL_OK;
2936 
2937  /* Check parameters */
2940 
2941  /* Check DFSDM filter state */
2942  if((hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_RESET) || \
2943  (hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_ERROR))
2944  {
2945  /* Return error status */
2946  status = HAL_ERROR;
2947  }
2948  else
2949  {
2950  /* Set channels for extreme detector */
2951  hdfsdm_filter->Instance->FLTCR2 &= ~(DFSDM_FLTCR2_EXCH);
2952  hdfsdm_filter->Instance->FLTCR2 |= ((Channel & DFSDM_LSB_MASK) << DFSDM_FLTCR2_EXCH_Pos);
2953  }
2954  /* Return function status */
2955  return status;
2956 }
2957 
2964 {
2965  HAL_StatusTypeDef status = HAL_OK;
2966  __IO uint32_t reg1;
2967  __IO uint32_t reg2;
2968 
2969  /* Check parameters */
2971 
2972  /* Check DFSDM filter state */
2973  if((hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_RESET) || \
2974  (hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_ERROR))
2975  {
2976  /* Return error status */
2977  status = HAL_ERROR;
2978  }
2979  else
2980  {
2981  /* Reset channels for extreme detector */
2982  hdfsdm_filter->Instance->FLTCR2 &= ~(DFSDM_FLTCR2_EXCH);
2983 
2984  /* Clear extreme detector values */
2985  reg1 = hdfsdm_filter->Instance->FLTEXMAX;
2986  reg2 = hdfsdm_filter->Instance->FLTEXMIN;
2987  UNUSED(reg1); /* To avoid GCC warning */
2988  UNUSED(reg2); /* To avoid GCC warning */
2989  }
2990  /* Return function status */
2991  return status;
2992 }
2993 
3002  uint32_t *Channel)
3003 {
3004  uint32_t reg;
3005  int32_t value;
3006 
3007  /* Check parameters */
3009  assert_param(Channel != (void *)0);
3010 
3011  /* Get value of extreme detector maximum register */
3012  reg = hdfsdm_filter->Instance->FLTEXMAX;
3013 
3014  /* Extract channel and extreme detector maximum value */
3015  *Channel = (reg & DFSDM_FLTEXMAX_EXMAXCH);
3016  /* Extreme detector maximum value is a signed value located on 24 MSB of register */
3017  /* So after applying a mask on these bits we have to perform a division by 256 (2 raised to the power of 8) */
3018  reg &= DFSDM_FLTEXMAX_EXMAX;
3019  value = ((int32_t)reg) / 256;
3020 
3021  /* return extreme detector maximum value */
3022  return value;
3023 }
3024 
3033  uint32_t *Channel)
3034 {
3035  uint32_t reg;
3036  int32_t value;
3037 
3038  /* Check parameters */
3040  assert_param(Channel != (void *)0);
3041 
3042  /* Get value of extreme detector minimum register */
3043  reg = hdfsdm_filter->Instance->FLTEXMIN;
3044 
3045  /* Extract channel and extreme detector minimum value */
3046  *Channel = (reg & DFSDM_FLTEXMIN_EXMINCH);
3047  /* Extreme detector minimum value is a signed value located on 24 MSB of register */
3048  /* So after applying a mask on these bits we have to perform a division by 256 (2 raised to the power of 8) */
3049  reg &= DFSDM_FLTEXMIN_EXMIN;
3050  value = ((int32_t)reg) / 256;
3051 
3052  /* return extreme detector minimum value */
3053  return value;
3054 }
3055 
3063 {
3064  uint32_t reg;
3065  uint32_t value;
3066 
3067  /* Check parameters */
3069 
3070  /* Get value of conversion timer register */
3071  reg = hdfsdm_filter->Instance->FLTCNVTIMR;
3072 
3073  /* Extract conversion time value */
3075 
3076  /* return extreme detector minimum value */
3077  return value;
3078 }
3079 
3086 {
3087  DFSDM_Channel_HandleTypeDef **channelHandleTable;
3088  const DFSDM_Filter_TypeDef *filter0Instance;
3089  uint32_t channelNumber;
3090 
3091  /* Get FTLISR and FLTCR2 register values */
3092  const uint32_t temp_fltisr = hdfsdm_filter->Instance->FLTISR;
3093  const uint32_t temp_fltcr2 = hdfsdm_filter->Instance->FLTCR2;
3094 
3095 #if defined(DFSDM2_Channel0)
3096  if (IS_DFSDM1_FILTER_INSTANCE(hdfsdm_filter->Instance))
3097  {
3098  channelHandleTable = a_dfsdm1ChannelHandle;
3099  filter0Instance = DFSDM1_Filter0;
3100  channelNumber = DFSDM1_CHANNEL_NUMBER;
3101  }
3102  else
3103  {
3104  channelHandleTable = a_dfsdm2ChannelHandle;
3105  filter0Instance = DFSDM2_Filter0;
3106  channelNumber = DFSDM2_CHANNEL_NUMBER;
3107  }
3108 #else /* DFSDM2_Channel0 */
3109  channelHandleTable = a_dfsdm1ChannelHandle;
3110  filter0Instance = DFSDM1_Filter0;
3111  channelNumber = DFSDM1_CHANNEL_NUMBER;
3112 #endif /* DFSDM2_Channel0 */
3113 
3114  /* Check if overrun occurs during regular conversion */
3115  if(((temp_fltisr & DFSDM_FLTISR_ROVRF) != 0U) && \
3116  ((temp_fltcr2 & DFSDM_FLTCR2_ROVRIE) != 0U))
3117  {
3118  /* Clear regular overrun flag */
3119  hdfsdm_filter->Instance->FLTICR = DFSDM_FLTICR_CLRROVRF;
3120 
3121  /* Update error code */
3123 
3124  /* Call error callback */
3125 #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
3126  hdfsdm_filter->ErrorCallback(hdfsdm_filter);
3127 #else
3128  HAL_DFSDM_FilterErrorCallback(hdfsdm_filter);
3129 #endif
3130  }
3131  /* Check if overrun occurs during injected conversion */
3132  else if(((temp_fltisr & DFSDM_FLTISR_JOVRF) != 0U) && \
3133  ((temp_fltcr2 & DFSDM_FLTCR2_JOVRIE) != 0U))
3134  {
3135  /* Clear injected overrun flag */
3136  hdfsdm_filter->Instance->FLTICR = DFSDM_FLTICR_CLRJOVRF;
3137 
3138  /* Update error code */
3140 
3141  /* Call error callback */
3142 #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
3143  hdfsdm_filter->ErrorCallback(hdfsdm_filter);
3144 #else
3145  HAL_DFSDM_FilterErrorCallback(hdfsdm_filter);
3146 #endif
3147  }
3148  /* Check if end of regular conversion */
3149  else if(((temp_fltisr & DFSDM_FLTISR_REOCF) != 0U) && \
3150  ((temp_fltcr2 & DFSDM_FLTCR2_REOCIE) != 0U))
3151  {
3152  /* Call regular conversion complete callback */
3153 #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
3154  hdfsdm_filter->RegConvCpltCallback(hdfsdm_filter);
3155 #else
3156  HAL_DFSDM_FilterRegConvCpltCallback(hdfsdm_filter);
3157 #endif
3158 
3159  /* End of conversion if mode is not continuous and software trigger */
3160  if((hdfsdm_filter->RegularContMode == DFSDM_CONTINUOUS_CONV_OFF) && \
3161  (hdfsdm_filter->RegularTrigger == DFSDM_FILTER_SW_TRIGGER))
3162  {
3163  /* Disable interrupts for regular conversions */
3164  hdfsdm_filter->Instance->FLTCR2 &= ~(DFSDM_FLTCR2_REOCIE);
3165 
3166  /* Update DFSDM filter state */
3167  hdfsdm_filter->State = (hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_REG) ? \
3169  }
3170  }
3171  /* Check if end of injected conversion */
3172  else if(((temp_fltisr & DFSDM_FLTISR_JEOCF) != 0U) && \
3173  ((temp_fltcr2 & DFSDM_FLTCR2_JEOCIE) != 0U))
3174  {
3175  /* Call injected conversion complete callback */
3176 #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
3177  hdfsdm_filter->InjConvCpltCallback(hdfsdm_filter);
3178 #else
3179  HAL_DFSDM_FilterInjConvCpltCallback(hdfsdm_filter);
3180 #endif
3181 
3182  /* Update remaining injected conversions */
3183  hdfsdm_filter->InjConvRemaining--;
3184  if(hdfsdm_filter->InjConvRemaining == 0U)
3185  {
3186  /* End of conversion if trigger is software */
3187  if(hdfsdm_filter->InjectedTrigger == DFSDM_FILTER_SW_TRIGGER)
3188  {
3189  /* Disable interrupts for injected conversions */
3190  hdfsdm_filter->Instance->FLTCR2 &= ~(DFSDM_FLTCR2_JEOCIE);
3191 
3192  /* Update DFSDM filter state */
3193  hdfsdm_filter->State = (hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_INJ) ? \
3195  }
3196  /* end of injected sequence, reset the value */
3197  hdfsdm_filter->InjConvRemaining = (hdfsdm_filter->InjectedScanMode == ENABLE) ? \
3198  hdfsdm_filter->InjectedChannelsNbr : 1U;
3199  }
3200  }
3201  /* Check if analog watchdog occurs */
3202  else if(((temp_fltisr & DFSDM_FLTISR_AWDF) != 0U) && \
3203  ((temp_fltcr2 & DFSDM_FLTCR2_AWDIE) != 0U))
3204  {
3205  uint32_t reg;
3206  uint32_t threshold;
3207  uint32_t channel = 0;
3208 
3209  /* Get channel and threshold */
3210  reg = hdfsdm_filter->Instance->FLTAWSR;
3212  if(threshold == DFSDM_AWD_HIGH_THRESHOLD)
3213  {
3214  reg = reg >> DFSDM_FLTAWSR_AWHTF_Pos;
3215  }
3216  while (((reg & 1U) == 0U) && (channel < (channelNumber - 1U)))
3217  {
3218  channel++;
3219  reg = reg >> 1;
3220  }
3221  /* Clear analog watchdog flag */
3222  hdfsdm_filter->Instance->FLTAWCFR = (threshold == DFSDM_AWD_HIGH_THRESHOLD) ? \
3223  (1UL << (DFSDM_FLTAWSR_AWHTF_Pos + channel)) : \
3224  (1UL << channel);
3225 
3226  /* Call analog watchdog callback */
3227 #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
3228  hdfsdm_filter->AwdCallback(hdfsdm_filter, channel, threshold);
3229 #else
3230  HAL_DFSDM_FilterAwdCallback(hdfsdm_filter, channel, threshold);
3231 #endif
3232  }
3233  /* Check if clock absence occurs */
3234  else if((hdfsdm_filter->Instance == filter0Instance) && \
3235  ((temp_fltisr & DFSDM_FLTISR_CKABF) != 0U) && \
3236  ((temp_fltcr2 & DFSDM_FLTCR2_CKABIE) != 0U))
3237  {
3238  uint32_t reg;
3239  uint32_t channel = 0;
3240 
3241  reg = ((hdfsdm_filter->Instance->FLTISR & DFSDM_FLTISR_CKABF) >> DFSDM_FLTISR_CKABF_Pos);
3242 
3243  while (channel < channelNumber)
3244  {
3245  /* Check if flag is set and corresponding channel is enabled */
3246  if (((reg & 1U) != 0U) && (channelHandleTable[channel] != NULL))
3247  {
3248  /* Check clock absence has been enabled for this channel */
3249  if ((channelHandleTable[channel]->Instance->CHCFGR1 & DFSDM_CHCFGR1_CKABEN) != 0U)
3250  {
3251  /* Clear clock absence flag */
3252  hdfsdm_filter->Instance->FLTICR = (1UL << (DFSDM_FLTICR_CLRCKABF_Pos + channel));
3253 
3254  /* Call clock absence callback */
3255 #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
3256  channelHandleTable[channel]->CkabCallback(channelHandleTable[channel]);
3257 #else
3258  HAL_DFSDM_ChannelCkabCallback(channelHandleTable[channel]);
3259 #endif
3260  }
3261  }
3262  channel++;
3263  reg = reg >> 1;
3264  }
3265  }
3266  /* Check if short circuit detection occurs */
3267  else if((hdfsdm_filter->Instance == filter0Instance) && \
3268  ((temp_fltisr & DFSDM_FLTISR_SCDF) != 0U) && \
3269  ((temp_fltcr2 & DFSDM_FLTCR2_SCDIE) != 0U))
3270  {
3271  uint32_t reg;
3272  uint32_t channel = 0;
3273 
3274  /* Get channel */
3275  reg = ((hdfsdm_filter->Instance->FLTISR & DFSDM_FLTISR_SCDF) >> DFSDM_FLTISR_SCDF_Pos);
3276  while (((reg & 1U) == 0U) && (channel < (channelNumber - 1U)))
3277  {
3278  channel++;
3279  reg = reg >> 1;
3280  }
3281 
3282  /* Clear short circuit detection flag */
3283  hdfsdm_filter->Instance->FLTICR = (1UL << (DFSDM_FLTICR_CLRSCDF_Pos + channel));
3284 
3285  /* Call short circuit detection callback */
3286 #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
3287  channelHandleTable[channel]->ScdCallback(channelHandleTable[channel]);
3288 #else
3289  HAL_DFSDM_ChannelScdCallback(channelHandleTable[channel]);
3290 #endif
3291  }
3292 }
3293 
3302 {
3303  /* Prevent unused argument(s) compilation warning */
3304  UNUSED(hdfsdm_filter);
3305 
3306  /* NOTE : This function should not be modified, when the callback is needed,
3307  the HAL_DFSDM_FilterRegConvCpltCallback could be implemented in the user file.
3308  */
3309 }
3310 
3317 {
3318  /* Prevent unused argument(s) compilation warning */
3319  UNUSED(hdfsdm_filter);
3320 
3321  /* NOTE : This function should not be modified, when the callback is needed,
3322  the HAL_DFSDM_FilterRegConvHalfCpltCallback could be implemented in the user file.
3323  */
3324 }
3325 
3334 {
3335  /* Prevent unused argument(s) compilation warning */
3336  UNUSED(hdfsdm_filter);
3337 
3338  /* NOTE : This function should not be modified, when the callback is needed,
3339  the HAL_DFSDM_FilterInjConvCpltCallback could be implemented in the user file.
3340  */
3341 }
3342 
3349 {
3350  /* Prevent unused argument(s) compilation warning */
3351  UNUSED(hdfsdm_filter);
3352 
3353  /* NOTE : This function should not be modified, when the callback is needed,
3354  the HAL_DFSDM_FilterInjConvHalfCpltCallback could be implemented in the user file.
3355  */
3356 }
3357 
3365 __weak void HAL_DFSDM_FilterAwdCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter,
3366  uint32_t Channel, uint32_t Threshold)
3367 {
3368  /* Prevent unused argument(s) compilation warning */
3369  UNUSED(hdfsdm_filter);
3370  UNUSED(Channel);
3371  UNUSED(Threshold);
3372 
3373  /* NOTE : This function should not be modified, when the callback is needed,
3374  the HAL_DFSDM_FilterAwdCallback could be implemented in the user file.
3375  */
3376 }
3377 
3384 {
3385  /* Prevent unused argument(s) compilation warning */
3386  UNUSED(hdfsdm_filter);
3387 
3388  /* NOTE : This function should not be modified, when the callback is needed,
3389  the HAL_DFSDM_FilterErrorCallback could be implemented in the user file.
3390  */
3391 }
3392 
3417 {
3418  /* Return DFSDM filter handle state */
3419  return hdfsdm_filter->State;
3420 }
3421 
3428 {
3429  return hdfsdm_filter->ErrorCode;
3430 }
3431 
3439 /* End of exported functions -------------------------------------------------*/
3440 
3441 /* Private functions ---------------------------------------------------------*/
3451 static void DFSDM_DMARegularHalfConvCplt(DMA_HandleTypeDef *hdma)
3452 {
3453  /* Get DFSDM filter handle */
3454  DFSDM_Filter_HandleTypeDef *hdfsdm_filter = (DFSDM_Filter_HandleTypeDef*) ((DMA_HandleTypeDef*)hdma)->Parent;
3455 
3456  /* Call regular half conversion complete callback */
3457 #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
3458  hdfsdm_filter->RegConvHalfCpltCallback(hdfsdm_filter);
3459 #else
3461 #endif
3462 }
3463 
3469 static void DFSDM_DMARegularConvCplt(DMA_HandleTypeDef *hdma)
3470 {
3471  /* Get DFSDM filter handle */
3472  DFSDM_Filter_HandleTypeDef *hdfsdm_filter = (DFSDM_Filter_HandleTypeDef*) ((DMA_HandleTypeDef*)hdma)->Parent;
3473 
3474  /* Call regular conversion complete callback */
3475 #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
3476  hdfsdm_filter->RegConvCpltCallback(hdfsdm_filter);
3477 #else
3478  HAL_DFSDM_FilterRegConvCpltCallback(hdfsdm_filter);
3479 #endif
3480 }
3481 
3487 static void DFSDM_DMAInjectedHalfConvCplt(DMA_HandleTypeDef *hdma)
3488 {
3489  /* Get DFSDM filter handle */
3490  DFSDM_Filter_HandleTypeDef *hdfsdm_filter = (DFSDM_Filter_HandleTypeDef*) ((DMA_HandleTypeDef*)hdma)->Parent;
3491 
3492  /* Call injected half conversion complete callback */
3493 #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
3494  hdfsdm_filter->InjConvHalfCpltCallback(hdfsdm_filter);
3495 #else
3497 #endif
3498 }
3499 
3505 static void DFSDM_DMAInjectedConvCplt(DMA_HandleTypeDef *hdma)
3506 {
3507  /* Get DFSDM filter handle */
3508  DFSDM_Filter_HandleTypeDef *hdfsdm_filter = (DFSDM_Filter_HandleTypeDef*) ((DMA_HandleTypeDef*)hdma)->Parent;
3509 
3510  /* Call injected conversion complete callback */
3511 #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
3512  hdfsdm_filter->InjConvCpltCallback(hdfsdm_filter);
3513 #else
3514  HAL_DFSDM_FilterInjConvCpltCallback(hdfsdm_filter);
3515 #endif
3516 }
3517 
3523 static void DFSDM_DMAError(DMA_HandleTypeDef *hdma)
3524 {
3525  /* Get DFSDM filter handle */
3526  DFSDM_Filter_HandleTypeDef *hdfsdm_filter = (DFSDM_Filter_HandleTypeDef*) ((DMA_HandleTypeDef*)hdma)->Parent;
3527 
3528  /* Update error code */
3529  hdfsdm_filter->ErrorCode = DFSDM_FILTER_ERROR_DMA;
3530 
3531  /* Call error callback */
3532 #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
3533  hdfsdm_filter->ErrorCallback(hdfsdm_filter);
3534 #else
3535  HAL_DFSDM_FilterErrorCallback(hdfsdm_filter);
3536 #endif
3537 }
3538 
3544 static uint32_t DFSDM_GetInjChannelsNbr(uint32_t Channels)
3545 {
3546  uint32_t nbChannels = 0;
3547  uint32_t tmp;
3548 
3549  /* Get the number of channels from bitfield */
3550  tmp = (uint32_t)(Channels & DFSDM_LSB_MASK);
3551  while(tmp != 0U)
3552  {
3553  if((tmp & 1U) != 0U)
3554  {
3555  nbChannels++;
3556  }
3557  tmp = (uint32_t)(tmp >> 1);
3558  }
3559  return nbChannels;
3560 }
3561 
3567 static uint32_t DFSDM_GetChannelFromInstance(const DFSDM_Channel_TypeDef* Instance)
3568 {
3569  uint32_t channel;
3570 
3571  /* Get channel from instance */
3572  if(Instance == DFSDM1_Channel0)
3573  {
3574  channel = 0;
3575  }
3576 #if defined(DFSDM2_Channel0)
3577  else if (Instance == DFSDM2_Channel0)
3578  {
3579  channel = 0;
3580  }
3581  else if (Instance == DFSDM2_Channel1)
3582  {
3583  channel = 1;
3584  }
3585 #endif /* DFSDM2_Channel0 */
3586  else if(Instance == DFSDM1_Channel1)
3587  {
3588  channel = 1;
3589  }
3590  else if(Instance == DFSDM1_Channel2)
3591  {
3592  channel = 2;
3593  }
3594  else if(Instance == DFSDM1_Channel3)
3595  {
3596  channel = 3;
3597  }
3598  else if(Instance == DFSDM1_Channel4)
3599  {
3600  channel = 4;
3601  }
3602  else if(Instance == DFSDM1_Channel5)
3603  {
3604  channel = 5;
3605  }
3606  else if(Instance == DFSDM1_Channel6)
3607  {
3608  channel = 6;
3609  }
3610  else /* DFSDM1_Channel7 */
3611  {
3612  channel = 7;
3613  }
3614 
3615  return channel;
3616 }
3617 
3623 static void DFSDM_RegConvStart(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
3624 {
3625  /* Check regular trigger */
3626  if(hdfsdm_filter->RegularTrigger == DFSDM_FILTER_SW_TRIGGER)
3627  {
3628  /* Software start of regular conversion */
3629  hdfsdm_filter->Instance->FLTCR1 |= DFSDM_FLTCR1_RSWSTART;
3630  }
3631  else /* synchronous trigger */
3632  {
3633  /* Disable DFSDM filter */
3634  hdfsdm_filter->Instance->FLTCR1 &= ~(DFSDM_FLTCR1_DFEN);
3635 
3636  /* Set RSYNC bit in DFSDM_FLTCR1 register */
3637  hdfsdm_filter->Instance->FLTCR1 |= DFSDM_FLTCR1_RSYNC;
3638 
3639  /* Enable DFSDM filter */
3640  hdfsdm_filter->Instance->FLTCR1 |= DFSDM_FLTCR1_DFEN;
3641 
3642  /* If injected conversion was in progress, restart it */
3643  if(hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_INJ)
3644  {
3645  if(hdfsdm_filter->InjectedTrigger == DFSDM_FILTER_SW_TRIGGER)
3646  {
3647  hdfsdm_filter->Instance->FLTCR1 |= DFSDM_FLTCR1_JSWSTART;
3648  }
3649  /* Update remaining injected conversions */
3650  hdfsdm_filter->InjConvRemaining = (hdfsdm_filter->InjectedScanMode == ENABLE) ? \
3651  hdfsdm_filter->InjectedChannelsNbr : 1U;
3652  }
3653  }
3654  /* Update DFSDM filter state */
3655  hdfsdm_filter->State = (hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_READY) ? \
3657 }
3658 
3664 static void DFSDM_RegConvStop(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
3665 {
3666  /* Disable DFSDM filter */
3667  hdfsdm_filter->Instance->FLTCR1 &= ~(DFSDM_FLTCR1_DFEN);
3668 
3669  /* If regular trigger was synchronous, reset RSYNC bit in DFSDM_FLTCR1 register */
3670  if(hdfsdm_filter->RegularTrigger == DFSDM_FILTER_SYNC_TRIGGER)
3671  {
3672  hdfsdm_filter->Instance->FLTCR1 &= ~(DFSDM_FLTCR1_RSYNC);
3673  }
3674 
3675  /* Enable DFSDM filter */
3676  hdfsdm_filter->Instance->FLTCR1 |= DFSDM_FLTCR1_DFEN;
3677 
3678  /* If injected conversion was in progress, restart it */
3679  if(hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_REG_INJ)
3680  {
3681  if(hdfsdm_filter->InjectedTrigger == DFSDM_FILTER_SW_TRIGGER)
3682  {
3683  hdfsdm_filter->Instance->FLTCR1 |= DFSDM_FLTCR1_JSWSTART;
3684  }
3685  /* Update remaining injected conversions */
3686  hdfsdm_filter->InjConvRemaining = (hdfsdm_filter->InjectedScanMode == ENABLE) ? \
3687  hdfsdm_filter->InjectedChannelsNbr : 1U;
3688  }
3689 
3690  /* Update DFSDM filter state */
3691  hdfsdm_filter->State = (hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_REG) ? \
3693 }
3694 
3700 static void DFSDM_InjConvStart(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
3701 {
3702  /* Check injected trigger */
3703  if(hdfsdm_filter->InjectedTrigger == DFSDM_FILTER_SW_TRIGGER)
3704  {
3705  /* Software start of injected conversion */
3706  hdfsdm_filter->Instance->FLTCR1 |= DFSDM_FLTCR1_JSWSTART;
3707  }
3708  else /* external or synchronous trigger */
3709  {
3710  /* Disable DFSDM filter */
3711  hdfsdm_filter->Instance->FLTCR1 &= ~(DFSDM_FLTCR1_DFEN);
3712 
3713  if(hdfsdm_filter->InjectedTrigger == DFSDM_FILTER_SYNC_TRIGGER)
3714  {
3715  /* Set JSYNC bit in DFSDM_FLTCR1 register */
3716  hdfsdm_filter->Instance->FLTCR1 |= DFSDM_FLTCR1_JSYNC;
3717  }
3718  else /* external trigger */
3719  {
3720  /* Set JEXTEN[1:0] bits in DFSDM_FLTCR1 register */
3721  hdfsdm_filter->Instance->FLTCR1 |= hdfsdm_filter->ExtTriggerEdge;
3722  }
3723 
3724  /* Enable DFSDM filter */
3725  hdfsdm_filter->Instance->FLTCR1 |= DFSDM_FLTCR1_DFEN;
3726 
3727  /* If regular conversion was in progress, restart it */
3728  if((hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_REG) && \
3729  (hdfsdm_filter->RegularTrigger == DFSDM_FILTER_SW_TRIGGER))
3730  {
3731  hdfsdm_filter->Instance->FLTCR1 |= DFSDM_FLTCR1_RSWSTART;
3732  }
3733  }
3734  /* Update DFSDM filter state */
3735  hdfsdm_filter->State = (hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_READY) ? \
3737 }
3738 
3744 static void DFSDM_InjConvStop(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
3745 {
3746  /* Disable DFSDM filter */
3747  hdfsdm_filter->Instance->FLTCR1 &= ~(DFSDM_FLTCR1_DFEN);
3748 
3749  /* If injected trigger was synchronous, reset JSYNC bit in DFSDM_FLTCR1 register */
3750  if(hdfsdm_filter->InjectedTrigger == DFSDM_FILTER_SYNC_TRIGGER)
3751  {
3752  hdfsdm_filter->Instance->FLTCR1 &= ~(DFSDM_FLTCR1_JSYNC);
3753  }
3754  else if(hdfsdm_filter->InjectedTrigger == DFSDM_FILTER_EXT_TRIGGER)
3755  {
3756  /* Reset JEXTEN[1:0] bits in DFSDM_FLTCR1 register */
3757  hdfsdm_filter->Instance->FLTCR1 &= ~(DFSDM_FLTCR1_JEXTEN);
3758  }
3759  else
3760  {
3761  /* Nothing to do */
3762  }
3763 
3764  /* Enable DFSDM filter */
3765  hdfsdm_filter->Instance->FLTCR1 |= DFSDM_FLTCR1_DFEN;
3766 
3767  /* If regular conversion was in progress, restart it */
3768  if((hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_REG_INJ) && \
3769  (hdfsdm_filter->RegularTrigger == DFSDM_FILTER_SW_TRIGGER))
3770  {
3771  hdfsdm_filter->Instance->FLTCR1 |= DFSDM_FLTCR1_RSWSTART;
3772  }
3773 
3774  /* Update remaining injected conversions */
3775  hdfsdm_filter->InjConvRemaining = (hdfsdm_filter->InjectedScanMode == ENABLE) ? \
3776  hdfsdm_filter->InjectedChannelsNbr : 1U;
3777 
3778  /* Update DFSDM filter state */
3779  hdfsdm_filter->State = (hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_INJ) ? \
3780  HAL_DFSDM_FILTER_STATE_READY : HAL_DFSDM_FILTER_STATE_REG;
3781 }
3782 
3786 /* End of private functions --------------------------------------------------*/
3787 
3792 #endif /* HAL_DFSDM_MODULE_ENABLED */
3793 
3798 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
DFSDM_Filter_TypeDef::FLTAWLTR
__IO uint32_t FLTAWLTR
Definition: stm32f769xx.h:363
assert_param
#define assert_param(expr)
Include module's header file.
Definition: stm32f407/stm32f407g-disc1/Inc/stm32f4xx_hal_conf.h:353
HAL_DFSDM_FilterPollForInjConversion
HAL_StatusTypeDef HAL_DFSDM_FilterPollForInjConversion(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t Timeout)
IS_DFSDM_FILTER_OVS_RATIO
#define IS_DFSDM_FILTER_OVS_RATIO(RATIO)
Definition: stm32h7xx_hal_dfsdm.h:819
DFSDM_CHCFGR1_CKOUTSRC
#define DFSDM_CHCFGR1_CKOUTSRC
Definition: stm32f769xx.h:6114
DFSDM_FLTCR1_RSWSTART
#define DFSDM_FLTCR1_RSWSTART
Definition: stm32f769xx.h:6211
__IO
#define __IO
Definition: imxrt1050/imxrt1050-evkb/CMSIS/core_cm7.h:237
HAL_StatusTypeDef
HAL_StatusTypeDef
HAL Status structures definition
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_def.h:40
IS_DFSDM_FILTER_REG_TRIGGER
#define IS_DFSDM_FILTER_REG_TRIGGER(TRIG)
Definition: stm32h7xx_hal_dfsdm.h:752
IS_DFSDM_CONTINUOUS_MODE
#define IS_DFSDM_CONTINUOUS_MODE(MODE)
Definition: stm32h7xx_hal_dfsdm.h:834
DFSDM_Channel_TypeDef::CHCFGR1
__IO uint32_t CHCFGR1
Definition: stm32f769xx.h:376
DFSDM_FLTCR2_SCDIE
#define DFSDM_FLTCR2_SCDIE
Definition: stm32f769xx.h:6253
DFSDM_CONTINUOUS_CONV_ON
#define DFSDM_CONTINUOUS_CONV_ON
Definition: stm32h7xx_hal_dfsdm.h:501
IS_DFSDM_BREAK_SIGNALS
#define IS_DFSDM_BREAK_SIGNALS(VALUE)
Definition: stm32h7xx_hal_dfsdm.h:824
DFSDM_Channel_InitTypeDef::OutputClock
DFSDM_Channel_OutputClockTypeDef OutputClock
Definition: stm32h7xx_hal_dfsdm.h:106
DFSDM_FLTICR_CLRSCDF_Pos
#define DFSDM_FLTICR_CLRSCDF_Pos
Definition: stm32f769xx.h:6300
DFSDM_FLTCR2_REOCIE
#define DFSDM_FLTCR2_REOCIE
Definition: stm32f769xx.h:6265
DFSDM_Filter_AwdParamTypeDef::DataSource
uint32_t DataSource
Definition: stm32h7xx_hal_dfsdm.h:256
DFSDM_FLTCR2_AWDCH_Pos
#define DFSDM_FLTCR2_AWDCH_Pos
Definition: stm32f769xx.h:6242
DFSDM_Channel_InputTypeDef::DataPacking
uint32_t DataPacking
Definition: stm32h7xx_hal_dfsdm.h:73
__DMA_HandleTypeDef::XferHalfCpltCallback
void(* XferHalfCpltCallback)(struct __DMA_HandleTypeDef *hdma)
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:153
DFSDM_FLTAWCFR_CLRAWLTF
#define DFSDM_FLTAWCFR_CLRAWLTF
Definition: stm32f769xx.h:6381
DFSDM_FLTAWSR_AWHTF_Pos
#define DFSDM_FLTAWSR_AWHTF_Pos
Definition: stm32f769xx.h:6368
__DMA_HandleTypeDef
DMA handle Structure definition.
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:139
NULL
#define NULL
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/extras/speex_resampler/thirdparty/resample.c:92
DFSDM_FLTCNVTIMR_CNVCNT
#define DFSDM_FLTCNVTIMR_CNVCNT
Definition: stm32f769xx.h:6402
HAL_DFSDM_FilterGetExdMaxValue
int32_t HAL_DFSDM_FilterGetExdMaxValue(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t *Channel)
HAL_DFSDM_FilterDeInit
HAL_StatusTypeDef HAL_DFSDM_FilterDeInit(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
IS_DFSDM_REGULAR_CHANNEL
#define IS_DFSDM_REGULAR_CHANNEL(CHANNEL)
Definition: stm32h7xx_hal_dfsdm.h:825
DFSDM_CHCFGR1_CHINSEL
#define DFSDM_CHCFGR1_CHINSEL
Definition: stm32f769xx.h:6130
IS_DFSDM_CHANNEL_INPUT_PINS
#define IS_DFSDM_CHANNEL_INPUT_PINS(PINS)
Definition: stm32h7xx_hal_dfsdm.h:734
HAL_DFSDM_FilterInit
HAL_StatusTypeDef HAL_DFSDM_FilterInit(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
DFSDM1_Channel5
#define DFSDM1_Channel5
Definition: stm32f769xx.h:1668
HAL_DFSDM_FILTER_STATE_REG
@ HAL_DFSDM_FILTER_STATE_REG
Definition: stm32h7xx_hal_dfsdm.h:161
IS_DFSDM_CHANNEL_ALL_INSTANCE
#define IS_DFSDM_CHANNEL_ALL_INSTANCE(INSTANCE)
Definition: stm32f769xx.h:21512
DFSDM_FLTCR1_JSCAN
#define DFSDM_FLTCR1_JSCAN
Definition: stm32f769xx.h:6230
DFSDM_FLTICR_CLRCKABF_Pos
#define DFSDM_FLTICR_CLRCKABF_Pos
Definition: stm32f769xx.h:6303
DFSDM_Filter_RegularParamTypeDef::DmaMode
FunctionalState DmaMode
Definition: stm32h7xx_hal_dfsdm.h:175
DFSDM_Filter_TypeDef::FLTAWCFR
__IO uint32_t FLTAWCFR
Definition: stm32f769xx.h:365
DFSDM_Filter_TypeDef::FLTISR
__IO uint32_t FLTISR
Definition: stm32f769xx.h:356
DFSDM_CONTINUOUS_CONV_OFF
#define DFSDM_CONTINUOUS_CONV_OFF
Definition: stm32h7xx_hal_dfsdm.h:500
HAL_DFSDM_FILTER_STATE_REG_INJ
@ HAL_DFSDM_FILTER_STATE_REG_INJ
Definition: stm32h7xx_hal_dfsdm.h:163
DFSDM_Filter_HandleTypeDef::hdmaInj
DMA_HandleTypeDef * hdmaInj
Definition: stm32h7xx_hal_dfsdm.h:228
DFSDM_CHAWSCDR_BKSCD_Pos
#define DFSDM_CHAWSCDR_BKSCD_Pos
Definition: stm32f769xx.h:6168
IS_DFSDM_CHANNEL_SCD_THRESHOLD
#define IS_DFSDM_CHANNEL_SCD_THRESHOLD(VALUE)
Definition: stm32h7xx_hal_dfsdm.h:751
HAL_DFSDM_ChannelCkabStart_IT
HAL_StatusTypeDef HAL_DFSDM_ChannelCkabStart_IT(DFSDM_Channel_HandleTypeDef *hdfsdm_channel)
DFSDM_Filter_TypeDef::FLTCR2
__IO uint32_t FLTCR2
Definition: stm32f769xx.h:355
HAL_DFSDM_ChannelScdCallback
void HAL_DFSDM_ChannelScdCallback(DFSDM_Channel_HandleTypeDef *hdfsdm_channel)
DFSDM_Channel_InitTypeDef::SerialInterface
DFSDM_Channel_SerialInterfaceTypeDef SerialInterface
Definition: stm32h7xx_hal_dfsdm.h:108
DFSDM_Channel_AwdTypeDef::FilterOrder
uint32_t FilterOrder
Definition: stm32h7xx_hal_dfsdm.h:95
DFSDM_FLTCR1_DFEN
#define DFSDM_FLTCR1_DFEN
Definition: stm32f769xx.h:6239
IS_DFSDM_CHANNEL_RIGHT_BIT_SHIFT
#define IS_DFSDM_CHANNEL_RIGHT_BIT_SHIFT(VALUE)
Definition: stm32h7xx_hal_dfsdm.h:750
DFSDM_Filter_TypeDef::FLTEXMIN
__IO uint32_t FLTEXMIN
Definition: stm32f769xx.h:367
IS_DFSDM_CHANNEL_OUTPUT_CLOCK_DIVIDER
#define IS_DFSDM_CHANNEL_OUTPUT_CLOCK_DIVIDER(DIVIDER)
Definition: stm32h7xx_hal_dfsdm.h:727
DFSDM_FLTEXMIN_EXMINCH
#define DFSDM_FLTEXMIN_EXMINCH
Definition: stm32f769xx.h:6397
DFSDM_FLTCR1_JDMAEN
#define DFSDM_FLTCR1_JDMAEN
Definition: stm32f769xx.h:6227
HAL_DFSDM_FilterRegularStart_IT
HAL_StatusTypeDef HAL_DFSDM_FilterRegularStart_IT(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
HAL_DFSDM_FilterGetState
HAL_DFSDM_Filter_StateTypeDef HAL_DFSDM_FilterGetState(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
HAL_DFSDM_ChannelGetState
HAL_DFSDM_Channel_StateTypeDef HAL_DFSDM_ChannelGetState(DFSDM_Channel_HandleTypeDef *hdfsdm_channel)
DFSDM_FILTER_EXT_TRIGGER
#define DFSDM_FILTER_EXT_TRIGGER
Definition: stm32h7xx_hal_dfsdm.h:378
DFSDM_Channel_InitTypeDef::Offset
int32_t Offset
Definition: stm32h7xx_hal_dfsdm.h:110
DFSDM_FILTER_ERROR_DMA
#define DFSDM_FILTER_ERROR_DMA
Definition: stm32h7xx_hal_dfsdm.h:454
DFSDM_Channel_SerialInterfaceTypeDef::Type
uint32_t Type
Definition: stm32h7xx_hal_dfsdm.h:84
__DMA_HandleTypeDef::Init
DMA_InitTypeDef Init
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:143
DFSDM_Filter_InjectedParamTypeDef::DmaMode
FunctionalState DmaMode
Definition: stm32h7xx_hal_dfsdm.h:186
DFSDM_FLTCR1_JEXTSEL
#define DFSDM_FLTCR1_JEXTSEL
Definition: stm32f769xx.h:6219
HAL_ERROR
@ HAL_ERROR
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_def.h:43
HAL_DFSDM_ChannelMspInit
void HAL_DFSDM_ChannelMspInit(DFSDM_Channel_HandleTypeDef *hdfsdm_channel)
DFSDM_Channel MSP Initialization This function configures the hardware resources used in this example...
Definition: stm32h7xx_hal_msp.c:207
DFSDM_CHCFGR2_DTRBS
#define DFSDM_CHCFGR2_DTRBS
Definition: stm32f769xx.h:6157
IS_DFSDM_FILTER_INTEGRATOR_OVS_RATIO
#define IS_DFSDM_FILTER_INTEGRATOR_OVS_RATIO(RATIO)
Definition: stm32h7xx_hal_dfsdm.h:820
DFSDM_FLTAWLTR_AWLT_Pos
#define DFSDM_FLTAWLTR_AWLT_Pos
Definition: stm32f769xx.h:6360
DFSDM_FLTCR2_AWDIE
#define DFSDM_FLTCR2_AWDIE
Definition: stm32f769xx.h:6256
HAL_GetTick
uint32_t HAL_GetTick(void)
Provides a tick value in millisecond.
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c:323
DFSDM1_Channel0
#define DFSDM1_Channel0
Definition: stm32f769xx.h:1663
DFSDM_FLTCR2_ROVRIE
#define DFSDM_FLTCR2_ROVRIE
Definition: stm32f769xx.h:6259
DMA_CIRCULAR
#define DMA_CIRCULAR
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:282
DFSDM_Filter_HandleTypeDef::RegularTrigger
uint32_t RegularTrigger
Definition: stm32h7xx_hal_dfsdm.h:230
HAL_DFSDM_ChannelGetAwdValue
int16_t HAL_DFSDM_ChannelGetAwdValue(DFSDM_Channel_HandleTypeDef *hdfsdm_channel)
HAL_DFSDM_ChannelModifyOffset
HAL_StatusTypeDef HAL_DFSDM_ChannelModifyOffset(DFSDM_Channel_HandleTypeDef *hdfsdm_channel, int32_t Offset)
HAL_DFSDM_FILTER_STATE_INJ
@ HAL_DFSDM_FILTER_STATE_INJ
Definition: stm32h7xx_hal_dfsdm.h:162
HAL_DFSDM_ChannelScdStop
HAL_StatusTypeDef HAL_DFSDM_ChannelScdStop(DFSDM_Channel_HandleTypeDef *hdfsdm_channel)
DFSDM_FLTAWHTR_AWHT_Pos
#define DFSDM_FLTAWHTR_AWHT_Pos
Definition: stm32f769xx.h:6352
DFSDM_Filter_TypeDef::FLTAWHTR
__IO uint32_t FLTAWHTR
Definition: stm32f769xx.h:362
DFSDM1_Filter0
#define DFSDM1_Filter0
Definition: stm32f769xx.h:1671
DFSDM_CHCFGR1_DFSDMEN
#define DFSDM_CHCFGR1_DFSDMEN
Definition: stm32f769xx.h:6111
HAL_DFSDM_FilterMspDeInit
void HAL_DFSDM_FilterMspDeInit(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
DFSDM_Filter MSP De-Initialization This function freeze the hardware resources used in this example.
Definition: stm32h7xx_hal_msp.c:257
DFSDM_FILTER_ERROR_REGULAR_OVERRUN
#define DFSDM_FILTER_ERROR_REGULAR_OVERRUN
Definition: stm32h7xx_hal_dfsdm.h:452
HAL_DFSDM_FilterInjectedStart_DMA
HAL_StatusTypeDef HAL_DFSDM_FilterInjectedStart_DMA(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, int32_t *pData, uint32_t Length)
DFSDM_AWD_LOW_THRESHOLD
#define DFSDM_AWD_LOW_THRESHOLD
Definition: stm32h7xx_hal_dfsdm.h:510
DFSDM_FLTCR1_JSYNC
#define DFSDM_FLTCR1_JSYNC
Definition: stm32f769xx.h:6233
IS_DFSDM_FILTER_ALL_INSTANCE
#define IS_DFSDM_FILTER_ALL_INSTANCE(INSTANCE)
Definition: stm32f769xx.h:21507
DFSDM_FLTCR1_AWFSEL
#define DFSDM_FLTCR1_AWFSEL
Definition: stm32f769xx.h:6193
HAL_DFSDM_FilterGetInjectedValue
int32_t HAL_DFSDM_FilterGetInjectedValue(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t *Channel)
ENABLE
@ ENABLE
Definition: stm32f407/stm32f407g-disc1/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h:194
HAL_DFSDM_FilterPollForRegConversion
HAL_StatusTypeDef HAL_DFSDM_FilterPollForRegConversion(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t Timeout)
HAL_DFSDM_ChannelPollForCkab
HAL_StatusTypeDef HAL_DFSDM_ChannelPollForCkab(DFSDM_Channel_HandleTypeDef *hdfsdm_channel, uint32_t Timeout)
DFSDM_Filter_AwdParamTypeDef::Channel
uint32_t Channel
Definition: stm32h7xx_hal_dfsdm.h:258
DFSDM_FLTISR_REOCF
#define DFSDM_FLTISR_REOCF
Definition: stm32f769xx.h:6294
DFSDM_CHCFGR1_SCDEN
#define DFSDM_CHCFGR1_SCDEN
Definition: stm32f769xx.h:6139
HAL_DFSDM_FilterInjConvHalfCpltCallback
void HAL_DFSDM_FilterInjConvHalfCpltCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
DFSDM_FLTCR2_AWDCH
#define DFSDM_FLTCR2_AWDCH
Definition: stm32f769xx.h:6244
HAL_OK
@ HAL_OK
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_def.h:42
IS_DFSDM_FILTER_EXT_TRIG
#define IS_DFSDM_FILTER_EXT_TRIG(TRIG)
Definition: stm32h7xx_hal_dfsdm.h:793
HAL_DFSDM_FilterRegularMsbStart_DMA
HAL_StatusTypeDef HAL_DFSDM_FilterRegularMsbStart_DMA(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, int16_t *pData, uint32_t Length)
DFSDM_FLTFCR_IOSR
#define DFSDM_FLTFCR_IOSR
Definition: stm32f769xx.h:6330
HAL_DFSDM_Channel_StateTypeDef
HAL_DFSDM_Channel_StateTypeDef
HAL DFSDM Channel states definition.
Definition: stm32h7xx_hal_dfsdm.h:47
DFSDM_FLTCR1_RDMAEN
#define DFSDM_FLTCR1_RDMAEN
Definition: stm32f769xx.h:6202
HAL_DFSDM_FilterRegularStop_DMA
HAL_StatusTypeDef HAL_DFSDM_FilterRegularStop_DMA(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
DFSDM_Filter_HandleTypeDef
DFSDM filter handle structure definition.
Definition: stm32h7xx_hal_dfsdm.h:222
DFSDM_Channel_HandleTypeDef::State
HAL_DFSDM_Channel_StateTypeDef State
Definition: stm32h7xx_hal_dfsdm.h:127
DFSDM_Filter_TypeDef::FLTEXMAX
__IO uint32_t FLTEXMAX
Definition: stm32f769xx.h:366
IS_FUNCTIONAL_STATE
#define IS_FUNCTIONAL_STATE(STATE)
Definition: stm32f407/stm32f407g-disc1/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h:196
HAL_DFSDM_FilterRegularStop_IT
HAL_StatusTypeDef HAL_DFSDM_FilterRegularStop_IT(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
DFSDM_Filter_HandleTypeDef::ErrorCode
uint32_t ErrorCode
Definition: stm32h7xx_hal_dfsdm.h:237
DFSDM_Filter_TypeDef::FLTRDATAR
__IO uint32_t FLTRDATAR
Definition: stm32f769xx.h:361
IS_DFSDM_CHANNEL_INPUT
#define IS_DFSDM_CHANNEL_INPUT(INPUT)
Definition: stm32h7xx_hal_dfsdm.h:728
HAL_DFSDM_FilterInjectedStop_IT
HAL_StatusTypeDef HAL_DFSDM_FilterInjectedStop_IT(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
UNUSED
#define UNUSED(x)
Definition: porcupine/demo/c/dr_libs/old/dr.h:92
DFSDM_Channel_HandleTypeDef::Instance
DFSDM_Channel_TypeDef * Instance
Definition: stm32h7xx_hal_dfsdm.h:125
DFSDM_FLTCR2_JOVRIE
#define DFSDM_FLTCR2_JOVRIE
Definition: stm32f769xx.h:6262
DFSDM_Filter_HandleTypeDef::RegularContMode
uint32_t RegularContMode
Definition: stm32h7xx_hal_dfsdm.h:229
DFSDM_FLTCR1_JSWSTART
#define DFSDM_FLTCR1_JSWSTART
Definition: stm32f769xx.h:6236
DFSDM_Filter_HandleTypeDef::hdmaReg
DMA_HandleTypeDef * hdmaReg
Definition: stm32h7xx_hal_dfsdm.h:227
DFSDM_CHCFGR1_CKOUTDIV_Pos
#define DFSDM_CHCFGR1_CKOUTDIV_Pos
Definition: stm32f769xx.h:6115
HAL_DFSDM_FilterAwdStop_IT
HAL_StatusTypeDef HAL_DFSDM_FilterAwdStop_IT(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
HAL_DFSDM_ChannelCkabStop_IT
HAL_StatusTypeDef HAL_DFSDM_ChannelCkabStop_IT(DFSDM_Channel_HandleTypeDef *hdfsdm_channel)
DFSDM_Filter_HandleTypeDef::State
HAL_DFSDM_Filter_StateTypeDef State
Definition: stm32h7xx_hal_dfsdm.h:236
DFSDM_CHCFGR2_OFFSET
#define DFSDM_CHCFGR2_OFFSET
Definition: stm32f769xx.h:6154
DFSDM_FLTCR2_EXCH
#define DFSDM_FLTCR2_EXCH
Definition: stm32f769xx.h:6247
DFSDM_Filter_HandleTypeDef::Instance
DFSDM_Filter_TypeDef * Instance
Definition: stm32h7xx_hal_dfsdm.h:225
IS_DFSDM_FILTER_AWD_DATA_SOURCE
#define IS_DFSDM_FILTER_AWD_DATA_SOURCE(DATA)
Definition: stm32h7xx_hal_dfsdm.h:821
HAL_DFSDM_FilterRegularStart_DMA
HAL_StatusTypeDef HAL_DFSDM_FilterRegularStart_DMA(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, int32_t *pData, uint32_t Length)
HAL_DFSDM_FilterRegularStart
HAL_StatusTypeDef HAL_DFSDM_FilterRegularStart(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
DFSDM_FLTCR2_JEOCIE
#define DFSDM_FLTCR2_JEOCIE
Definition: stm32f769xx.h:6268
DFSDM_CHCFGR2_OFFSET_Pos
#define DFSDM_CHCFGR2_OFFSET_Pos
Definition: stm32f769xx.h:6152
DFSDM_Filter_HandleTypeDef::ExtTriggerEdge
uint32_t ExtTriggerEdge
Definition: stm32h7xx_hal_dfsdm.h:232
DFSDM_FLTAWLTR_AWLT
#define DFSDM_FLTAWLTR_AWLT
Definition: stm32f769xx.h:6362
DFSDM_Filter_FilterParamTypeDef::Oversampling
uint32_t Oversampling
Definition: stm32h7xx_hal_dfsdm.h:200
HAL_DFSDM_FilterGetExdMinValue
int32_t HAL_DFSDM_FilterGetExdMinValue(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t *Channel)
DFSDM_CHAWSCDR_AWFOSR
#define DFSDM_CHAWSCDR_AWFOSR
Definition: stm32f769xx.h:6167
DFSDM_Channel_InitTypeDef::Awd
DFSDM_Channel_AwdTypeDef Awd
Definition: stm32h7xx_hal_dfsdm.h:109
DFSDM_FLTAWHTR_BKAWH
#define DFSDM_FLTAWHTR_BKAWH
Definition: stm32f769xx.h:6357
HAL_DFSDM_FilterGetError
uint32_t HAL_DFSDM_FilterGetError(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
HAL_DFSDM_ChannelScdStop_IT
HAL_StatusTypeDef HAL_DFSDM_ChannelScdStop_IT(DFSDM_Channel_HandleTypeDef *hdfsdm_channel)
DFSDM_FLTRDATAR_RDATACH
#define DFSDM_FLTRDATAR_RDATACH
Definition: stm32f769xx.h:6349
DFSDM_Channel_TypeDef
DFSDM channel configuration registers.
Definition: stm32f769xx.h:374
HAL_DFSDM_ChannelMspDeInit
void HAL_DFSDM_ChannelMspDeInit(DFSDM_Channel_HandleTypeDef *hdfsdm_channel)
DFSDM_Channel MSP De-Initialization This function freeze the hardware resources used in this example.
Definition: stm32h7xx_hal_msp.c:290
DFSDM_FLTCR1_FAST
#define DFSDM_FLTCR1_FAST
Definition: stm32f769xx.h:6196
HAL_DFSDM_FilterGetConvTimeValue
uint32_t HAL_DFSDM_FilterGetConvTimeValue(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
HAL_DFSDM_ChannelDeInit
HAL_StatusTypeDef HAL_DFSDM_ChannelDeInit(DFSDM_Channel_HandleTypeDef *hdfsdm_channel)
DFSDM_Filter_InjectedParamTypeDef::Trigger
uint32_t Trigger
Definition: stm32h7xx_hal_dfsdm.h:183
DFSDM_FLTCR1_RCH
#define DFSDM_FLTCR1_RCH
Definition: stm32f769xx.h:6199
DFSDM_Channel_AwdTypeDef::Oversampling
uint32_t Oversampling
Definition: stm32h7xx_hal_dfsdm.h:97
DFSDM_Filter_TypeDef::FLTICR
__IO uint32_t FLTICR
Definition: stm32f769xx.h:357
DFSDM1_Channel4
#define DFSDM1_Channel4
Definition: stm32f769xx.h:1667
DFSDM_FLTAWHTR_AWHT
#define DFSDM_FLTAWHTR_AWHT
Definition: stm32f769xx.h:6354
DFSDM_FILTER_ERROR_INJECTED_OVERRUN
#define DFSDM_FILTER_ERROR_INJECTED_OVERRUN
Definition: stm32h7xx_hal_dfsdm.h:453
HAL_DFSDM_FilterRegConvCpltCallback
void HAL_DFSDM_FilterRegConvCpltCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
Regular conversion complete callback.
Definition: stm32f769i_discovery_audio.c:1441
HAL_DMA_Start_IT
HAL_StatusTypeDef HAL_DMA_Start_IT(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t DataLength)
DFSDM_Filter_InjectedParamTypeDef::ExtTriggerEdge
uint32_t ExtTriggerEdge
Definition: stm32h7xx_hal_dfsdm.h:189
DFSDM_Filter_HandleTypeDef::InjectedScanMode
FunctionalState InjectedScanMode
Definition: stm32h7xx_hal_dfsdm.h:233
DFSDM_FLTAWCFR_CLRAWHTF
#define DFSDM_FLTAWCFR_CLRAWHTF
Definition: stm32f769xx.h:6378
IS_DFSDM_CHANNEL_FILTER_ORDER
#define IS_DFSDM_CHANNEL_FILTER_ORDER(ORDER)
Definition: stm32h7xx_hal_dfsdm.h:744
DFSDM_FLTISR_SCDF
#define DFSDM_FLTISR_SCDF
Definition: stm32f769xx.h:6273
DFSDM_CHCFGR1_SPICKSEL
#define DFSDM_CHCFGR1_SPICKSEL
Definition: stm32f769xx.h:6142
HAL_DFSDM_ChannelInit
HAL_StatusTypeDef HAL_DFSDM_ChannelInit(DFSDM_Channel_HandleTypeDef *hdfsdm_channel)
DFSDM1_Channel6
#define DFSDM1_Channel6
Definition: stm32f769xx.h:1669
DFSDM_FLTICR_CLRROVRF
#define DFSDM_FLTICR_CLRROVRF
Definition: stm32f769xx.h:6308
DFSDM_FILTER_ERROR_NONE
#define DFSDM_FILTER_ERROR_NONE
Definition: stm32h7xx_hal_dfsdm.h:451
DFSDM_CHCFGR1_CKOUTDIV
#define DFSDM_CHCFGR1_CKOUTDIV
Definition: stm32f769xx.h:6117
DFSDM_Filter_AwdParamTypeDef
DFSDM filter analog watchdog parameters structure definition.
Definition: stm32h7xx_hal_dfsdm.h:254
DFSDM_FLTFCR_FORD
#define DFSDM_FLTFCR_FORD
Definition: stm32f769xx.h:6321
DFSDM_Filter_RegularParamTypeDef::Trigger
uint32_t Trigger
Definition: stm32h7xx_hal_dfsdm.h:172
IS_DFSDM_INJECTED_CHANNEL
#define IS_DFSDM_INJECTED_CHANNEL(CHANNEL)
Definition: stm32h7xx_hal_dfsdm.h:833
DFSDM_Filter_FilterParamTypeDef::IntOversampling
uint32_t IntOversampling
Definition: stm32h7xx_hal_dfsdm.h:202
HAL_DFSDM_FilterMspInit
void HAL_DFSDM_FilterMspInit(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
DFSDM_Filter MSP Initialization This function configures the hardware resources used in this example.
Definition: stm32h7xx_hal_msp.c:133
DFSDM_Channel_OutputClockTypeDef::Selection
uint32_t Selection
Definition: stm32h7xx_hal_dfsdm.h:60
DFSDM_Filter_TypeDef::FLTJDATAR
__IO uint32_t FLTJDATAR
Definition: stm32f769xx.h:360
DFSDM_FLTFCR_FOSR
#define DFSDM_FLTFCR_FOSR
Definition: stm32f769xx.h:6327
HAL_DFSDM_ChannelCkabCallback
void HAL_DFSDM_ChannelCkabCallback(DFSDM_Channel_HandleTypeDef *hdfsdm_channel)
HAL_DFSDM_FilterRegConvHalfCpltCallback
void HAL_DFSDM_FilterRegConvHalfCpltCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
Half regular conversion complete callback.
Definition: stm32f769i_discovery_audio.c:1517
HAL_DFSDM_IRQHandler
void HAL_DFSDM_IRQHandler(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
DFSDM_Filter_HandleTypeDef::InjConvRemaining
uint32_t InjConvRemaining
Definition: stm32h7xx_hal_dfsdm.h:235
HAL_DFSDM_CHANNEL_STATE_READY
@ HAL_DFSDM_CHANNEL_STATE_READY
Definition: stm32h7xx_hal_dfsdm.h:50
HAL_MAX_DELAY
#define HAL_MAX_DELAY
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_def.h:61
DFSDM_CHAWSCDR_BKSCD
#define DFSDM_CHAWSCDR_BKSCD
Definition: stm32f769xx.h:6170
DFSDM_CHCFGR1_SITP
#define DFSDM_CHCFGR1_SITP
Definition: stm32f769xx.h:6147
HAL_DMA_Abort
HAL_StatusTypeDef HAL_DMA_Abort(DMA_HandleTypeDef *hdma)
HAL_DFSDM_FilterInjectedMsbStart_DMA
HAL_StatusTypeDef HAL_DFSDM_FilterInjectedMsbStart_DMA(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, int16_t *pData, uint32_t Length)
DFSDM_FLTCR1_JEXTEN
#define DFSDM_FLTCR1_JEXTEN
Definition: stm32f769xx.h:6214
IS_DFSDM_FILTER_AWD_THRESHOLD
#define IS_DFSDM_FILTER_AWD_THRESHOLD(VALUE)
Definition: stm32h7xx_hal_dfsdm.h:823
DFSDM_FLTEXMIN_EXMIN
#define DFSDM_FLTEXMIN_EXMIN
Definition: stm32f769xx.h:6394
HAL_DFSDM_FilterErrorCallback
void HAL_DFSDM_FilterErrorCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
DFSDM_Filter_AwdParamTypeDef::LowThreshold
int32_t LowThreshold
Definition: stm32h7xx_hal_dfsdm.h:262
DFSDM_Filter_RegularParamTypeDef::FastMode
FunctionalState FastMode
Definition: stm32h7xx_hal_dfsdm.h:174
DFSDM_FLTCR1_RSYNC
#define DFSDM_FLTCR1_RSYNC
Definition: stm32f769xx.h:6205
DFSDM_Channel_InputTypeDef::Multiplexer
uint32_t Multiplexer
Definition: stm32h7xx_hal_dfsdm.h:71
DFSDM_Filter_AwdParamTypeDef::HighThreshold
int32_t HighThreshold
Definition: stm32h7xx_hal_dfsdm.h:260
HAL_DFSDM_FilterInjectedStart
HAL_StatusTypeDef HAL_DFSDM_FilterInjectedStart(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
DFSDM1_Channel1
#define DFSDM1_Channel1
Definition: stm32f769xx.h:1664
DFSDM_Channel_HandleTypeDef
DFSDM channel handle structure definition.
Definition: stm32h7xx_hal_dfsdm.h:122
DFSDM_CHAWSCDR_SCDT
#define DFSDM_CHAWSCDR_SCDT
Definition: stm32f769xx.h:6173
HAL_DFSDM_FilterInjectedStart_IT
HAL_StatusTypeDef HAL_DFSDM_FilterInjectedStart_IT(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
DFSDM_Channel_SerialInterfaceTypeDef::SpiClock
uint32_t SpiClock
Definition: stm32h7xx_hal_dfsdm.h:86
DFSDM_Filter_HandleTypeDef::Init
DFSDM_Filter_InitTypeDef Init
Definition: stm32h7xx_hal_dfsdm.h:226
DFSDM_FLTISR_SCDF_Pos
#define DFSDM_FLTISR_SCDF_Pos
Definition: stm32f769xx.h:6271
DFSDM_FLTCR1_RCONT
#define DFSDM_FLTCR1_RCONT
Definition: stm32f769xx.h:6208
DFSDM_Channel_InputTypeDef::Pins
uint32_t Pins
Definition: stm32h7xx_hal_dfsdm.h:75
HAL_DFSDM_FilterConfigRegChannel
HAL_StatusTypeDef HAL_DFSDM_FilterConfigRegChannel(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t Channel, uint32_t ContinuousMode)
HAL_TIMEOUT
@ HAL_TIMEOUT
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_def.h:45
DFSDM_FLTRDATAR_RDATA
#define DFSDM_FLTRDATAR_RDATA
Definition: stm32f769xx.h:6343
DFSDM_Channel_OutputClockTypeDef::Activation
FunctionalState Activation
Definition: stm32h7xx_hal_dfsdm.h:59
DFSDM_FLTCNVTIMR_CNVCNT_Pos
#define DFSDM_FLTCNVTIMR_CNVCNT_Pos
Definition: stm32f769xx.h:6400
DFSDM_Filter_AwdParamTypeDef::LowBreakSignal
uint32_t LowBreakSignal
Definition: stm32h7xx_hal_dfsdm.h:266
DFSDM_CHCFGR1_DATMPX
#define DFSDM_CHCFGR1_DATMPX
Definition: stm32f769xx.h:6125
DFSDM_Channel_TypeDef::CHAWSCDR
__IO uint32_t CHAWSCDR
Definition: stm32f769xx.h:378
DMA_NORMAL
#define DMA_NORMAL
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:281
IS_DFSDM_FILTER_SINC_ORDER
#define IS_DFSDM_FILTER_SINC_ORDER(ORDER)
Definition: stm32h7xx_hal_dfsdm.h:813
HAL_DFSDM_ChannelScdStart
HAL_StatusTypeDef HAL_DFSDM_ChannelScdStart(DFSDM_Channel_HandleTypeDef *hdfsdm_channel, uint32_t Threshold, uint32_t BreakSignal)
HAL_DFSDM_FilterInjectedStop_DMA
HAL_StatusTypeDef HAL_DFSDM_FilterInjectedStop_DMA(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
DFSDM_Filter_InitTypeDef::FilterParam
DFSDM_Filter_FilterParamTypeDef FilterParam
Definition: stm32h7xx_hal_dfsdm.h:213
HAL_DFSDM_FilterExdStart
HAL_StatusTypeDef HAL_DFSDM_FilterExdStart(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t Channel)
DFSDM_CHAWSCDR_AWFOSR_Pos
#define DFSDM_CHAWSCDR_AWFOSR_Pos
Definition: stm32f769xx.h:6165
DFSDM_Filter_HandleTypeDef::InjectedChannelsNbr
uint32_t InjectedChannelsNbr
Definition: stm32h7xx_hal_dfsdm.h:234
HAL_DFSDM_FilterInjConvCpltCallback
void HAL_DFSDM_FilterInjConvCpltCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
IS_DFSDM_CHANNEL_FILTER_OVS_RATIO
#define IS_DFSDM_CHANNEL_FILTER_OVS_RATIO(RATIO)
Definition: stm32h7xx_hal_dfsdm.h:748
__DMA_HandleTypeDef::XferCpltCallback
void(* XferCpltCallback)(struct __DMA_HandleTypeDef *hdma)
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:151
IS_DFSDM_CHANNEL_SERIAL_INTERFACE_TYPE
#define IS_DFSDM_CHANNEL_SERIAL_INTERFACE_TYPE(MODE)
Definition: stm32h7xx_hal_dfsdm.h:736
DFSDM_Filter_HandleTypeDef::InjectedTrigger
uint32_t InjectedTrigger
Definition: stm32h7xx_hal_dfsdm.h:231
DFSDM_FLTISR_CKABF
#define DFSDM_FLTISR_CKABF
Definition: stm32f769xx.h:6276
DFSDM_Filter_TypeDef
DFSDM module registers.
Definition: stm32f769xx.h:352
HAL_DFSDM_FilterRegularStop
HAL_StatusTypeDef HAL_DFSDM_FilterRegularStop(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
DFSDM_Channel_InitTypeDef::Input
DFSDM_Channel_InputTypeDef Input
Definition: stm32h7xx_hal_dfsdm.h:107
DFSDM_Channel_InitTypeDef::RightBitShift
uint32_t RightBitShift
Definition: stm32h7xx_hal_dfsdm.h:112
DFSDM_Filter_TypeDef::FLTCNVTIMR
__IO uint32_t FLTCNVTIMR
Definition: stm32f769xx.h:368
HAL_DFSDM_FilterConfigInjChannel
HAL_StatusTypeDef HAL_DFSDM_FilterConfigInjChannel(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t Channel)
DFSDM_CHAWSCDR_AWFORD
#define DFSDM_CHAWSCDR_AWFORD
Definition: stm32f769xx.h:6162
IS_DFSDM_CHANNEL_OFFSET
#define IS_DFSDM_CHANNEL_OFFSET(VALUE)
Definition: stm32h7xx_hal_dfsdm.h:749
HAL_DFSDM_Filter_StateTypeDef
HAL_DFSDM_Filter_StateTypeDef
HAL DFSDM Filter states definition.
Definition: stm32h7xx_hal_dfsdm.h:157
DFSDM_FLTCR2_EXCH_Pos
#define DFSDM_FLTCR2_EXCH_Pos
Definition: stm32f769xx.h:6245
DFSDM_FILTER_SYNC_TRIGGER
#define DFSDM_FILTER_SYNC_TRIGGER
Definition: stm32h7xx_hal_dfsdm.h:377
HAL_DFSDM_FilterInjectedStop
HAL_StatusTypeDef HAL_DFSDM_FilterInjectedStop(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
DFSDM_Filter_TypeDef::FLTJCHGR
__IO uint32_t FLTJCHGR
Definition: stm32f769xx.h:358
HAL_DFSDM_FilterGetRegularValue
int32_t HAL_DFSDM_FilterGetRegularValue(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t *Channel)
DFSDM_FLTISR_CKABF_Pos
#define DFSDM_FLTISR_CKABF_Pos
Definition: stm32f769xx.h:6274
DFSDM_FILTER_SW_TRIGGER
#define DFSDM_FILTER_SW_TRIGGER
Definition: stm32h7xx_hal_dfsdm.h:376
DFSDM_FLTFCR_FOSR_Pos
#define DFSDM_FLTFCR_FOSR_Pos
Definition: stm32f769xx.h:6325
DFSDM_FLTISR_JOVRF
#define DFSDM_FLTISR_JOVRF
Definition: stm32f769xx.h:6291
DFSDM_Channel_OutputClockTypeDef::Divider
uint32_t Divider
Definition: stm32h7xx_hal_dfsdm.h:62
DFSDM_Channel_TypeDef::CHWDATAR
__IO uint32_t CHWDATAR
Definition: stm32f769xx.h:380
DFSDM_FLTAWSR_AWLTF
#define DFSDM_FLTAWSR_AWLTF
Definition: stm32f769xx.h:6373
IS_DFSDM_CHANNEL_DATA_PACKING
#define IS_DFSDM_CHANNEL_DATA_PACKING(MODE)
Definition: stm32h7xx_hal_dfsdm.h:731
DFSDM1_Channel2
#define DFSDM1_Channel2
Definition: stm32f769xx.h:1665
DFSDM_Filter_InjectedParamTypeDef::ScanMode
FunctionalState ScanMode
Definition: stm32h7xx_hal_dfsdm.h:185
HAL_DFSDM_FilterExdStop
HAL_StatusTypeDef HAL_DFSDM_FilterExdStop(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
DFSDM_FLTISR_ROVRF
#define DFSDM_FLTISR_ROVRF
Definition: stm32f769xx.h:6288
DFSDM_Filter_InitTypeDef::InjectedParam
DFSDM_Filter_InjectedParamTypeDef InjectedParam
Definition: stm32h7xx_hal_dfsdm.h:212
DFSDM_CHCFGR1_CKABEN
#define DFSDM_CHCFGR1_CKABEN
Definition: stm32f769xx.h:6136
HAL_DFSDM_FILTER_STATE_READY
@ HAL_DFSDM_FILTER_STATE_READY
Definition: stm32h7xx_hal_dfsdm.h:160
HAL_DFSDM_ChannelScdStart_IT
HAL_StatusTypeDef HAL_DFSDM_ChannelScdStart_IT(DFSDM_Channel_HandleTypeDef *hdfsdm_channel, uint32_t Threshold, uint32_t BreakSignal)
DFSDM_Filter_TypeDef::FLTFCR
__IO uint32_t FLTFCR
Definition: stm32f769xx.h:359
DFSDM_FLTAWLTR_BKAWL
#define DFSDM_FLTAWLTR_BKAWL
Definition: stm32f769xx.h:6365
DMA_InitTypeDef::Mode
uint32_t Mode
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:70
DFSDM_Filter_InjectedParamTypeDef::ExtTrigger
uint32_t ExtTrigger
Definition: stm32h7xx_hal_dfsdm.h:187
HAL_DFSDM_ChannelCkabStop
HAL_StatusTypeDef HAL_DFSDM_ChannelCkabStop(DFSDM_Channel_HandleTypeDef *hdfsdm_channel)
HAL_DFSDM_FilterAwdStart_IT
HAL_StatusTypeDef HAL_DFSDM_FilterAwdStart_IT(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, DFSDM_Filter_AwdParamTypeDef *awdParam)
DFSDM_FLTEXMAX_EXMAX
#define DFSDM_FLTEXMAX_EXMAX
Definition: stm32f769xx.h:6386
IS_DFSDM_CHANNEL_SPI_CLOCK
#define IS_DFSDM_CHANNEL_SPI_CLOCK(TYPE)
Definition: stm32h7xx_hal_dfsdm.h:740
DFSDM_Filter_FilterParamTypeDef::SincOrder
uint32_t SincOrder
Definition: stm32h7xx_hal_dfsdm.h:198
HAL_DFSDM_FILTER_STATE_RESET
@ HAL_DFSDM_FILTER_STATE_RESET
Definition: stm32h7xx_hal_dfsdm.h:159
DFSDM_Channel_HandleTypeDef::Init
DFSDM_Channel_InitTypeDef Init
Definition: stm32h7xx_hal_dfsdm.h:126
DFSDM_FLTICR_CLRJOVRF
#define DFSDM_FLTICR_CLRJOVRF
Definition: stm32f769xx.h:6311
HAL_DFSDM_FILTER_STATE_ERROR
@ HAL_DFSDM_FILTER_STATE_ERROR
Definition: stm32h7xx_hal_dfsdm.h:164
HAL_DFSDM_ChannelPollForScd
HAL_StatusTypeDef HAL_DFSDM_ChannelPollForScd(DFSDM_Channel_HandleTypeDef *hdfsdm_channel, uint32_t Timeout)
DFSDM_FLTCR2_CKABIE
#define DFSDM_FLTCR2_CKABIE
Definition: stm32f769xx.h:6250
DFSDM_CHCFGR1_CHEN
#define DFSDM_CHCFGR1_CHEN
Definition: stm32f769xx.h:6133
DFSDM_FLTISR_JEOCF
#define DFSDM_FLTISR_JEOCF
Definition: stm32f769xx.h:6297
DFSDM_Filter_TypeDef::FLTCR1
__IO uint32_t FLTCR1
Definition: stm32f769xx.h:354
DFSDM_FLTJDATAR_JDATA
#define DFSDM_FLTJDATAR_JDATA
Definition: stm32f769xx.h:6335
DFSDM_CHCFGR2_DTRBS_Pos
#define DFSDM_CHCFGR2_DTRBS_Pos
Definition: stm32f769xx.h:6155
HAL_DFSDM_FilterAwdCallback
void HAL_DFSDM_FilterAwdCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t Channel, uint32_t Threshold)
DFSDM_Channel_TypeDef::CHCFGR2
__IO uint32_t CHCFGR2
Definition: stm32f769xx.h:377
DFSDM_AWD_HIGH_THRESHOLD
#define DFSDM_AWD_HIGH_THRESHOLD
Definition: stm32h7xx_hal_dfsdm.h:509
DFSDM_CHCFGR1_DATPACK
#define DFSDM_CHCFGR1_DATPACK
Definition: stm32f769xx.h:6120
HAL_DFSDM_CHANNEL_STATE_RESET
@ HAL_DFSDM_CHANNEL_STATE_RESET
Definition: stm32h7xx_hal_dfsdm.h:49
DFSDM_FLTJDATAR_JDATACH
#define DFSDM_FLTJDATAR_JDATACH
Definition: stm32f769xx.h:6338
IS_DFSDM_FILTER_INJ_TRIGGER
#define IS_DFSDM_FILTER_INJ_TRIGGER(TRIG)
Definition: stm32h7xx_hal_dfsdm.h:754
DFSDM_Filter_TypeDef::FLTAWSR
__IO uint32_t FLTAWSR
Definition: stm32f769xx.h:364
HAL_DFSDM_ChannelCkabStart
HAL_StatusTypeDef HAL_DFSDM_ChannelCkabStart(DFSDM_Channel_HandleTypeDef *hdfsdm_channel)
DFSDM_Filter_InitTypeDef::RegularParam
DFSDM_Filter_RegularParamTypeDef RegularParam
Definition: stm32h7xx_hal_dfsdm.h:211
__DMA_HandleTypeDef::XferErrorCallback
void(* XferErrorCallback)(struct __DMA_HandleTypeDef *hdma)
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:159
DFSDM_FLTEXMAX_EXMAXCH
#define DFSDM_FLTEXMAX_EXMAXCH
Definition: stm32f769xx.h:6389
DFSDM_FLTISR_AWDF
#define DFSDM_FLTISR_AWDF
Definition: stm32f769xx.h:6285
DFSDM1_Channel3
#define DFSDM1_Channel3
Definition: stm32f769xx.h:1666
IS_DFSDM_FILTER_EXT_TRIG_EDGE
#define IS_DFSDM_FILTER_EXT_TRIG_EDGE(EDGE)
Definition: stm32h7xx_hal_dfsdm.h:810
IS_DFSDM_CHANNEL_OUTPUT_CLOCK
#define IS_DFSDM_CHANNEL_OUTPUT_CLOCK(CLOCK)
Definition: stm32h7xx_hal_dfsdm.h:725
DFSDM_Filter_AwdParamTypeDef::HighBreakSignal
uint32_t HighBreakSignal
Definition: stm32h7xx_hal_dfsdm.h:264


picovoice_driver
Author(s):
autogenerated on Fri Apr 1 2022 02:14:54