STM32F769IDiscovery  1.00
uDANTE Audio Networking with STM32F7 DISCO board
stm32f7xx_hal_adc.c
Go to the documentation of this file.
1 
194 /* Includes ------------------------------------------------------------------*/
195 #include "stm32f7xx_hal.h"
196 
206 #ifdef HAL_ADC_MODULE_ENABLED
207 
208 /* Private typedef -----------------------------------------------------------*/
209 /* Private define ------------------------------------------------------------*/
210 /* Private macro -------------------------------------------------------------*/
211 /* Private variables ---------------------------------------------------------*/
215 /* Private function prototypes -----------------------------------------------*/
216 static void ADC_Init(ADC_HandleTypeDef* hadc);
217 static void ADC_DMAConvCplt(DMA_HandleTypeDef *hdma);
218 static void ADC_DMAError(DMA_HandleTypeDef *hdma);
219 static void ADC_DMAHalfConvCplt(DMA_HandleTypeDef *hdma);
224 /* Exported functions --------------------------------------------------------*/
260 {
261  HAL_StatusTypeDef tmp_hal_status = HAL_OK;
262 
263  /* Check ADC handle */
264  if(hadc == NULL)
265  {
266  return HAL_ERROR;
267  }
268 
269  /* Check the parameters */
281 
283  {
285  }
286 
287  if(hadc->State == HAL_ADC_STATE_RESET)
288  {
289  /* Initialize ADC error code */
290  ADC_CLEAR_ERRORCODE(hadc);
291 
292  /* Allocate lock resource and initialize it */
293  hadc->Lock = HAL_UNLOCKED;
294  /* Init the low level hardware */
295  HAL_ADC_MspInit(hadc);
296  }
297 
298  /* Configuration of ADC parameters if previous preliminary actions are */
299  /* correctly completed. */
301  {
302  /* Set ADC state */
303  ADC_STATE_CLR_SET(hadc->State,
306 
307  /* Set ADC parameters */
308  ADC_Init(hadc);
309 
310  /* Set ADC error code to none */
311  ADC_CLEAR_ERRORCODE(hadc);
312 
313  /* Set the ADC state */
314  ADC_STATE_CLR_SET(hadc->State,
317  }
318  else
319  {
320  tmp_hal_status = HAL_ERROR;
321  }
322 
323  /* Release Lock */
324  __HAL_UNLOCK(hadc);
325 
326  /* Return function status */
327  return tmp_hal_status;
328 }
329 
337 {
338  HAL_StatusTypeDef tmp_hal_status = HAL_OK;
339 
340  /* Check ADC handle */
341  if(hadc == NULL)
342  {
343  return HAL_ERROR;
344  }
345 
346  /* Check the parameters */
348 
349  /* Set ADC state */
351 
352  /* Stop potential conversion on going, on regular and injected groups */
353  /* Disable ADC peripheral */
354  __HAL_ADC_DISABLE(hadc);
355 
356  /* Configuration of ADC parameters if previous preliminary actions are */
357  /* correctly completed. */
359  {
360  /* DeInit the low level hardware */
361  HAL_ADC_MspDeInit(hadc);
362 
363  /* Set ADC error code to none */
364  ADC_CLEAR_ERRORCODE(hadc);
365 
366  /* Set ADC state */
367  hadc->State = HAL_ADC_STATE_RESET;
368  }
369 
370  /* Process unlocked */
371  __HAL_UNLOCK(hadc);
372 
373  /* Return function status */
374  return tmp_hal_status;
375 }
376 
383 __weak void HAL_ADC_MspInit(ADC_HandleTypeDef* hadc)
384 {
385  /* Prevent unused argument(s) compilation warning */
386  UNUSED(hadc);
387  /* NOTE : This function Should not be modified, when the callback is needed,
388  the HAL_ADC_MspInit could be implemented in the user file
389  */
390 }
391 
398 __weak void HAL_ADC_MspDeInit(ADC_HandleTypeDef* hadc)
399 {
400  /* Prevent unused argument(s) compilation warning */
401  UNUSED(hadc);
402  /* NOTE : This function Should not be modified, when the callback is needed,
403  the HAL_ADC_MspDeInit could be implemented in the user file
404  */
405 }
406 
438 {
439  __IO uint32_t counter = 0;
440 
441  /* Check the parameters */
444 
445  /* Process locked */
446  __HAL_LOCK(hadc);
447 
448  /* Enable the ADC peripheral */
449  /* Check if ADC peripheral is disabled in order to enable it and wait during
450  Tstab time the ADC's stabilization */
451  if((hadc->Instance->CR2 & ADC_CR2_ADON) != ADC_CR2_ADON)
452  {
453  /* Enable the Peripheral */
454  __HAL_ADC_ENABLE(hadc);
455 
456  /* Delay for ADC stabilization time */
457  /* Compute number of CPU cycles to wait for */
458  counter = (ADC_STAB_DELAY_US * (SystemCoreClock / 1000000));
459  while(counter != 0)
460  {
461  counter--;
462  }
463  }
464 
465  /* Start conversion if ADC is effectively enabled */
467  {
468  /* Set ADC state */
469  /* - Clear state bitfield related to regular group conversion results */
470  /* - Set state bitfield related to regular group operation */
471  ADC_STATE_CLR_SET(hadc->State,
474 
475  /* If conversions on group regular are also triggering group injected, */
476  /* update ADC state. */
477  if (READ_BIT(hadc->Instance->CR1, ADC_CR1_JAUTO) != RESET)
478  {
480  }
481 
482  /* State machine update: Check if an injected conversion is ongoing */
484  {
485  /* Reset ADC error code fields related to conversions on group regular */
487  }
488  else
489  {
490  /* Reset ADC all error code fields */
491  ADC_CLEAR_ERRORCODE(hadc);
492  }
493 
494  /* Process unlocked */
495  /* Unlock before starting ADC conversions: in case of potential */
496  /* interruption, to let the process to ADC IRQ Handler. */
497  __HAL_UNLOCK(hadc);
498 
499  /* Clear regular group conversion flag and overrun flag */
500  /* (To ensure of no unknown state from potential previous ADC operations) */
502 
503  /* Check if Multimode enabled */
504  if(HAL_IS_BIT_CLR(ADC->CCR, ADC_CCR_MULTI))
505  {
506  /* if no external trigger present enable software conversion of regular channels */
507  if((hadc->Instance->CR2 & ADC_CR2_EXTEN) == RESET)
508  {
509  /* Enable the selected ADC software conversion for regular group */
510  hadc->Instance->CR2 |= (uint32_t)ADC_CR2_SWSTART;
511  }
512  }
513  else
514  {
515  /* if instance of handle correspond to ADC1 and no external trigger present enable software conversion of regular channels */
516  if((hadc->Instance == ADC1) && ((hadc->Instance->CR2 & ADC_CR2_EXTEN) == RESET))
517  {
518  /* Enable the selected ADC software conversion for regular group */
519  hadc->Instance->CR2 |= (uint32_t)ADC_CR2_SWSTART;
520  }
521  }
522  }
523 
524  /* Return function status */
525  return HAL_OK;
526 }
527 
539 {
540  /* Check the parameters */
542 
543  /* Process locked */
544  __HAL_LOCK(hadc);
545 
546  /* Stop potential conversion on going, on regular and injected groups */
547  /* Disable ADC peripheral */
548  __HAL_ADC_DISABLE(hadc);
549 
550  /* Check if ADC is effectively disabled */
552  {
553  /* Set ADC state */
554  ADC_STATE_CLR_SET(hadc->State,
557  }
558 
559  /* Process unlocked */
560  __HAL_UNLOCK(hadc);
561 
562  /* Return function status */
563  return HAL_OK;
564 }
565 
582 {
583  uint32_t tickstart = 0;
584 
585  /* Verification that ADC configuration is compliant with polling for */
586  /* each conversion: */
587  /* Particular case is ADC configured in DMA mode and ADC sequencer with */
588  /* several ranks and polling for end of each conversion. */
589  /* For code simplicity sake, this particular case is generalized to */
590  /* ADC configured in DMA mode and polling for end of each conversion. */
591  if (HAL_IS_BIT_SET(hadc->Instance->CR2, ADC_CR2_EOCS) &&
593  {
594  /* Update ADC state machine to error */
596 
597  /* Process unlocked */
598  __HAL_UNLOCK(hadc);
599 
600  return HAL_ERROR;
601  }
602 
603  /* Get tick */
604  tickstart = HAL_GetTick();
605 
606  /* Check End of conversion flag */
607  while(!(__HAL_ADC_GET_FLAG(hadc, ADC_FLAG_EOC)))
608  {
609  /* Check if timeout is disabled (set to infinite wait) */
610  if(Timeout != HAL_MAX_DELAY)
611  {
612  if((Timeout == 0) || ((HAL_GetTick() - tickstart ) > Timeout))
613  {
614  /* Update ADC state machine to timeout */
616 
617  /* Process unlocked */
618  __HAL_UNLOCK(hadc);
619 
620  return HAL_TIMEOUT;
621  }
622  }
623  }
624 
625  /* Clear regular group conversion flag */
627 
628  /* Update ADC state machine */
630 
631  /* Determine whether any further conversion upcoming on group regular */
632  /* by external trigger, continuous mode or scan sequence on going. */
633  /* Note: On STM32F7, there is no independent flag of end of sequence. */
634  /* The test of scan sequence on going is done either with scan */
635  /* sequence disabled or with end of conversion flag set to */
636  /* of end of sequence. */
638  (hadc->Init.ContinuousConvMode == DISABLE) &&
641  {
642  /* Set ADC state */
644 
646  {
648  }
649  }
650 
651  /* Return ADC state */
652  return HAL_OK;
653 }
654 
666 HAL_StatusTypeDef HAL_ADC_PollForEvent(ADC_HandleTypeDef* hadc, uint32_t EventType, uint32_t Timeout)
667 {
668  uint32_t tickstart = 0;
669 
670  /* Check the parameters */
672  assert_param(IS_ADC_EVENT_TYPE(EventType));
673 
674  /* Get tick */
675  tickstart = HAL_GetTick();
676 
677  /* Check selected event flag */
678  while(!(__HAL_ADC_GET_FLAG(hadc,EventType)))
679  {
680  /* Check for the Timeout */
681  if(Timeout != HAL_MAX_DELAY)
682  {
683  if((Timeout == 0) || ((HAL_GetTick() - tickstart ) > Timeout))
684  {
685  /* Update ADC state machine to timeout */
687 
688  /* Process unlocked */
689  __HAL_UNLOCK(hadc);
690 
691  return HAL_TIMEOUT;
692  }
693  }
694  }
695 
696  /* Analog watchdog (level out of window) event */
697  if(EventType == ADC_AWD_EVENT)
698  {
699  /* Set ADC state */
701 
702  /* Clear ADC analog watchdog flag */
704  }
705  /* Overrun event */
706  else
707  {
708  /* Set ADC state */
710  /* Set ADC error code to overrun */
712 
713  /* Clear ADC overrun flag */
715  }
716 
717  /* Return ADC state */
718  return HAL_OK;
719 }
720 
721 
729 {
730  __IO uint32_t counter = 0;
731 
732  /* Check the parameters */
735 
736  /* Process locked */
737  __HAL_LOCK(hadc);
738 
739  /* Enable the ADC peripheral */
740  /* Check if ADC peripheral is disabled in order to enable it and wait during
741  Tstab time the ADC's stabilization */
742  if((hadc->Instance->CR2 & ADC_CR2_ADON) != ADC_CR2_ADON)
743  {
744  /* Enable the Peripheral */
745  __HAL_ADC_ENABLE(hadc);
746 
747  /* Delay for ADC stabilization time */
748  /* Compute number of CPU cycles to wait for */
749  counter = (ADC_STAB_DELAY_US * (SystemCoreClock / 1000000));
750  while(counter != 0)
751  {
752  counter--;
753  }
754  }
755 
756  /* Start conversion if ADC is effectively enabled */
758  {
759  /* Set ADC state */
760  /* - Clear state bitfield related to regular group conversion results */
761  /* - Set state bitfield related to regular group operation */
762  ADC_STATE_CLR_SET(hadc->State,
765 
766  /* If conversions on group regular are also triggering group injected, */
767  /* update ADC state. */
768  if (READ_BIT(hadc->Instance->CR1, ADC_CR1_JAUTO) != RESET)
769  {
771  }
772 
773  /* State machine update: Check if an injected conversion is ongoing */
775  {
776  /* Reset ADC error code fields related to conversions on group regular */
778  }
779  else
780  {
781  /* Reset ADC all error code fields */
782  ADC_CLEAR_ERRORCODE(hadc);
783  }
784 
785  /* Process unlocked */
786  /* Unlock before starting ADC conversions: in case of potential */
787  /* interruption, to let the process to ADC IRQ Handler. */
788  __HAL_UNLOCK(hadc);
789 
790  /* Clear regular group conversion flag and overrun flag */
791  /* (To ensure of no unknown state from potential previous ADC operations) */
793 
794  /* Enable end of conversion interrupt for regular group */
796 
797  /* Check if Multimode enabled */
798  if(HAL_IS_BIT_CLR(ADC->CCR, ADC_CCR_MULTI))
799  {
800  /* if no external trigger present enable software conversion of regular channels */
801  if((hadc->Instance->CR2 & ADC_CR2_EXTEN) == RESET)
802  {
803  /* Enable the selected ADC software conversion for regular group */
804  hadc->Instance->CR2 |= (uint32_t)ADC_CR2_SWSTART;
805  }
806  }
807  else
808  {
809  /* if instance of handle correspond to ADC1 and no external trigger present enable software conversion of regular channels */
810  if((hadc->Instance == ADC1) && ((hadc->Instance->CR2 & ADC_CR2_EXTEN) == RESET))
811  {
812  /* Enable the selected ADC software conversion for regular group */
813  hadc->Instance->CR2 |= (uint32_t)ADC_CR2_SWSTART;
814  }
815  }
816  }
817 
818  /* Return function status */
819  return HAL_OK;
820 }
821 
832 {
833  /* Check the parameters */
835 
836  /* Process locked */
837  __HAL_LOCK(hadc);
838 
839  /* Stop potential conversion on going, on regular and injected groups */
840  /* Disable ADC peripheral */
841  __HAL_ADC_DISABLE(hadc);
842 
843  /* Check if ADC is effectively disabled */
845  {
846  /* Disable ADC end of conversion interrupt for regular group */
848 
849  /* Set ADC state */
850  ADC_STATE_CLR_SET(hadc->State,
853  }
854 
855  /* Process unlocked */
856  __HAL_UNLOCK(hadc);
857 
858  /* Return function status */
859  return HAL_OK;
860 }
861 
869 {
870  uint32_t tmp1 = 0, tmp2 = 0;
871 
872  /* Check the parameters */
876 
877  tmp1 = __HAL_ADC_GET_FLAG(hadc, ADC_FLAG_EOC);
878  tmp2 = __HAL_ADC_GET_IT_SOURCE(hadc, ADC_IT_EOC);
879  /* Check End of conversion flag for regular channels */
880  if(tmp1 && tmp2)
881  {
882  /* Update state machine on conversion status if not in error state */
884  {
885  /* Set ADC state */
887  }
888 
889  /* Determine whether any further conversion upcoming on group regular */
890  /* by external trigger, continuous mode or scan sequence on going. */
891  /* Note: On STM32F7, there is no independent flag of end of sequence. */
892  /* The test of scan sequence on going is done either with scan */
893  /* sequence disabled or with end of conversion flag set to */
894  /* of end of sequence. */
896  (hadc->Init.ContinuousConvMode == DISABLE) &&
897  (HAL_IS_BIT_CLR(hadc->Instance->SQR1, ADC_SQR1_L) ||
899  {
900  /* Disable ADC end of single conversion interrupt on group regular */
901  /* Note: Overrun interrupt was enabled with EOC interrupt in */
902  /* HAL_ADC_Start_IT(), but is not disabled here because can be used */
903  /* by overrun IRQ process below. */
905 
906  /* Set ADC state */
908 
910  {
912  }
913  }
914 
915  /* Conversion complete callback */
917 
918  /* Clear regular group conversion flag */
920  }
921 
922  tmp1 = __HAL_ADC_GET_FLAG(hadc, ADC_FLAG_JEOC);
923  tmp2 = __HAL_ADC_GET_IT_SOURCE(hadc, ADC_IT_JEOC);
924  /* Check End of conversion flag for injected channels */
925  if(tmp1 && tmp2)
926  {
927  /* Update state machine on conversion status if not in error state */
929  {
930  /* Set ADC state */
932  }
933 
934  /* Determine whether any further conversion upcoming on group injected */
935  /* by external trigger, scan sequence on going or by automatic injected */
936  /* conversion from group regular (same conditions as group regular */
937  /* interruption disabling above). */
943  (hadc->Init.ContinuousConvMode == DISABLE))))
944  {
945  /* Disable ADC end of single conversion interrupt on group injected */
947 
948  /* Set ADC state */
950 
952  {
954  }
955  }
956 
957  /* Conversion complete callback */
959 
960  /* Clear injected group conversion flag */
962  }
963 
964  tmp1 = __HAL_ADC_GET_FLAG(hadc, ADC_FLAG_AWD);
965  tmp2 = __HAL_ADC_GET_IT_SOURCE(hadc, ADC_IT_AWD);
966  /* Check Analog watchdog flag */
967  if(tmp1 && tmp2)
968  {
970  {
971  /* Set ADC state */
973 
974  /* Level out of window callback */
976 
977  /* Clear the ADC analog watchdog flag */
979  }
980  }
981 
982  tmp1 = __HAL_ADC_GET_FLAG(hadc, ADC_FLAG_OVR);
983  tmp2 = __HAL_ADC_GET_IT_SOURCE(hadc, ADC_IT_OVR);
984  /* Check Overrun flag */
985  if(tmp1 && tmp2)
986  {
987  /* Note: On STM32F7, ADC overrun can be set through other parameters */
988  /* refer to description of parameter "EOCSelection" for more */
989  /* details. */
990 
991  /* Set ADC error code to overrun */
993 
994  /* Clear ADC overrun flag */
996 
997  /* Error callback */
998  HAL_ADC_ErrorCallback(hadc);
999 
1000  /* Clear the Overrun flag */
1002  }
1003 }
1004 
1013 HAL_StatusTypeDef HAL_ADC_Start_DMA(ADC_HandleTypeDef* hadc, uint32_t* pData, uint32_t Length)
1014 {
1015  __IO uint32_t counter = 0;
1016 
1017  /* Check the parameters */
1020 
1021  /* Process locked */
1022  __HAL_LOCK(hadc);
1023 
1024  /* Enable the ADC peripheral */
1025  /* Check if ADC peripheral is disabled in order to enable it and wait during
1026  Tstab time the ADC's stabilization */
1027  if((hadc->Instance->CR2 & ADC_CR2_ADON) != ADC_CR2_ADON)
1028  {
1029  /* Enable the Peripheral */
1030  __HAL_ADC_ENABLE(hadc);
1031 
1032  /* Delay for ADC stabilization time */
1033  /* Compute number of CPU cycles to wait for */
1034  counter = (ADC_STAB_DELAY_US * (SystemCoreClock / 1000000));
1035  while(counter != 0)
1036  {
1037  counter--;
1038  }
1039  }
1040 
1041  /* Start conversion if ADC is effectively enabled */
1043  {
1044  /* Set ADC state */
1045  /* - Clear state bitfield related to regular group conversion results */
1046  /* - Set state bitfield related to regular group operation */
1047  ADC_STATE_CLR_SET(hadc->State,
1050 
1051  /* If conversions on group regular are also triggering group injected, */
1052  /* update ADC state. */
1053  if (READ_BIT(hadc->Instance->CR1, ADC_CR1_JAUTO) != RESET)
1054  {
1056  }
1057 
1058  /* State machine update: Check if an injected conversion is ongoing */
1060  {
1061  /* Reset ADC error code fields related to conversions on group regular */
1063  }
1064  else
1065  {
1066  /* Reset ADC all error code fields */
1067  ADC_CLEAR_ERRORCODE(hadc);
1068  }
1069 
1070  /* Process unlocked */
1071  /* Unlock before starting ADC conversions: in case of potential */
1072  /* interruption, to let the process to ADC IRQ Handler. */
1073  __HAL_UNLOCK(hadc);
1074 
1075  /* Set the DMA transfer complete callback */
1076  hadc->DMA_Handle->XferCpltCallback = ADC_DMAConvCplt;
1077 
1078  /* Set the DMA half transfer complete callback */
1079  hadc->DMA_Handle->XferHalfCpltCallback = ADC_DMAHalfConvCplt;
1080 
1081  /* Set the DMA error callback */
1082  hadc->DMA_Handle->XferErrorCallback = ADC_DMAError;
1083 
1084 
1085  /* Manage ADC and DMA start: ADC overrun interruption, DMA start, ADC */
1086  /* start (in case of SW start): */
1087 
1088  /* Clear regular group conversion flag and overrun flag */
1089  /* (To ensure of no unknown state from potential previous ADC operations) */
1091 
1092  /* Enable ADC overrun interrupt */
1094 
1095  /* Enable ADC DMA mode */
1096  hadc->Instance->CR2 |= ADC_CR2_DMA;
1097 
1098  /* Start the DMA channel */
1099  HAL_DMA_Start_IT(hadc->DMA_Handle, (uint32_t)&hadc->Instance->DR, (uint32_t)pData, Length);
1100 
1101  /* Check if Multimode enabled */
1102  if(HAL_IS_BIT_CLR(ADC->CCR, ADC_CCR_MULTI))
1103  {
1104  /* if no external trigger present enable software conversion of regular channels */
1105  if((hadc->Instance->CR2 & ADC_CR2_EXTEN) == RESET)
1106  {
1107  /* Enable the selected ADC software conversion for regular group */
1108  hadc->Instance->CR2 |= (uint32_t)ADC_CR2_SWSTART;
1109  }
1110  }
1111  else
1112  {
1113  /* if instance of handle correspond to ADC1 and no external trigger present enable software conversion of regular channels */
1114  if((hadc->Instance == ADC1) && ((hadc->Instance->CR2 & ADC_CR2_EXTEN) == RESET))
1115  {
1116  /* Enable the selected ADC software conversion for regular group */
1117  hadc->Instance->CR2 |= (uint32_t)ADC_CR2_SWSTART;
1118  }
1119  }
1120  }
1121 
1122  /* Return function status */
1123  return HAL_OK;
1124 }
1125 
1133 {
1134  HAL_StatusTypeDef tmp_hal_status = HAL_OK;
1135 
1136  /* Check the parameters */
1138 
1139  /* Process locked */
1140  __HAL_LOCK(hadc);
1141 
1142  /* Stop potential conversion on going, on regular and injected groups */
1143  /* Disable ADC peripheral */
1144  __HAL_ADC_DISABLE(hadc);
1145 
1146  /* Check if ADC is effectively disabled */
1148  {
1149  /* Disable the selected ADC DMA mode */
1150  hadc->Instance->CR2 &= ~ADC_CR2_DMA;
1151 
1152  /* Disable the DMA channel (in case of DMA in circular mode or stop while */
1153  /* DMA transfer is on going) */
1154  tmp_hal_status = HAL_DMA_Abort(hadc->DMA_Handle);
1155 
1156  /* Disable ADC overrun interrupt */
1158 
1159  /* Set ADC state */
1160  ADC_STATE_CLR_SET(hadc->State,
1163  }
1164 
1165  /* Process unlocked */
1166  __HAL_UNLOCK(hadc);
1167 
1168  /* Return function status */
1169  return tmp_hal_status;
1170 }
1171 
1178 uint32_t HAL_ADC_GetValue(ADC_HandleTypeDef* hadc)
1179 {
1180  /* Return the selected ADC converted value */
1181  return hadc->Instance->DR;
1182 }
1183 
1191 {
1192  /* Prevent unused argument(s) compilation warning */
1193  UNUSED(hadc);
1194  /* NOTE : This function Should not be modified, when the callback is needed,
1195  the HAL_ADC_ConvCpltCallback could be implemented in the user file
1196  */
1197 }
1198 
1206 {
1207  /* Prevent unused argument(s) compilation warning */
1208  UNUSED(hadc);
1209  /* NOTE : This function Should not be modified, when the callback is needed,
1210  the HAL_ADC_ConvHalfCpltCallback could be implemented in the user file
1211  */
1212 }
1213 
1221 {
1222  /* Prevent unused argument(s) compilation warning */
1223  UNUSED(hadc);
1224  /* NOTE : This function Should not be modified, when the callback is needed,
1225  the HAL_ADC_LevelOoutOfWindowCallback could be implemented in the user file
1226  */
1227 }
1228 
1241 __weak void HAL_ADC_ErrorCallback(ADC_HandleTypeDef *hadc)
1242 {
1243  /* Prevent unused argument(s) compilation warning */
1244  UNUSED(hadc);
1245  /* NOTE : This function Should not be modified, when the callback is needed,
1246  the HAL_ADC_ErrorCallback could be implemented in the user file
1247  */
1248 }
1249 
1280 {
1281  __IO uint32_t counter = 0;
1282 
1283  /* Check the parameters */
1284  assert_param(IS_ADC_CHANNEL(sConfig->Channel));
1287 
1288  /* Process locked */
1289  __HAL_LOCK(hadc);
1290 
1291  /* if ADC_Channel_10 ... ADC_Channel_18 is selected */
1292  if (sConfig->Channel > ADC_CHANNEL_9)
1293  {
1294  /* Clear the old sample time */
1295  hadc->Instance->SMPR1 &= ~ADC_SMPR1(ADC_SMPR1_SMP10, sConfig->Channel);
1296 
1297  if (sConfig->Channel == ADC_CHANNEL_TEMPSENSOR)
1298  {
1299  /* Set the new sample time */
1300  hadc->Instance->SMPR1 |= ADC_SMPR1(sConfig->SamplingTime, ADC_CHANNEL_18);
1301  }
1302  else
1303  {
1304  /* Set the new sample time */
1305  hadc->Instance->SMPR1 |= ADC_SMPR1(sConfig->SamplingTime, sConfig->Channel);
1306  }
1307  }
1308  else /* ADC_Channel include in ADC_Channel_[0..9] */
1309  {
1310  /* Clear the old sample time */
1311  hadc->Instance->SMPR2 &= ~ADC_SMPR2(ADC_SMPR2_SMP0, sConfig->Channel);
1312 
1313  /* Set the new sample time */
1314  hadc->Instance->SMPR2 |= ADC_SMPR2(sConfig->SamplingTime, sConfig->Channel);
1315  }
1316 
1317  /* For Rank 1 to 6 */
1318  if (sConfig->Rank < 7)
1319  {
1320  /* Clear the old SQx bits for the selected rank */
1321  hadc->Instance->SQR3 &= ~ADC_SQR3_RK(ADC_SQR3_SQ1, sConfig->Rank);
1322 
1323  /* Set the SQx bits for the selected rank */
1324  hadc->Instance->SQR3 |= ADC_SQR3_RK(sConfig->Channel, sConfig->Rank);
1325  }
1326  /* For Rank 7 to 12 */
1327  else if (sConfig->Rank < 13)
1328  {
1329  /* Clear the old SQx bits for the selected rank */
1330  hadc->Instance->SQR2 &= ~ADC_SQR2_RK(ADC_SQR2_SQ7, sConfig->Rank);
1331 
1332  /* Set the SQx bits for the selected rank */
1333  hadc->Instance->SQR2 |= ADC_SQR2_RK(sConfig->Channel, sConfig->Rank);
1334  }
1335  /* For Rank 13 to 16 */
1336  else
1337  {
1338  /* Clear the old SQx bits for the selected rank */
1339  hadc->Instance->SQR1 &= ~ADC_SQR1_RK(ADC_SQR1_SQ13, sConfig->Rank);
1340 
1341  /* Set the SQx bits for the selected rank */
1342  hadc->Instance->SQR1 |= ADC_SQR1_RK(sConfig->Channel, sConfig->Rank);
1343  }
1344 
1345  /* if ADC1 Channel_18 is selected enable VBAT Channel */
1346  if ((hadc->Instance == ADC1) && (sConfig->Channel == ADC_CHANNEL_VBAT))
1347  {
1348  /* Enable the VBAT channel*/
1349  ADC->CCR |= ADC_CCR_VBATE;
1350  }
1351 
1352  /* if ADC1 Channel_18 or Channel_17 is selected enable TSVREFE Channel(Temperature sensor and VREFINT) */
1353  if ((hadc->Instance == ADC1) && ((sConfig->Channel == ADC_CHANNEL_TEMPSENSOR) || (sConfig->Channel == ADC_CHANNEL_VREFINT)))
1354  {
1355  /* Enable the TSVREFE channel*/
1356  ADC->CCR |= ADC_CCR_TSVREFE;
1357 
1358  if(sConfig->Channel == ADC_CHANNEL_TEMPSENSOR)
1359  {
1360  /* Delay for temperature sensor stabilization time */
1361  /* Compute number of CPU cycles to wait for */
1362  counter = (ADC_TEMPSENSOR_DELAY_US * (SystemCoreClock / 1000000));
1363  while(counter != 0)
1364  {
1365  counter--;
1366  }
1367  }
1368  }
1369 
1370  /* Process unlocked */
1371  __HAL_UNLOCK(hadc);
1372 
1373  /* Return function status */
1374  return HAL_OK;
1375 }
1376 
1394 {
1395 #ifdef USE_FULL_ASSERT
1396  uint32_t tmp = 0;
1397 #endif /* USE_FULL_ASSERT */
1398 
1399  /* Check the parameters */
1401  assert_param(IS_ADC_CHANNEL(AnalogWDGConfig->Channel));
1402  assert_param(IS_FUNCTIONAL_STATE(AnalogWDGConfig->ITMode));
1403 
1404 #ifdef USE_FULL_ASSERT
1405  tmp = ADC_GET_RESOLUTION(hadc);
1406  assert_param(IS_ADC_RANGE(tmp, AnalogWDGConfig->HighThreshold));
1407  assert_param(IS_ADC_RANGE(tmp, AnalogWDGConfig->LowThreshold));
1408 #endif /* USE_FULL_ASSERT */
1409 
1410  /* Process locked */
1411  __HAL_LOCK(hadc);
1412 
1413  if(AnalogWDGConfig->ITMode == ENABLE)
1414  {
1415  /* Enable the ADC Analog watchdog interrupt */
1417  }
1418  else
1419  {
1420  /* Disable the ADC Analog watchdog interrupt */
1422  }
1423 
1424  /* Clear AWDEN, JAWDEN and AWDSGL bits */
1426 
1427  /* Set the analog watchdog enable mode */
1428  hadc->Instance->CR1 |= AnalogWDGConfig->WatchdogMode;
1429 
1430  /* Set the high threshold */
1431  hadc->Instance->HTR = AnalogWDGConfig->HighThreshold;
1432 
1433  /* Set the low threshold */
1434  hadc->Instance->LTR = AnalogWDGConfig->LowThreshold;
1435 
1436  /* Clear the Analog watchdog channel select bits */
1437  hadc->Instance->CR1 &= ~ADC_CR1_AWDCH;
1438 
1439  /* Set the Analog watchdog channel */
1440  hadc->Instance->CR1 |= (uint32_t)((uint16_t)(AnalogWDGConfig->Channel));
1441 
1442  /* Process unlocked */
1443  __HAL_UNLOCK(hadc);
1444 
1445  /* Return function status */
1446  return HAL_OK;
1447 }
1448 
1475 uint32_t HAL_ADC_GetState(ADC_HandleTypeDef* hadc)
1476 {
1477  /* Return ADC state */
1478  return hadc->State;
1479 }
1480 
1487 uint32_t HAL_ADC_GetError(ADC_HandleTypeDef *hadc)
1488 {
1489  return hadc->ErrorCode;
1490 }
1491 
1500 /* Private functions ---------------------------------------------------------*/
1501 
1513 static void ADC_Init(ADC_HandleTypeDef* hadc)
1514 {
1515  /* Set ADC parameters */
1516  /* Set the ADC clock prescaler */
1517  ADC->CCR &= ~(ADC_CCR_ADCPRE);
1518  ADC->CCR |= hadc->Init.ClockPrescaler;
1519 
1520  /* Set ADC scan mode */
1521  hadc->Instance->CR1 &= ~(ADC_CR1_SCAN);
1522  hadc->Instance->CR1 |= ADC_CR1_SCANCONV(hadc->Init.ScanConvMode);
1523 
1524  /* Set ADC resolution */
1525  hadc->Instance->CR1 &= ~(ADC_CR1_RES);
1526  hadc->Instance->CR1 |= hadc->Init.Resolution;
1527 
1528  /* Set ADC data alignment */
1529  hadc->Instance->CR2 &= ~(ADC_CR2_ALIGN);
1530  hadc->Instance->CR2 |= hadc->Init.DataAlign;
1531 
1532  /* Enable external trigger if trigger selection is different of software */
1533  /* start. */
1534  /* Note: This configuration keeps the hardware feature of parameter */
1535  /* ExternalTrigConvEdge "trigger edge none" equivalent to */
1536  /* software start. */
1538  {
1539  /* Select external trigger to start conversion */
1540  hadc->Instance->CR2 &= ~(ADC_CR2_EXTSEL);
1541  hadc->Instance->CR2 |= hadc->Init.ExternalTrigConv;
1542 
1543  /* Select external trigger polarity */
1544  hadc->Instance->CR2 &= ~(ADC_CR2_EXTEN);
1545  hadc->Instance->CR2 |= hadc->Init.ExternalTrigConvEdge;
1546  }
1547  else
1548  {
1549  /* Reset the external trigger */
1550  hadc->Instance->CR2 &= ~(ADC_CR2_EXTSEL);
1551  hadc->Instance->CR2 &= ~(ADC_CR2_EXTEN);
1552  }
1553 
1554  /* Enable or disable ADC continuous conversion mode */
1555  hadc->Instance->CR2 &= ~(ADC_CR2_CONT);
1557 
1558  if(hadc->Init.DiscontinuousConvMode != DISABLE)
1559  {
1561 
1562  /* Enable the selected ADC regular discontinuous mode */
1563  hadc->Instance->CR1 |= (uint32_t)ADC_CR1_DISCEN;
1564 
1565  /* Set the number of channels to be converted in discontinuous mode */
1566  hadc->Instance->CR1 &= ~(ADC_CR1_DISCNUM);
1568  }
1569  else
1570  {
1571  /* Disable the selected ADC regular discontinuous mode */
1572  hadc->Instance->CR1 &= ~(ADC_CR1_DISCEN);
1573  }
1574 
1575  /* Set ADC number of conversion */
1576  hadc->Instance->SQR1 &= ~(ADC_SQR1_L);
1577  hadc->Instance->SQR1 |= ADC_SQR1(hadc->Init.NbrOfConversion);
1578 
1579  /* Enable or disable ADC DMA continuous request */
1580  hadc->Instance->CR2 &= ~(ADC_CR2_DDS);
1582 
1583  /* Enable or disable ADC end of conversion selection */
1584  hadc->Instance->CR2 &= ~(ADC_CR2_EOCS);
1586 }
1587 
1594 static void ADC_DMAConvCplt(DMA_HandleTypeDef *hdma)
1595 {
1596  /* Retrieve ADC handle corresponding to current DMA handle */
1597  ADC_HandleTypeDef* hadc = ( ADC_HandleTypeDef* )((DMA_HandleTypeDef* )hdma)->Parent;
1598 
1599  /* Update state machine on conversion status if not in error state */
1601  {
1602  /* Update ADC state machine */
1604 
1605  /* Determine whether any further conversion upcoming on group regular */
1606  /* by external trigger, continuous mode or scan sequence on going. */
1607  /* Note: On STM32F7, there is no independent flag of end of sequence. */
1608  /* The test of scan sequence on going is done either with scan */
1609  /* sequence disabled or with end of conversion flag set to */
1610  /* of end of sequence. */
1611  if(ADC_IS_SOFTWARE_START_REGULAR(hadc) &&
1612  (hadc->Init.ContinuousConvMode == DISABLE) &&
1613  (HAL_IS_BIT_CLR(hadc->Instance->SQR1, ADC_SQR1_L) ||
1615  {
1616  /* Disable ADC end of single conversion interrupt on group regular */
1617  /* Note: Overrun interrupt was enabled with EOC interrupt in */
1618  /* HAL_ADC_Start_IT(), but is not disabled here because can be used */
1619  /* by overrun IRQ process below. */
1621 
1622  /* Set ADC state */
1624 
1626  {
1628  }
1629  }
1630 
1631  /* Conversion complete callback */
1633  }
1634  else
1635  {
1636  /* Call DMA error callback */
1637  hadc->DMA_Handle->XferErrorCallback(hdma);
1638  }
1639 }
1640 
1647 static void ADC_DMAHalfConvCplt(DMA_HandleTypeDef *hdma)
1648 {
1649  ADC_HandleTypeDef* hadc = ( ADC_HandleTypeDef* )((DMA_HandleTypeDef* )hdma)->Parent;
1650  /* Conversion complete callback */
1652 }
1653 
1660 static void ADC_DMAError(DMA_HandleTypeDef *hdma)
1661 {
1662  ADC_HandleTypeDef* hadc = ( ADC_HandleTypeDef* )((DMA_HandleTypeDef* )hdma)->Parent;
1664  /* Set ADC error code to DMA error */
1665  hadc->ErrorCode |= HAL_ADC_ERROR_DMA;
1666  HAL_ADC_ErrorCallback(hadc);
1667 }
1668 
1677 #endif /* HAL_ADC_MODULE_ENABLED */
1678 
1686 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
#define ADC_FLAG_AWD
#define CLEAR_BIT(REG, BIT)
Definition: stm32f7xx.h:180
#define HAL_ADC_STATE_BUSY_INTERNAL
#define IS_ADC_SAMPLE_TIME(__TIME__)
void HAL_ADC_IRQHandler(ADC_HandleTypeDef *hadc)
#define IS_ADC_REGULAR_RANK(__RANK__)
#define IS_ADC_EOCSelection(__EOCSelection__)
#define __HAL_ADC_GET_FLAG(__HANDLE__, __FLAG__)
Get the selected ADC&#39;s flag status.
HAL_StatusTypeDef HAL_ADC_AnalogWDGConfig(ADC_HandleTypeDef *hadc, ADC_AnalogWDGConfTypeDef *AnalogWDGConfig)
HAL_StatusTypeDef HAL_ADC_DeInit(ADC_HandleTypeDef *hadc)
uint32_t DiscontinuousConvMode
void HAL_ADC_ConvHalfCpltCallback(ADC_HandleTypeDef *hadc)
Structure definition of ADC channel for regular group.
__IO uint32_t JSQR
Definition: stm32f745xx.h:220
__IO uint32_t SQR2
Definition: stm32f745xx.h:218
DMA_HandleTypeDef * DMA_Handle
#define HAL_ADC_STATE_REG_OVR
HAL_StatusTypeDef HAL_DMA_Abort(DMA_HandleTypeDef *hdma)
#define ADC_SQR1_L
Definition: stm32f745xx.h:1562
#define ADC_CHANNEL_TEMPSENSOR
#define HAL_ADC_STATE_REG_EOC
#define ADC_SQR1_RK(_CHANNELNB_, _RANKNB_)
Set the selected regular channel rank for rank between 13 and 16.
ADC_TypeDef * Instance
HAL_StatusTypeDef HAL_ADC_Stop_IT(ADC_HandleTypeDef *hadc)
#define ADC
Definition: stm32f745xx.h:1293
#define assert_param(expr)
Include module&#39;s header file.
void HAL_ADC_ErrorCallback(ADC_HandleTypeDef *hadc)
#define ADC_FLAG_JSTRT
HAL_StatusTypeDef HAL_ADC_PollForEvent(ADC_HandleTypeDef *hadc, uint32_t EventType, uint32_t Timeout)
#define ADC_CHANNEL_VREFINT
uint32_t SystemCoreClock
#define ADC_CHANNEL_18
void HAL_ADC_LevelOutOfWindowCallback(ADC_HandleTypeDef *hadc)
#define ADC_CR2_DDS
Definition: stm32f745xx.h:1417
#define __HAL_ADC_DISABLE(__HANDLE__)
Disable the ADC peripheral.
#define ADC_CR2_CONT
Definition: stm32f745xx.h:1415
#define ADC_CHANNEL_VBAT
#define ADC_FLAG_JEOC
#define ADC_SQR2_SQ7
Definition: stm32f745xx.h:1569
#define ADC_SQR1_SQ13
Definition: stm32f745xx.h:1538
#define ADC_SQR3_RK(_CHANNELNB_, _RANKNB_)
Set the selected regular channel rank for rank between 1 and 6.
#define ADC_IT_AWD
#define ADC_CR2_CONTINUOUS(_CONTINUOUS_MODE_)
Enable ADC continuous conversion mode.
#define ADC_SOFTWARE_START
#define IS_ADC_EXT_TRIG(__REGTRIG__)
#define ADC_SQR2_RK(_CHANNELNB_, _RANKNB_)
Set the selected regular channel rank for rank between 7 and 12.
#define __HAL_UNLOCK(__HANDLE__)
#define ADC_CLEAR_ERRORCODE(__HANDLE__)
Clear ADC error code (set it to error code: "no error")
#define ADC_FLAG_STRT
HAL_StatusTypeDef HAL_DMA_Start_IT(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t DataLength)
#define HAL_ADC_ERROR_DMA
void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef *hadc)
#define IS_ADC_ALL_INSTANCE(__INSTANCE__)
Definition: stm32f745xx.h:8782
#define ADC_CR1_DISCEN
Definition: stm32f745xx.h:1400
#define ADC_CR1_DISCNUM
Definition: stm32f745xx.h:1402
#define HAL_ADC_STATE_INJ_EOC
#define HAL_ADC_ERROR_OVR
#define __HAL_ADC_ENABLE_IT(__HANDLE__, __INTERRUPT__)
Enable the ADC end of conversion interrupt.
#define ADC_SMPR2(_SAMPLETIME_, _CHANNELNB_)
Set the ADC&#39;s sample time for channel numbers between 0 and 9.
#define ADC_SMPR2_SMP0
Definition: stm32f745xx.h:1478
#define ADC_CR2_EXTSEL
Definition: stm32f745xx.h:1429
HAL_StatusTypeDef HAL_ADC_PollForConversion(ADC_HandleTypeDef *hadc, uint32_t Timeout)
#define IS_ADC_REGULAR_LENGTH(__LENGTH__)
#define ADC_CR1_SCAN
Definition: stm32f745xx.h:1397
HAL_LockTypeDef Lock
#define ADC_FLAG_OVR
uint32_t ExternalTrigConvEdge
void(* XferCpltCallback)(struct __DMA_HandleTypeDef *hdma)
__IO uint32_t CR2
Definition: stm32f745xx.h:208
#define __HAL_LOCK(__HANDLE__)
#define ADC_CR1_DISCONTINUOUS(_NBR_DISCONTINUOUSCONV_)
Configures the number of discontinuous conversions for the regular group channels.
#define NULL
Definition: usbd_def.h:53
#define ADC_CR1_JAWDEN
Definition: stm32f745xx.h:1406
#define IS_ADC_CHANNEL(CHANNEL)
#define HAL_MAX_DELAY
HAL_StatusTypeDef HAL_ADC_Start_IT(ADC_HandleTypeDef *hadc)
#define ADC_IS_SOFTWARE_START_REGULAR(__HANDLE__)
Test if conversion trigger of regular group is software start or external trigger.
HAL_StatusTypeDef HAL_ADC_Stop_DMA(ADC_HandleTypeDef *hadc)
#define __IO
Definition: core_cm0.h:213
HAL_StatusTypeDef HAL_ADC_Init(ADC_HandleTypeDef *hadc)
#define HAL_ADC_STATE_ERROR_CONFIG
void HAL_ADC_MspDeInit(ADC_HandleTypeDef *hadc)
HAL_StatusTypeDef HAL_ADC_Start(ADC_HandleTypeDef *hadc)
#define ADC_CCR_TSVREFE
Definition: stm32f745xx.h:1735
#define IS_ADC_REGULAR_DISC_NUMBER(__NUMBER__)
#define READ_BIT(REG, BIT)
Definition: stm32f7xx.h:182
This file contains all the functions prototypes for the HAL module driver.
#define HAL_ADC_STATE_AWD1
#define ADC_CR2_SWSTART
Definition: stm32f745xx.h:1437
#define HAL_IS_BIT_CLR(REG, BIT)
#define ADC_CR1_AWDSGL
Definition: stm32f745xx.h:1398
#define __HAL_ADC_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__)
Check if the specified ADC interrupt source is enabled or disabled.
#define ADC_STATE_CLR_SET
Simultaneously clears and sets specific bits of the handle State.
void HAL_ADC_MspInit(ADC_HandleTypeDef *hadc)
uint32_t NbrOfDiscConversion
#define ADC_CR2_EOCSelection(_EOCSelection_MODE_)
Enable the ADC end of conversion selection.
#define ADC_IT_EOC
#define __HAL_ADC_DISABLE_IT(__HANDLE__, __INTERRUPT__)
Disable the ADC end of conversion interrupt.
#define ADC_JSQR_JL
Definition: stm32f745xx.h:1669
#define HAL_ADC_STATE_ERROR_INTERNAL
#define ADC_CR1_RES
Definition: stm32f745xx.h:1408
void(* XferHalfCpltCallback)(struct __DMA_HandleTypeDef *hdma)
#define ADC_AWD_EVENT
ADC Configuration multi-mode structure definition.
#define HAL_ADC_STATE_READY
#define ADC_STAB_DELAY_US
__IO uint32_t ErrorCode
#define ADC_CR2_EOCS
Definition: stm32f745xx.h:1418
#define ADC1
Definition: stm32f745xx.h:1294
__IO uint32_t LTR
Definition: stm32f745xx.h:216
#define UNUSED(x)
#define IS_ADC_ANALOG_WATCHDOG(__WATCHDOG__)
uint32_t HAL_ADC_GetValue(ADC_HandleTypeDef *hadc)
ADC handle Structure definition.
uint32_t DMAContinuousRequests
__IO uint32_t HTR
Definition: stm32f745xx.h:215
#define IS_ADC_EVENT_TYPE(__EVENT__)
#define ADC_IS_SOFTWARE_START_INJECTED(__HANDLE__)
Test if conversion trigger of injected group is software start or external trigger.
#define SET_BIT(REG, BIT)
Definition: stm32f7xx.h:178
#define ADC_IT_OVR
#define HAL_IS_BIT_SET(REG, BIT)
#define IS_ADC_EXT_TRIG_EDGE(__EDGE__)
#define ADC_SMPR1_SMP10
Definition: stm32f745xx.h:1440
#define HAL_ADC_STATE_REG_BUSY
HAL_StatusTypeDef HAL_ADC_Start_DMA(ADC_HandleTypeDef *hadc, uint32_t *pData, uint32_t Length)
#define ADC_CR1_JAUTO
Definition: stm32f745xx.h:1399
DMA handle Structure definition.
#define ADC_SMPR1(_SAMPLETIME_, _CHANNELNB_)
Set the ADC&#39;s sample time for channel numbers between 10 and 18.
#define IS_FUNCTIONAL_STATE(STATE)
Definition: stm32f7xx.h:163
#define ADC_CR2_ADON
Definition: stm32f745xx.h:1414
#define HAL_ADC_STATE_ERROR_DMA
#define IS_ADC_DATA_ALIGN(__ALIGN__)
__IO uint32_t CR1
Definition: stm32f745xx.h:207
__IO uint32_t SMPR1
Definition: stm32f745xx.h:209
__IO uint32_t SQR3
Definition: stm32f745xx.h:219
#define ADC_CCR_VBATE
Definition: stm32f745xx.h:1734
uint32_t HAL_ADC_GetError(ADC_HandleTypeDef *hadc)
#define ADC_FLAG_EOC
#define ADC_CR1_SCANCONV(_SCANCONV_MODE_)
Enable ADC scan mode.
#define ADC_SQR3_SQ1
Definition: stm32f745xx.h:1607
#define IS_ADC_RESOLUTION(__RESOLUTION__)
uint32_t HAL_ADC_GetState(ADC_HandleTypeDef *hadc)
#define HAL_ADC_STATE_INJ_BUSY
#define ADC_CCR_ADCPRE
Definition: stm32f745xx.h:1731
__IO uint32_t SMPR2
Definition: stm32f745xx.h:210
#define ADC_CHANNEL_9
#define ADC_CR2_EXTEN
Definition: stm32f745xx.h:1434
#define HAL_ADC_STATE_RESET
HAL ADC state machine: ADC states definition (bitfields)
uint32_t ContinuousConvMode
HAL_StatusTypeDef
HAL Status structures definition.
__IO uint32_t SQR1
Definition: stm32f745xx.h:217
void(* XferErrorCallback)(struct __DMA_HandleTypeDef *hdma)
uint32_t HAL_GetTick(void)
Provides a tick value in millisecond.
#define ADC_CR2_DMA
Definition: stm32f745xx.h:1416
void HAL_ADCEx_InjectedConvCpltCallback(ADC_HandleTypeDef *hadc)
#define ADC_CR2_DMAContReq(_DMAContReq_MODE_)
Enable the ADC DMA continuous request.
ADC_InitTypeDef Init
#define ADC_CR1_AWDEN
Definition: stm32f745xx.h:1407
#define ADC_IT_JEOC
#define ADC_CCR_MULTI
Definition: stm32f745xx.h:1716
#define ADC_TEMPSENSOR_DELAY_US
#define ADC_SQR1(_NbrOfConversion_)
Set ADC Regular channel sequence length.
HAL_StatusTypeDef HAL_ADC_ConfigChannel(ADC_HandleTypeDef *hadc, ADC_ChannelConfTypeDef *sConfig)
#define __HAL_ADC_ENABLE(__HANDLE__)
Enable the ADC peripheral.
#define ADC_CR1_AWDCH
Definition: stm32f745xx.h:1388
#define __HAL_ADC_CLEAR_FLAG(__HANDLE__, __FLAG__)
Clear the ADC&#39;s pending flags.
#define IS_ADC_RANGE(__RESOLUTION__, __ADC_VALUE__)
__IO uint32_t DR
Definition: stm32f745xx.h:225
#define ADC_CR2_ALIGN
Definition: stm32f745xx.h:1419
#define ADC_GET_RESOLUTION(__HANDLE__)
Return resolution bits in CR1 register.
#define HAL_ADC_STATE_TIMEOUT
#define IS_ADC_CLOCKPRESCALER(__ADC_CLOCK__)
HAL_StatusTypeDef HAL_ADC_Stop(ADC_HandleTypeDef *hadc)