stm32f1xx_hal_adc_ex.h 47 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721
  1. /**
  2. ******************************************************************************
  3. * @file stm32f1xx_hal_adc_ex.h
  4. * @author MCD Application Team
  5. * @version V1.0.4
  6. * @date 29-April-2016
  7. * @brief Header file of ADC HAL extension module.
  8. ******************************************************************************
  9. * @attention
  10. *
  11. * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
  12. *
  13. * Redistribution and use in source and binary forms, with or without modification,
  14. * are permitted provided that the following conditions are met:
  15. * 1. Redistributions of source code must retain the above copyright notice,
  16. * this list of conditions and the following disclaimer.
  17. * 2. Redistributions in binary form must reproduce the above copyright notice,
  18. * this list of conditions and the following disclaimer in the documentation
  19. * and/or other materials provided with the distribution.
  20. * 3. Neither the name of STMicroelectronics nor the names of its contributors
  21. * may be used to endorse or promote products derived from this software
  22. * without specific prior written permission.
  23. *
  24. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  25. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  26. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  27. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  28. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  29. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  30. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  31. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  32. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  33. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  34. *
  35. ******************************************************************************
  36. */
  37. /* Define to prevent recursive inclusion -------------------------------------*/
  38. #ifndef __STM32F1xx_HAL_ADC_EX_H
  39. #define __STM32F1xx_HAL_ADC_EX_H
  40. #ifdef __cplusplus
  41. extern "C" {
  42. #endif
  43. /* Includes ------------------------------------------------------------------*/
  44. #include "stm32f1xx_hal_def.h"
  45. /** @addtogroup STM32F1xx_HAL_Driver
  46. * @{
  47. */
  48. /** @addtogroup ADCEx
  49. * @{
  50. */
  51. /* Exported types ------------------------------------------------------------*/
  52. /** @defgroup ADCEx_Exported_Types ADCEx Exported Types
  53. * @{
  54. */
  55. /**
  56. * @brief ADC Configuration injected Channel structure definition
  57. * @note Parameters of this structure are shared within 2 scopes:
  58. * - Scope channel: InjectedChannel, InjectedRank, InjectedSamplingTime, InjectedOffset
  59. * - Scope injected group (affects all channels of injected group): InjectedNbrOfConversion, InjectedDiscontinuousConvMode,
  60. * AutoInjectedConv, ExternalTrigInjecConvEdge, ExternalTrigInjecConv.
  61. * @note The setting of these parameters with function HAL_ADCEx_InjectedConfigChannel() is conditioned to ADC state.
  62. * ADC state can be either:
  63. * - For all parameters: ADC disabled (this is the only possible ADC state to modify parameter 'ExternalTrigInjecConv')
  64. * - For all except parameters 'ExternalTrigInjecConv': ADC enabled without conversion on going on injected group.
  65. */
  66. typedef struct
  67. {
  68. uint32_t InjectedChannel; /*!< Selection of ADC channel to configure
  69. This parameter can be a value of @ref ADC_channels
  70. Note: Depending on devices, some channels may not be available on package pins. Refer to device datasheet for channels availability.
  71. Note: On STM32F1 devices with several ADC: Only ADC1 can access internal measurement channels (VrefInt/TempSensor)
  72. Note: On STM32F10xx8 and STM32F10xxB devices: A low-amplitude voltage glitch may be generated (on ADC input 0) on the PA0 pin, when the ADC is converting with injection trigger.
  73. It is advised to distribute the analog channels so that Channel 0 is configured as an injected channel.
  74. Refer to errata sheet of these devices for more details. */
  75. uint32_t InjectedRank; /*!< Rank in the injected group sequencer
  76. This parameter must be a value of @ref ADCEx_injected_rank
  77. Note: In case of need to disable a channel or change order of conversion sequencer, rank containing a previous channel setting can be overwritten by the new channel setting (or parameter number of conversions can be adjusted) */
  78. uint32_t InjectedSamplingTime; /*!< Sampling time value to be set for the selected channel.
  79. Unit: ADC clock cycles
  80. Conversion time is the addition of sampling time and processing time (12.5 ADC clock cycles at ADC resolution 12 bits).
  81. This parameter can be a value of @ref ADC_sampling_times
  82. Caution: This parameter updates the parameter property of the channel, that can be used into regular and/or injected groups.
  83. If this same channel has been previously configured in the other group (regular/injected), it will be updated to last setting.
  84. Note: In case of usage of internal measurement channels (VrefInt/TempSensor),
  85. sampling time constraints must be respected (sampling time can be adjusted in function of ADC clock frequency and sampling time setting)
  86. Refer to device datasheet for timings values, parameters TS_vrefint, TS_temp (values rough order: 5us to 17.1us min). */
  87. uint32_t InjectedOffset; /*!< Defines the offset to be subtracted from the raw converted data (for channels set on injected group only).
  88. Offset value must be a positive number.
  89. Depending of ADC resolution selected (12, 10, 8 or 6 bits),
  90. this parameter must be a number between Min_Data = 0x000 and Max_Data = 0xFFF, 0x3FF, 0xFF or 0x3F respectively. */
  91. uint32_t InjectedNbrOfConversion; /*!< Specifies the number of ranks that will be converted within the injected group sequencer.
  92. To use the injected group sequencer and convert several ranks, parameter 'ScanConvMode' must be enabled.
  93. This parameter must be a number between Min_Data = 1 and Max_Data = 4.
  94. Caution: this setting impacts the entire injected group. Therefore, call of HAL_ADCEx_InjectedConfigChannel() to
  95. configure a channel on injected group can impact the configuration of other channels previously set. */
  96. uint32_t InjectedDiscontinuousConvMode; /*!< Specifies whether the conversions sequence of injected group is performed in Complete-sequence/Discontinuous-sequence (main sequence subdivided in successive parts).
  97. Discontinuous mode is used only if sequencer is enabled (parameter 'ScanConvMode'). If sequencer is disabled, this parameter is discarded.
  98. Discontinuous mode can be enabled only if continuous mode is disabled. If continuous mode is enabled, this parameter setting is discarded.
  99. This parameter can be set to ENABLE or DISABLE.
  100. Note: For injected group, number of discontinuous ranks increment is fixed to one-by-one.
  101. Caution: this setting impacts the entire injected group. Therefore, call of HAL_ADCEx_InjectedConfigChannel() to
  102. configure a channel on injected group can impact the configuration of other channels previously set. */
  103. uint32_t AutoInjectedConv; /*!< Enables or disables the selected ADC automatic injected group conversion after regular one
  104. This parameter can be set to ENABLE or DISABLE.
  105. Note: To use Automatic injected conversion, discontinuous mode must be disabled ('DiscontinuousConvMode' and 'InjectedDiscontinuousConvMode' set to DISABLE)
  106. Note: To use Automatic injected conversion, injected group external triggers must be disabled ('ExternalTrigInjecConv' set to ADC_SOFTWARE_START)
  107. Note: In case of DMA used with regular group: if DMA configured in normal mode (single shot) JAUTO will be stopped upon DMA transfer complete.
  108. To maintain JAUTO always enabled, DMA must be configured in circular mode.
  109. Caution: this setting impacts the entire injected group. Therefore, call of HAL_ADCEx_InjectedConfigChannel() to
  110. configure a channel on injected group can impact the configuration of other channels previously set. */
  111. uint32_t ExternalTrigInjecConv; /*!< Selects the external event used to trigger the conversion start of injected group.
  112. If set to ADC_INJECTED_SOFTWARE_START, external triggers are disabled.
  113. If set to external trigger source, triggering is on event rising edge.
  114. This parameter can be a value of @ref ADCEx_External_trigger_source_Injected
  115. Note: This parameter must be modified when ADC is disabled (before ADC start conversion or after ADC stop conversion).
  116. If ADC is enabled, this parameter setting is bypassed without error reporting (as it can be the expected behaviour in case of another parameter update on the fly)
  117. Caution: this setting impacts the entire injected group. Therefore, call of HAL_ADCEx_InjectedConfigChannel() to
  118. configure a channel on injected group can impact the configuration of other channels previously set. */
  119. }ADC_InjectionConfTypeDef;
  120. #if defined (STM32F101xG) || defined (STM32F103x6) || defined (STM32F103xB) || defined (STM32F105xC) || defined (STM32F107xC) || defined (STM32F103xE) || defined (STM32F103xG)
  121. /**
  122. * @brief Structure definition of ADC multimode
  123. * @note The setting of these parameters with function HAL_ADCEx_MultiModeConfigChannel() is conditioned to ADCs state (both ADCs of the common group).
  124. * State of ADCs of the common group must be: disabled.
  125. */
  126. typedef struct
  127. {
  128. uint32_t Mode; /*!< Configures the ADC to operate in independent or multi mode.
  129. This parameter can be a value of @ref ADCEx_Common_mode
  130. Note: In dual mode, a change of channel configuration generates a restart that can produce a loss of synchronization. It is recommended to disable dual mode before any configuration change.
  131. Note: In case of simultaneous mode used: Exactly the same sampling time should be configured for the 2 channels that will be sampled simultaneously by ACD1 and ADC2.
  132. Note: In case of interleaved mode used: To avoid overlap between conversions, maximum sampling time allowed is 7 ADC clock cycles for fast interleaved mode and 14 ADC clock cycles for slow interleaved mode.
  133. Note: Some multimode parameters are fixed on STM32F1 and can be configured on other STM32 devices with several ADC (multimode configuration structure can have additional parameters).
  134. The equivalences are:
  135. - Parameter 'DMAAccessMode': On STM32F1, this parameter is fixed to 1 DMA channel (one DMA channel for both ADC, DMA of ADC master). On other STM32 devices with several ADC, this is equivalent to parameter 'ADC_DMAACCESSMODE_12_10_BITS'.
  136. - Parameter 'TwoSamplingDelay': On STM32F1, this parameter is fixed to 7 or 14 ADC clock cycles depending on fast or slow interleaved mode selected. On other STM32 devices with several ADC, this is equivalent to parameter 'ADC_TWOSAMPLINGDELAY_7CYCLES' (for fast interleaved mode). */
  137. }ADC_MultiModeTypeDef;
  138. #endif /* STM32F101xG || defined STM32F103x6 || defined STM32F103xB || defined STM32F105xC || defined STM32F107xC || defined STM32F103xE || defined STM32F103xG */
  139. /**
  140. * @}
  141. */
  142. /* Exported constants --------------------------------------------------------*/
  143. /** @defgroup ADCEx_Exported_Constants ADCEx Exported Constants
  144. * @{
  145. */
  146. /** @defgroup ADCEx_injected_rank ADCEx rank into injected group
  147. * @{
  148. */
  149. #define ADC_INJECTED_RANK_1 ((uint32_t)0x00000001)
  150. #define ADC_INJECTED_RANK_2 ((uint32_t)0x00000002)
  151. #define ADC_INJECTED_RANK_3 ((uint32_t)0x00000003)
  152. #define ADC_INJECTED_RANK_4 ((uint32_t)0x00000004)
  153. /**
  154. * @}
  155. */
  156. /** @defgroup ADCEx_External_trigger_edge_Injected ADCEx external trigger enable for injected group
  157. * @{
  158. */
  159. #define ADC_EXTERNALTRIGINJECCONV_EDGE_NONE ((uint32_t)0x00000000)
  160. #define ADC_EXTERNALTRIGINJECCONV_EDGE_RISING ((uint32_t)ADC_CR2_JEXTTRIG)
  161. /**
  162. * @}
  163. */
  164. /** @defgroup ADC_External_trigger_source_Regular ADC External trigger selection for regular group
  165. * @{
  166. */
  167. /*!< List of external triggers with generic trigger name, independently of */
  168. /* ADC target, sorted by trigger name: */
  169. /*!< External triggers of regular group for ADC1&ADC2 only */
  170. #define ADC_EXTERNALTRIGCONV_T1_CC1 ADC1_2_EXTERNALTRIG_T1_CC1
  171. #define ADC_EXTERNALTRIGCONV_T1_CC2 ADC1_2_EXTERNALTRIG_T1_CC2
  172. #define ADC_EXTERNALTRIGCONV_T2_CC2 ADC1_2_EXTERNALTRIG_T2_CC2
  173. #define ADC_EXTERNALTRIGCONV_T3_TRGO ADC1_2_EXTERNALTRIG_T3_TRGO
  174. #define ADC_EXTERNALTRIGCONV_T4_CC4 ADC1_2_EXTERNALTRIG_T4_CC4
  175. #define ADC_EXTERNALTRIGCONV_EXT_IT11 ADC1_2_EXTERNALTRIG_EXT_IT11
  176. #if defined (STM32F103xE) || defined (STM32F103xG)
  177. /*!< External triggers of regular group for ADC3 only */
  178. #define ADC_EXTERNALTRIGCONV_T2_CC3 ADC3_EXTERNALTRIG_T2_CC3
  179. #define ADC_EXTERNALTRIGCONV_T3_CC1 ADC3_EXTERNALTRIG_T3_CC1
  180. #define ADC_EXTERNALTRIGCONV_T5_CC1 ADC3_EXTERNALTRIG_T5_CC1
  181. #define ADC_EXTERNALTRIGCONV_T5_CC3 ADC3_EXTERNALTRIG_T5_CC3
  182. #define ADC_EXTERNALTRIGCONV_T8_CC1 ADC3_EXTERNALTRIG_T8_CC1
  183. #endif /* STM32F103xE || defined STM32F103xG */
  184. /*!< External triggers of regular group for all ADC instances */
  185. #define ADC_EXTERNALTRIGCONV_T1_CC3 ADC1_2_3_EXTERNALTRIG_T1_CC3
  186. #if defined (STM32F101xE) || defined (STM32F101xG) || defined (STM32F103xE) || defined (STM32F103xG) || defined (STM32F105xC) || defined (STM32F107xC)
  187. /*!< Note: TIM8_TRGO is available on ADC1 and ADC2 only in high-density and */
  188. /* XL-density devices. */
  189. /* To use it on ADC or ADC2, a remap of trigger must be done from */
  190. /* EXTI line 11 to TIM8_TRGO with macro: */
  191. /* __HAL_AFIO_REMAP_ADC1_ETRGREG_ENABLE() */
  192. /* __HAL_AFIO_REMAP_ADC2_ETRGREG_ENABLE() */
  193. /* Note for internal constant value management: If TIM8_TRGO is available, */
  194. /* its definition is set to value for ADC1&ADC2 by default and changed to */
  195. /* value for ADC3 by HAL ADC driver if ADC3 is selected. */
  196. #define ADC_EXTERNALTRIGCONV_T8_TRGO ADC1_2_EXTERNALTRIG_T8_TRGO
  197. #endif /* STM32F101xE || STM32F101xG || STM32F103xE || STM32F103xG || STM32F105xC || STM32F107xC */
  198. #define ADC_SOFTWARE_START ADC1_2_3_SWSTART
  199. /**
  200. * @}
  201. */
  202. /** @defgroup ADCEx_External_trigger_source_Injected ADCEx External trigger selection for injected group
  203. * @{
  204. */
  205. /*!< List of external triggers with generic trigger name, independently of */
  206. /* ADC target, sorted by trigger name: */
  207. /*!< External triggers of injected group for ADC1&ADC2 only */
  208. #define ADC_EXTERNALTRIGINJECCONV_T2_TRGO ADC1_2_EXTERNALTRIGINJEC_T2_TRGO
  209. #define ADC_EXTERNALTRIGINJECCONV_T2_CC1 ADC1_2_EXTERNALTRIGINJEC_T2_CC1
  210. #define ADC_EXTERNALTRIGINJECCONV_T3_CC4 ADC1_2_EXTERNALTRIGINJEC_T3_CC4
  211. #define ADC_EXTERNALTRIGINJECCONV_T4_TRGO ADC1_2_EXTERNALTRIGINJEC_T4_TRGO
  212. #define ADC_EXTERNALTRIGINJECCONV_EXT_IT15 ADC1_2_EXTERNALTRIGINJEC_EXT_IT15
  213. #if defined (STM32F103xE) || defined (STM32F103xG)
  214. /*!< External triggers of injected group for ADC3 only */
  215. #define ADC_EXTERNALTRIGINJECCONV_T4_CC3 ADC3_EXTERNALTRIGINJEC_T4_CC3
  216. #define ADC_EXTERNALTRIGINJECCONV_T8_CC2 ADC3_EXTERNALTRIGINJEC_T8_CC2
  217. #define ADC_EXTERNALTRIGINJECCONV_T5_TRGO ADC3_EXTERNALTRIGINJEC_T5_TRGO
  218. #define ADC_EXTERNALTRIGINJECCONV_T5_CC4 ADC3_EXTERNALTRIGINJEC_T5_CC4
  219. #endif /* STM32F103xE || defined STM32F103xG */
  220. /*!< External triggers of injected group for all ADC instances */
  221. #define ADC_EXTERNALTRIGINJECCONV_T1_CC4 ADC1_2_3_EXTERNALTRIGINJEC_T1_CC4
  222. #define ADC_EXTERNALTRIGINJECCONV_T1_TRGO ADC1_2_3_EXTERNALTRIGINJEC_T1_TRGO
  223. #if defined (STM32F101xE) || defined (STM32F101xG) || defined (STM32F103xE) || defined (STM32F103xG) || defined (STM32F105xC) || defined (STM32F107xC)
  224. /*!< Note: TIM8_CC4 is available on ADC1 and ADC2 only in high-density and */
  225. /* XL-density devices. */
  226. /* To use it on ADC1 or ADC2, a remap of trigger must be done from */
  227. /* EXTI line 11 to TIM8_CC4 with macro: */
  228. /* __HAL_AFIO_REMAP_ADC1_ETRGINJ_ENABLE() */
  229. /* __HAL_AFIO_REMAP_ADC2_ETRGINJ_ENABLE() */
  230. /* Note for internal constant value management: If TIM8_CC4 is available, */
  231. /* its definition is set to value for ADC1&ADC2 by default and changed to */
  232. /* value for ADC3 by HAL ADC driver if ADC3 is selected. */
  233. #define ADC_EXTERNALTRIGINJECCONV_T8_CC4 ADC1_2_EXTERNALTRIGINJEC_T8_CC4
  234. #endif /* STM32F101xE || STM32F101xG || STM32F103xE || STM32F103xG || STM32F105xC || STM32F107xC */
  235. #define ADC_INJECTED_SOFTWARE_START ADC1_2_3_JSWSTART
  236. /**
  237. * @}
  238. */
  239. #if defined (STM32F101xG) || defined (STM32F103x6) || defined (STM32F103xB) || defined (STM32F105xC) || defined (STM32F107xC) || defined (STM32F103xE) || defined (STM32F103xG)
  240. /** @defgroup ADCEx_Common_mode ADC Extended Dual ADC Mode
  241. * @{
  242. */
  243. #define ADC_MODE_INDEPENDENT ((uint32_t)(0x00000000)) /*!< ADC dual mode disabled (ADC independent mode) */
  244. #define ADC_DUALMODE_REGSIMULT_INJECSIMULT ((uint32_t)( ADC_CR1_DUALMOD_0)) /*!< ADC dual mode enabled: Combined regular simultaneous + injected simultaneous mode, on groups regular and injected */
  245. #define ADC_DUALMODE_REGSIMULT_ALTERTRIG ((uint32_t)( ADC_CR1_DUALMOD_1 )) /*!< ADC dual mode enabled: Combined regular simultaneous + alternate trigger mode, on groups regular and injected */
  246. #define ADC_DUALMODE_INJECSIMULT_INTERLFAST ((uint32_t)( ADC_CR1_DUALMOD_1 | ADC_CR1_DUALMOD_0)) /*!< ADC dual mode enabled: Combined injected simultaneous + fast interleaved mode, on groups regular and injected (delay between ADC sampling phases: 7 ADC clock cycles (equivalent to parameter "TwoSamplingDelay" set to "ADC_TWOSAMPLINGDELAY_7CYCLES" on other STM32 devices)) */
  247. #define ADC_DUALMODE_INJECSIMULT_INTERLSLOW ((uint32_t)( ADC_CR1_DUALMOD_2 )) /*!< ADC dual mode enabled: Combined injected simultaneous + slow Interleaved mode, on groups regular and injected (delay between ADC sampling phases: 14 ADC clock cycles (equivalent to parameter "TwoSamplingDelay" set to "ADC_TWOSAMPLINGDELAY_7CYCLES" on other STM32 devices)) */
  248. #define ADC_DUALMODE_INJECSIMULT ((uint32_t)( ADC_CR1_DUALMOD_2 | ADC_CR1_DUALMOD_0)) /*!< ADC dual mode enabled: Injected simultaneous mode, on group injected */
  249. #define ADC_DUALMODE_REGSIMULT ((uint32_t)( ADC_CR1_DUALMOD_2 | ADC_CR1_DUALMOD_1 )) /*!< ADC dual mode enabled: Regular simultaneous mode, on group regular */
  250. #define ADC_DUALMODE_INTERLFAST ((uint32_t)( ADC_CR1_DUALMOD_2 | ADC_CR1_DUALMOD_1 | ADC_CR1_DUALMOD_0)) /*!< ADC dual mode enabled: Fast interleaved mode, on group regular (delay between ADC sampling phases: 7 ADC clock cycles (equivalent to parameter "TwoSamplingDelay" set to "ADC_TWOSAMPLINGDELAY_7CYCLES" on other STM32 devices)) */
  251. #define ADC_DUALMODE_INTERLSLOW ((uint32_t)(ADC_CR1_DUALMOD_3 )) /*!< ADC dual mode enabled: Slow interleaved mode, on group regular (delay between ADC sampling phases: 14 ADC clock cycles (equivalent to parameter "TwoSamplingDelay" set to "ADC_TWOSAMPLINGDELAY_7CYCLES" on other STM32 devices)) */
  252. #define ADC_DUALMODE_ALTERTRIG ((uint32_t)(ADC_CR1_DUALMOD_3 | ADC_CR1_DUALMOD_0)) /*!< ADC dual mode enabled: Alternate trigger mode, on group injected */
  253. /**
  254. * @}
  255. */
  256. #endif /* STM32F101xG || defined STM32F103x6 || defined STM32F103xB || defined STM32F105xC || defined STM32F107xC || defined STM32F103xE || defined STM32F103xG */
  257. /**
  258. * @}
  259. */
  260. /* Private constants ---------------------------------------------------------*/
  261. /** @addtogroup ADCEx_Private_Constants ADCEx Private Constants
  262. * @{
  263. */
  264. /** @defgroup ADCEx_Internal_HAL_driver_Ext_trig_src_Regular ADC Extended Internal HAL driver trigger selection for regular group
  265. * @{
  266. */
  267. /* List of external triggers of regular group for ADC1, ADC2, ADC3 (if ADC */
  268. /* instance is available on the selected device). */
  269. /* (used internally by HAL driver. To not use into HAL structure parameters) */
  270. /* External triggers of regular group for ADC1&ADC2 (if ADCx available) */
  271. #define ADC1_2_EXTERNALTRIG_T1_CC1 ((uint32_t) 0x00000000)
  272. #define ADC1_2_EXTERNALTRIG_T1_CC2 ((uint32_t)( ADC_CR2_EXTSEL_0))
  273. #define ADC1_2_EXTERNALTRIG_T2_CC2 ((uint32_t)( ADC_CR2_EXTSEL_1 | ADC_CR2_EXTSEL_0))
  274. #define ADC1_2_EXTERNALTRIG_T3_TRGO ((uint32_t)(ADC_CR2_EXTSEL_2 ))
  275. #define ADC1_2_EXTERNALTRIG_T4_CC4 ((uint32_t)(ADC_CR2_EXTSEL_2 | ADC_CR2_EXTSEL_0))
  276. #define ADC1_2_EXTERNALTRIG_EXT_IT11 ((uint32_t)(ADC_CR2_EXTSEL_2 | ADC_CR2_EXTSEL_1 ))
  277. #if defined (STM32F101xE) || defined (STM32F101xG) || defined (STM32F103xE) || defined (STM32F103xG)
  278. /* Note: TIM8_TRGO is available on ADC1 and ADC2 only in high-density and */
  279. /* XL-density devices. */
  280. #define ADC1_2_EXTERNALTRIG_T8_TRGO ADC1_2_EXTERNALTRIG_EXT_IT11
  281. #endif
  282. #if defined (STM32F103xE) || defined (STM32F103xG)
  283. /* External triggers of regular group for ADC3 */
  284. #define ADC3_EXTERNALTRIG_T3_CC1 ADC1_2_EXTERNALTRIG_T1_CC1
  285. #define ADC3_EXTERNALTRIG_T2_CC3 ADC1_2_EXTERNALTRIG_T1_CC2
  286. #define ADC3_EXTERNALTRIG_T8_CC1 ADC1_2_EXTERNALTRIG_T2_CC2
  287. #define ADC3_EXTERNALTRIG_T8_TRGO ADC1_2_EXTERNALTRIG_T3_TRGO
  288. #define ADC3_EXTERNALTRIG_T5_CC1 ADC1_2_EXTERNALTRIG_T4_CC4
  289. #define ADC3_EXTERNALTRIG_T5_CC3 ADC1_2_EXTERNALTRIG_EXT_IT11
  290. #endif
  291. /* External triggers of regular group for ADC1&ADC2&ADC3 (if ADCx available) */
  292. #define ADC1_2_3_EXTERNALTRIG_T1_CC3 ((uint32_t)( ADC_CR2_EXTSEL_1 ))
  293. #define ADC1_2_3_SWSTART ((uint32_t)(ADC_CR2_EXTSEL_2 | ADC_CR2_EXTSEL_1 | ADC_CR2_EXTSEL_0))
  294. /**
  295. * @}
  296. */
  297. /** @defgroup ADCEx_Internal_HAL_driver_Ext_trig_src_Injected ADC Extended Internal HAL driver trigger selection for injected group
  298. * @{
  299. */
  300. /* List of external triggers of injected group for ADC1, ADC2, ADC3 (if ADC */
  301. /* instance is available on the selected device). */
  302. /* (used internally by HAL driver. To not use into HAL structure parameters) */
  303. /* External triggers of injected group for ADC1&ADC2 (if ADCx available) */
  304. #define ADC1_2_EXTERNALTRIGINJEC_T2_TRGO ((uint32_t)( ADC_CR2_JEXTSEL_1 ))
  305. #define ADC1_2_EXTERNALTRIGINJEC_T2_CC1 ((uint32_t)( ADC_CR2_JEXTSEL_1 | ADC_CR2_JEXTSEL_0))
  306. #define ADC1_2_EXTERNALTRIGINJEC_T3_CC4 ((uint32_t)(ADC_CR2_JEXTSEL_2 ))
  307. #define ADC1_2_EXTERNALTRIGINJEC_T4_TRGO ((uint32_t)(ADC_CR2_JEXTSEL_2 | ADC_CR2_JEXTSEL_0))
  308. #define ADC1_2_EXTERNALTRIGINJEC_EXT_IT15 ((uint32_t)(ADC_CR2_JEXTSEL_2 | ADC_CR2_JEXTSEL_1 ))
  309. #if defined (STM32F101xE) || defined (STM32F101xG) || defined (STM32F103xE) || defined (STM32F103xG)
  310. /* Note: TIM8_CC4 is available on ADC1 and ADC2 only in high-density and */
  311. /* XL-density devices. */
  312. #define ADC1_2_EXTERNALTRIGINJEC_T8_CC4 ADC1_2_EXTERNALTRIGINJEC_EXT_IT15
  313. #endif
  314. #if defined (STM32F103xE) || defined (STM32F103xG)
  315. /* External triggers of injected group for ADC3 */
  316. #define ADC3_EXTERNALTRIGINJEC_T4_CC3 ADC1_2_EXTERNALTRIGINJEC_T2_TRGO
  317. #define ADC3_EXTERNALTRIGINJEC_T8_CC2 ADC1_2_EXTERNALTRIGINJEC_T2_CC1
  318. #define ADC3_EXTERNALTRIGINJEC_T8_CC4 ADC1_2_EXTERNALTRIGINJEC_T3_CC4
  319. #define ADC3_EXTERNALTRIGINJEC_T5_TRGO ADC1_2_EXTERNALTRIGINJEC_T4_TRGO
  320. #define ADC3_EXTERNALTRIGINJEC_T5_CC4 ADC1_2_EXTERNALTRIGINJEC_EXT_IT15
  321. #endif /* STM32F103xE || defined STM32F103xG */
  322. /* External triggers of injected group for ADC1&ADC2&ADC3 (if ADCx available) */
  323. #define ADC1_2_3_EXTERNALTRIGINJEC_T1_TRGO ((uint32_t) 0x00000000)
  324. #define ADC1_2_3_EXTERNALTRIGINJEC_T1_CC4 ((uint32_t)( ADC_CR2_JEXTSEL_0))
  325. #define ADC1_2_3_JSWSTART ((uint32_t)(ADC_CR2_JEXTSEL_2 | ADC_CR2_JEXTSEL_1 | ADC_CR2_JEXTSEL_0))
  326. /**
  327. * @}
  328. */
  329. /**
  330. * @}
  331. */
  332. /* Exported macro ------------------------------------------------------------*/
  333. /* Private macro -------------------------------------------------------------*/
  334. /** @defgroup ADCEx_Private_Macro ADCEx Private Macro
  335. * @{
  336. */
  337. /* Macro reserved for internal HAL driver usage, not intended to be used in */
  338. /* code of final user. */
  339. /**
  340. * @brief For devices with 3 ADCs: Defines the external trigger source
  341. * for regular group according to ADC into common group ADC1&ADC2 or
  342. * ADC3 (some triggers with same source have different value to
  343. * be programmed into ADC EXTSEL bits of CR2 register).
  344. * For devices with 2 ADCs or less: this macro makes no change.
  345. * @param __HANDLE__: ADC handle
  346. * @param __EXT_TRIG_CONV__: External trigger selected for regular group.
  347. * @retval External trigger to be programmed into EXTSEL bits of CR2 register
  348. */
  349. #if defined (STM32F103xE) || defined (STM32F103xG)
  350. #define ADC_CFGR_EXTSEL(__HANDLE__, __EXT_TRIG_CONV__) \
  351. (( (((__HANDLE__)->Instance) == ADC3) \
  352. )? \
  353. ( ( (__EXT_TRIG_CONV__) == ADC_EXTERNALTRIGCONV_T8_TRGO \
  354. )? \
  355. (ADC3_EXTERNALTRIG_T8_TRGO) \
  356. : \
  357. (__EXT_TRIG_CONV__) \
  358. ) \
  359. : \
  360. (__EXT_TRIG_CONV__) \
  361. )
  362. #else
  363. #define ADC_CFGR_EXTSEL(__HANDLE__, __EXT_TRIG_CONV__) \
  364. (__EXT_TRIG_CONV__)
  365. #endif /* STM32F103xE || STM32F103xG */
  366. /**
  367. * @brief For devices with 3 ADCs: Defines the external trigger source
  368. * for injected group according to ADC into common group ADC1&ADC2 or
  369. * ADC3 (some triggers with same source have different value to
  370. * be programmed into ADC JEXTSEL bits of CR2 register).
  371. * For devices with 2 ADCs or less: this macro makes no change.
  372. * @param __HANDLE__: ADC handle
  373. * @param __EXT_TRIG_INJECTCONV__: External trigger selected for injected group.
  374. * @retval External trigger to be programmed into JEXTSEL bits of CR2 register
  375. */
  376. #if defined (STM32F103xE) || defined (STM32F103xG)
  377. #define ADC_CFGR_JEXTSEL(__HANDLE__, __EXT_TRIG_INJECTCONV__) \
  378. (( (((__HANDLE__)->Instance) == ADC3) \
  379. )? \
  380. ( ( (__EXT_TRIG_INJECTCONV__) == ADC_EXTERNALTRIGINJECCONV_T8_CC4 \
  381. )? \
  382. (ADC3_EXTERNALTRIGINJEC_T8_CC4) \
  383. : \
  384. (__EXT_TRIG_INJECTCONV__) \
  385. ) \
  386. : \
  387. (__EXT_TRIG_INJECTCONV__) \
  388. )
  389. #else
  390. #define ADC_CFGR_JEXTSEL(__HANDLE__, __EXT_TRIG_INJECTCONV__) \
  391. (__EXT_TRIG_INJECTCONV__)
  392. #endif /* STM32F103xE || STM32F103xG */
  393. /**
  394. * @brief Verification if multimode is enabled for the selected ADC (multimode ADC master or ADC slave) (applicable for devices with several ADCs)
  395. * @param __HANDLE__: ADC handle
  396. * @retval Multimode state: RESET if multimode is disabled, other value if multimode is enabled
  397. */
  398. #if defined (STM32F101xG) || defined (STM32F103x6) || defined (STM32F103xB) || defined (STM32F105xC) || defined (STM32F107xC) || defined (STM32F103xE) || defined (STM32F103xG)
  399. #define ADC_MULTIMODE_IS_ENABLE(__HANDLE__) \
  400. (( (((__HANDLE__)->Instance) == ADC1) || (((__HANDLE__)->Instance) == ADC2) \
  401. )? \
  402. (ADC1->CR1 & ADC_CR1_DUALMOD) \
  403. : \
  404. (RESET) \
  405. )
  406. #else
  407. #define ADC_MULTIMODE_IS_ENABLE(__HANDLE__) \
  408. (RESET)
  409. #endif /* STM32F101xG || defined STM32F103x6 || defined STM32F103xB || defined STM32F105xC || defined STM32F107xC || defined STM32F103xE || defined STM32F103xG */
  410. /**
  411. * @brief Verification of condition for ADC start conversion: ADC must be in non-multimode, or multimode with handle of ADC master (applicable for devices with several ADCs)
  412. * @param __HANDLE__: ADC handle
  413. * @retval None
  414. */
  415. #if defined (STM32F101xG) || defined (STM32F103x6) || defined (STM32F103xB) || defined (STM32F105xC) || defined (STM32F107xC) || defined (STM32F103xE) || defined (STM32F103xG)
  416. #define ADC_NONMULTIMODE_OR_MULTIMODEMASTER(__HANDLE__) \
  417. (( (((__HANDLE__)->Instance) == ADC2) \
  418. )? \
  419. ((ADC1->CR1 & ADC_CR1_DUALMOD) == RESET) \
  420. : \
  421. (!RESET) \
  422. )
  423. #else
  424. #define ADC_NONMULTIMODE_OR_MULTIMODEMASTER(__HANDLE__) \
  425. (!RESET)
  426. #endif /* STM32F101xG || defined STM32F103x6 || defined STM32F103xB || defined STM32F105xC || defined STM32F107xC || defined STM32F103xE || defined STM32F103xG */
  427. /**
  428. * @brief Check ADC multimode setting: In case of multimode, check whether ADC master of the selected ADC has feature auto-injection enabled (applicable for devices with several ADCs)
  429. * @param __HANDLE__: ADC handle
  430. * @retval None
  431. */
  432. #if defined (STM32F101xG) || defined (STM32F103x6) || defined (STM32F103xB) || defined (STM32F105xC) || defined (STM32F107xC) || defined (STM32F103xE) || defined (STM32F103xG)
  433. #define ADC_MULTIMODE_AUTO_INJECTED(__HANDLE__) \
  434. (( (((__HANDLE__)->Instance) == ADC1) || (((__HANDLE__)->Instance) == ADC2) \
  435. )? \
  436. (ADC1->CR1 & ADC_CR1_JAUTO) \
  437. : \
  438. (RESET) \
  439. )
  440. #else
  441. #define ADC_MULTIMODE_AUTO_INJECTED(__HANDLE__) \
  442. (RESET)
  443. #endif /* STM32F101xG || defined STM32F103x6 || defined STM32F103xB || defined STM32F105xC || defined STM32F107xC || defined STM32F103xE || defined STM32F103xG */
  444. #if defined (STM32F101xG) || defined (STM32F103x6) || defined (STM32F103xB) || defined (STM32F105xC) || defined (STM32F107xC) || defined (STM32F103xE) || defined (STM32F103xG)
  445. /**
  446. * @brief Set handle of the other ADC sharing the common multimode settings
  447. * @param __HANDLE__: ADC handle
  448. * @param __HANDLE_OTHER_ADC__: other ADC handle
  449. * @retval None
  450. */
  451. #define ADC_COMMON_ADC_OTHER(__HANDLE__, __HANDLE_OTHER_ADC__) \
  452. ((__HANDLE_OTHER_ADC__)->Instance = ADC2)
  453. /**
  454. * @brief Set handle of the ADC slave associated to the ADC master
  455. * On STM32F1 devices, ADC slave is always ADC2 (this can be different
  456. * on other STM32 devices)
  457. * @param __HANDLE_MASTER__: ADC master handle
  458. * @param __HANDLE_SLAVE__: ADC slave handle
  459. * @retval None
  460. */
  461. #define ADC_MULTI_SLAVE(__HANDLE_MASTER__, __HANDLE_SLAVE__) \
  462. ((__HANDLE_SLAVE__)->Instance = ADC2)
  463. #endif /* STM32F101xG || defined STM32F103x6 || defined STM32F103xB || defined STM32F105xC || defined STM32F107xC || defined STM32F103xE || defined STM32F103xG */
  464. #define IS_ADC_INJECTED_RANK(CHANNEL) (((CHANNEL) == ADC_INJECTED_RANK_1) || \
  465. ((CHANNEL) == ADC_INJECTED_RANK_2) || \
  466. ((CHANNEL) == ADC_INJECTED_RANK_3) || \
  467. ((CHANNEL) == ADC_INJECTED_RANK_4) )
  468. #define IS_ADC_EXTTRIGINJEC_EDGE(EDGE) (((EDGE) == ADC_EXTERNALTRIGINJECCONV_EDGE_NONE) || \
  469. ((EDGE) == ADC_EXTERNALTRIGINJECCONV_EDGE_RISING) )
  470. /** @defgroup ADCEx_injected_nb_conv_verification ADCEx injected nb conv verification
  471. * @{
  472. */
  473. #define IS_ADC_INJECTED_NB_CONV(LENGTH) \
  474. (((LENGTH) >= ((uint32_t)1)) && ((LENGTH) <= ((uint32_t)4)))
  475. /**
  476. * @}
  477. */
  478. #if defined (STM32F100xB) || defined (STM32F100xE) || defined (STM32F101x6) || defined (STM32F101xB) || defined (STM32F102x6) || defined (STM32F102xB) || defined (STM32F103x6) || defined (STM32F103xB) || defined (STM32F105xC) || defined (STM32F107xC)
  479. #define IS_ADC_EXTTRIG(REGTRIG) (((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC1) || \
  480. ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC2) || \
  481. ((REGTRIG) == ADC_EXTERNALTRIGCONV_T2_CC2) || \
  482. ((REGTRIG) == ADC_EXTERNALTRIGCONV_T3_TRGO) || \
  483. ((REGTRIG) == ADC_EXTERNALTRIGCONV_T4_CC4) || \
  484. ((REGTRIG) == ADC_EXTERNALTRIGCONV_EXT_IT11) || \
  485. \
  486. ((REGTRIG) == ADC_SOFTWARE_START) )
  487. #endif
  488. #if defined (STM32F101xE) || defined (STM32F101xG)
  489. #define IS_ADC_EXTTRIG(REGTRIG) (((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC1) || \
  490. ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC2) || \
  491. ((REGTRIG) == ADC_EXTERNALTRIGCONV_T2_CC2) || \
  492. ((REGTRIG) == ADC_EXTERNALTRIGCONV_T3_TRGO) || \
  493. ((REGTRIG) == ADC_EXTERNALTRIGCONV_T4_CC4) || \
  494. ((REGTRIG) == ADC_EXTERNALTRIGCONV_EXT_IT11) || \
  495. ((REGTRIG) == ADC_EXTERNALTRIGCONV_T8_TRGO) || \
  496. \
  497. ((REGTRIG) == ADC_SOFTWARE_START) )
  498. #endif
  499. #if defined (STM32F103xE) || defined (STM32F103xG)
  500. #define IS_ADC_EXTTRIG(REGTRIG) (((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC1) || \
  501. ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC2) || \
  502. ((REGTRIG) == ADC_EXTERNALTRIGCONV_T2_CC2) || \
  503. ((REGTRIG) == ADC_EXTERNALTRIGCONV_T3_TRGO) || \
  504. ((REGTRIG) == ADC_EXTERNALTRIGCONV_T4_CC4) || \
  505. ((REGTRIG) == ADC_EXTERNALTRIGCONV_EXT_IT11) || \
  506. \
  507. ((REGTRIG) == ADC_EXTERNALTRIGCONV_T3_CC1) || \
  508. ((REGTRIG) == ADC_EXTERNALTRIGCONV_T2_CC3) || \
  509. ((REGTRIG) == ADC_EXTERNALTRIGCONV_T8_CC1) || \
  510. ((REGTRIG) == ADC_EXTERNALTRIGCONV_T5_CC1) || \
  511. ((REGTRIG) == ADC_EXTERNALTRIGCONV_T5_CC3) || \
  512. \
  513. ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC3) || \
  514. ((REGTRIG) == ADC_EXTERNALTRIGCONV_T8_TRGO) || \
  515. ((REGTRIG) == ADC_SOFTWARE_START) )
  516. #endif
  517. #if defined (STM32F100xB) || defined (STM32F100xE) || defined (STM32F101x6) || defined (STM32F101xB) || defined (STM32F102x6) || defined (STM32F102xB) || defined (STM32F103x6) || defined (STM32F103xB) || defined (STM32F105xC) || defined (STM32F107xC)
  518. #define IS_ADC_EXTTRIGINJEC(REGTRIG) (((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_T2_TRGO) || \
  519. ((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_T2_CC1) || \
  520. ((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_T3_CC4) || \
  521. ((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_T4_TRGO) || \
  522. ((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_EXT_IT15) || \
  523. \
  524. ((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_T1_CC4) || \
  525. ((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_T1_TRGO) || \
  526. \
  527. ((REGTRIG) == ADC_INJECTED_SOFTWARE_START) )
  528. #endif
  529. #if defined (STM32F101xE) || defined (STM32F101xG)
  530. #define IS_ADC_EXTTRIGINJEC(REGTRIG) (((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_T2_TRGO) || \
  531. ((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_T2_CC1) || \
  532. ((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_T3_CC4) || \
  533. ((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_T4_TRGO) || \
  534. ((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_EXT_IT15) || \
  535. \
  536. ((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_T1_CC4) || \
  537. ((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_T1_TRGO) || \
  538. ((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_T8_CC4) || \
  539. \
  540. ((REGTRIG) == ADC_INJECTED_SOFTWARE_START) )
  541. #endif
  542. #if defined (STM32F103xE) || defined (STM32F103xG)
  543. #define IS_ADC_EXTTRIGINJEC(REGTRIG) (((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_T2_TRGO) || \
  544. ((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_T2_CC1) || \
  545. ((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_T3_CC4) || \
  546. ((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_T4_TRGO) || \
  547. ((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_T5_CC4) || \
  548. ((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_EXT_IT15) || \
  549. \
  550. ((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_T4_CC3) || \
  551. ((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_T8_CC2) || \
  552. ((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_T5_TRGO) || \
  553. ((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_T5_CC4) || \
  554. \
  555. ((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_T1_CC4) || \
  556. ((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_T1_TRGO) || \
  557. ((REGTRIG) == ADC_EXTERNALTRIGINJECCONV_T8_CC4) || \
  558. \
  559. ((REGTRIG) == ADC_INJECTED_SOFTWARE_START) )
  560. #endif
  561. #if defined (STM32F101xG) || defined (STM32F103x6) || defined (STM32F103xB) || defined (STM32F105xC) || defined (STM32F107xC) || defined (STM32F103xE) || defined (STM32F103xG)
  562. #define IS_ADC_MODE(MODE) (((MODE) == ADC_MODE_INDEPENDENT) || \
  563. ((MODE) == ADC_DUALMODE_REGSIMULT_INJECSIMULT) || \
  564. ((MODE) == ADC_DUALMODE_REGSIMULT_ALTERTRIG) || \
  565. ((MODE) == ADC_DUALMODE_INJECSIMULT_INTERLFAST) || \
  566. ((MODE) == ADC_DUALMODE_INJECSIMULT_INTERLSLOW) || \
  567. ((MODE) == ADC_DUALMODE_INJECSIMULT) || \
  568. ((MODE) == ADC_DUALMODE_REGSIMULT) || \
  569. ((MODE) == ADC_DUALMODE_INTERLFAST) || \
  570. ((MODE) == ADC_DUALMODE_INTERLSLOW) || \
  571. ((MODE) == ADC_DUALMODE_ALTERTRIG) )
  572. #endif /* STM32F101xG || defined STM32F103x6 || defined STM32F103xB || defined STM32F105xC || defined STM32F107xC || defined STM32F103xE || defined STM32F103xG */
  573. /**
  574. * @}
  575. */
  576. /* Exported functions --------------------------------------------------------*/
  577. /** @addtogroup ADCEx_Exported_Functions
  578. * @{
  579. */
  580. /* IO operation functions *****************************************************/
  581. /** @addtogroup ADCEx_Exported_Functions_Group1
  582. * @{
  583. */
  584. /* ADC calibration */
  585. HAL_StatusTypeDef HAL_ADCEx_Calibration_Start(ADC_HandleTypeDef* hadc);
  586. /* Blocking mode: Polling */
  587. HAL_StatusTypeDef HAL_ADCEx_InjectedStart(ADC_HandleTypeDef* hadc);
  588. HAL_StatusTypeDef HAL_ADCEx_InjectedStop(ADC_HandleTypeDef* hadc);
  589. HAL_StatusTypeDef HAL_ADCEx_InjectedPollForConversion(ADC_HandleTypeDef* hadc, uint32_t Timeout);
  590. /* Non-blocking mode: Interruption */
  591. HAL_StatusTypeDef HAL_ADCEx_InjectedStart_IT(ADC_HandleTypeDef* hadc);
  592. HAL_StatusTypeDef HAL_ADCEx_InjectedStop_IT(ADC_HandleTypeDef* hadc);
  593. #if defined (STM32F101xG) || defined (STM32F103x6) || defined (STM32F103xB) || defined (STM32F105xC) || defined (STM32F107xC) || defined (STM32F103xE) || defined (STM32F103xG)
  594. /* ADC multimode */
  595. HAL_StatusTypeDef HAL_ADCEx_MultiModeStart_DMA(ADC_HandleTypeDef *hadc, uint32_t *pData, uint32_t Length);
  596. HAL_StatusTypeDef HAL_ADCEx_MultiModeStop_DMA(ADC_HandleTypeDef *hadc);
  597. #endif /* STM32F101xG || defined STM32F103x6 || defined STM32F103xB || defined STM32F105xC || defined STM32F107xC || defined STM32F103xE || defined STM32F103xG */
  598. /* ADC retrieve conversion value intended to be used with polling or interruption */
  599. uint32_t HAL_ADCEx_InjectedGetValue(ADC_HandleTypeDef* hadc, uint32_t InjectedRank);
  600. #if defined (STM32F101xG) || defined (STM32F103x6) || defined (STM32F103xB) || defined (STM32F105xC) || defined (STM32F107xC) || defined (STM32F103xE) || defined (STM32F103xG)
  601. uint32_t HAL_ADCEx_MultiModeGetValue(ADC_HandleTypeDef *hadc);
  602. #endif /* STM32F101xG || defined STM32F103x6 || defined STM32F103xB || defined STM32F105xC || defined STM32F107xC || defined STM32F103xE || defined STM32F103xG */
  603. /* ADC IRQHandler and Callbacks used in non-blocking modes (Interruption) */
  604. void HAL_ADCEx_InjectedConvCpltCallback(ADC_HandleTypeDef* hadc);
  605. /**
  606. * @}
  607. */
  608. /* Peripheral Control functions ***********************************************/
  609. /** @addtogroup ADCEx_Exported_Functions_Group2
  610. * @{
  611. */
  612. HAL_StatusTypeDef HAL_ADCEx_InjectedConfigChannel(ADC_HandleTypeDef* hadc,ADC_InjectionConfTypeDef* sConfigInjected);
  613. #if defined (STM32F101xG) || defined (STM32F103x6) || defined (STM32F103xB) || defined (STM32F105xC) || defined (STM32F107xC) || defined (STM32F103xE) || defined (STM32F103xG)
  614. HAL_StatusTypeDef HAL_ADCEx_MultiModeConfigChannel(ADC_HandleTypeDef *hadc, ADC_MultiModeTypeDef *multimode);
  615. #endif /* STM32F101xG || defined STM32F103x6 || defined STM32F103xB || defined STM32F105xC || defined STM32F107xC || defined STM32F103xE || defined STM32F103xG */
  616. /**
  617. * @}
  618. */
  619. /**
  620. * @}
  621. */
  622. /**
  623. * @}
  624. */
  625. /**
  626. * @}
  627. */
  628. #ifdef __cplusplus
  629. }
  630. #endif
  631. #endif /* __STM32F1xx_HAL_ADC_EX_H */
  632. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/