stm32g0xx_hal_adc_ex.h 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. /**
  2. ******************************************************************************
  3. * @file stm32g0xx_hal_adc_ex.h
  4. * @author MCD Application Team
  5. * @brief Header file of ADC HAL extended module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * Copyright (c) 2018 STMicroelectronics.
  10. * All rights reserved.
  11. *
  12. * This software is licensed under terms that can be found in the LICENSE file
  13. * in the root directory of this software component.
  14. * If no LICENSE file comes with this software, it is provided AS-IS.
  15. *
  16. ******************************************************************************
  17. */
  18. /* Define to prevent recursive inclusion -------------------------------------*/
  19. #ifndef STM32G0xx_HAL_ADC_EX_H
  20. #define STM32G0xx_HAL_ADC_EX_H
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24. /* Includes ------------------------------------------------------------------*/
  25. #include "stm32g0xx_hal_def.h"
  26. /** @addtogroup STM32G0xx_HAL_Driver
  27. * @{
  28. */
  29. /** @addtogroup ADCEx
  30. * @{
  31. */
  32. /* Exported types ------------------------------------------------------------*/
  33. /** @defgroup ADCEx_Exported_Types ADC Extended Exported Types
  34. * @{
  35. */
  36. /**
  37. * @}
  38. */
  39. /* Exported constants --------------------------------------------------------*/
  40. /** @defgroup ADCEx_Exported_Constants ADC Extended Exported Constants
  41. * @{
  42. */
  43. /** @defgroup ADC_HAL_EC_GROUPS ADC instance - Groups
  44. * @{
  45. */
  46. #define ADC_REGULAR_GROUP (LL_ADC_GROUP_REGULAR) /*!< ADC group regular (available on
  47. all STM32 devices) */
  48. /**
  49. * @}
  50. */
  51. /**
  52. * @}
  53. */
  54. /* Exported macros -----------------------------------------------------------*/
  55. /* Private macros ------------------------------------------------------------*/
  56. /** @defgroup ADCEx_Private_Macro_internal_HAL_driver ADC Extended Private Macros
  57. * @{
  58. */
  59. /* Macro reserved for internal HAL driver usage, not intended to be used in */
  60. /* code of final user. */
  61. /**
  62. * @brief Check whether or not ADC is independent.
  63. * @param __HANDLE__ ADC handle.
  64. * @note When multimode feature is not available, the macro always returns SET.
  65. * @retval SET (ADC is independent) or RESET (ADC is not).
  66. */
  67. #define ADC_IS_INDEPENDENT(__HANDLE__) (SET)
  68. /**
  69. * @brief Calibration factor size verification (7 bits maximum).
  70. * @param __CALIBRATION_FACTOR__ Calibration factor value.
  71. * @retval SET (__CALIBRATION_FACTOR__ is within the authorized size) or RESET (__CALIBRATION_FACTOR__ is too large)
  72. */
  73. #define IS_ADC_CALFACT(__CALIBRATION_FACTOR__) ((__CALIBRATION_FACTOR__) <= (0x7FU))
  74. /**
  75. * @brief Verify the ADC oversampling ratio.
  76. * @param __RATIO__ programmed ADC oversampling ratio.
  77. * @retval SET (__RATIO__ is a valid value) or RESET (__RATIO__ is invalid)
  78. */
  79. #define IS_ADC_OVERSAMPLING_RATIO(__RATIO__) (((__RATIO__) == ADC_OVERSAMPLING_RATIO_2 ) || \
  80. ((__RATIO__) == ADC_OVERSAMPLING_RATIO_4 ) || \
  81. ((__RATIO__) == ADC_OVERSAMPLING_RATIO_8 ) || \
  82. ((__RATIO__) == ADC_OVERSAMPLING_RATIO_16 ) || \
  83. ((__RATIO__) == ADC_OVERSAMPLING_RATIO_32 ) || \
  84. ((__RATIO__) == ADC_OVERSAMPLING_RATIO_64 ) || \
  85. ((__RATIO__) == ADC_OVERSAMPLING_RATIO_128 ) || \
  86. ((__RATIO__) == ADC_OVERSAMPLING_RATIO_256 ))
  87. /**
  88. * @brief Verify the ADC oversampling shift.
  89. * @param __SHIFT__ programmed ADC oversampling shift.
  90. * @retval SET (__SHIFT__ is a valid value) or RESET (__SHIFT__ is invalid)
  91. */
  92. #define IS_ADC_RIGHT_BIT_SHIFT(__SHIFT__) (((__SHIFT__) == ADC_RIGHTBITSHIFT_NONE) || \
  93. ((__SHIFT__) == ADC_RIGHTBITSHIFT_1 ) || \
  94. ((__SHIFT__) == ADC_RIGHTBITSHIFT_2 ) || \
  95. ((__SHIFT__) == ADC_RIGHTBITSHIFT_3 ) || \
  96. ((__SHIFT__) == ADC_RIGHTBITSHIFT_4 ) || \
  97. ((__SHIFT__) == ADC_RIGHTBITSHIFT_5 ) || \
  98. ((__SHIFT__) == ADC_RIGHTBITSHIFT_6 ) || \
  99. ((__SHIFT__) == ADC_RIGHTBITSHIFT_7 ) || \
  100. ((__SHIFT__) == ADC_RIGHTBITSHIFT_8 ))
  101. /**
  102. * @brief Verify the ADC oversampling triggered mode.
  103. * @param __MODE__ programmed ADC oversampling triggered mode.
  104. * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid)
  105. */
  106. #define IS_ADC_TRIGGERED_OVERSAMPLING_MODE(__MODE__) (((__MODE__) == ADC_TRIGGEREDMODE_SINGLE_TRIGGER) || \
  107. ((__MODE__) == ADC_TRIGGEREDMODE_MULTI_TRIGGER) )
  108. /**
  109. * @}
  110. */
  111. /* Exported functions --------------------------------------------------------*/
  112. /** @addtogroup ADCEx_Exported_Functions
  113. * @{
  114. */
  115. /** @addtogroup ADCEx_Exported_Functions_Group1
  116. * @{
  117. */
  118. /* IO operation functions *****************************************************/
  119. /* ADC calibration */
  120. HAL_StatusTypeDef HAL_ADCEx_Calibration_Start(ADC_HandleTypeDef *hadc);
  121. uint32_t HAL_ADCEx_Calibration_GetValue(const ADC_HandleTypeDef *hadc);
  122. HAL_StatusTypeDef HAL_ADCEx_Calibration_SetValue(ADC_HandleTypeDef *hadc, uint32_t CalibrationFactor);
  123. /* ADC IRQHandler and Callbacks used in non-blocking modes (Interruption) */
  124. void HAL_ADCEx_LevelOutOfWindow2Callback(ADC_HandleTypeDef *hadc);
  125. void HAL_ADCEx_LevelOutOfWindow3Callback(ADC_HandleTypeDef *hadc);
  126. void HAL_ADCEx_EndOfSamplingCallback(ADC_HandleTypeDef *hadc);
  127. void HAL_ADCEx_ChannelConfigReadyCallback(ADC_HandleTypeDef *hadc);
  128. /**
  129. * @}
  130. */
  131. /** @addtogroup ADCEx_Exported_Functions_Group2
  132. * @{
  133. */
  134. /* Peripheral Control functions ***********************************************/
  135. HAL_StatusTypeDef HAL_ADCEx_DisableVoltageRegulator(ADC_HandleTypeDef *hadc);
  136. /**
  137. * @}
  138. */
  139. /**
  140. * @}
  141. */
  142. /**
  143. * @}
  144. */
  145. /**
  146. * @}
  147. */
  148. #ifdef __cplusplus
  149. }
  150. #endif
  151. #endif /* STM32G0xx_HAL_ADC_EX_H */