You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

377 lines
23 KiB

  1. /**
  2. ******************************************************************************
  3. * @file stm32f7xx_hal_adc.h
  4. * @author MCD Application Team
  5. * @version V1.2.2
  6. * @date 14-April-2017
  7. * @brief Header file of ADC HAL module.
  8. ******************************************************************************
  9. * @attention
  10. *
  11. * <h2><center>&copy; COPYRIGHT(c) 2017 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 __STM32F7xx_ADC_EX_H
  39. #define __STM32F7xx_ADC_EX_H
  40. #ifdef __cplusplus
  41. extern "C" {
  42. #endif
  43. /* Includes ------------------------------------------------------------------*/
  44. #include "stm32f7xx_hal_def.h"
  45. /** @addtogroup STM32F7xx_HAL_Driver
  46. * @{
  47. */
  48. /** @addtogroup ADCEx
  49. * @{
  50. */
  51. /* Exported types ------------------------------------------------------------*/
  52. /** @defgroup ADCEx_Exported_Types ADC 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
  64. * - For all except parameters 'InjectedDiscontinuousConvMode' and 'AutoInjectedConv': ADC enabled without conversion on going on injected group.
  65. * - For parameters 'ExternalTrigInjecConv' and 'ExternalTrigInjecConvEdge': ADC enabled, even with conversion on going on injected group.
  66. */
  67. typedef struct
  68. {
  69. uint32_t InjectedChannel; /*!< Selection of ADC channel to configure
  70. This parameter can be a value of @ref ADC_channels
  71. Note: Depending on devices, some channels may not be available on package pins. Refer to device datasheet for channels availability. */
  72. uint32_t InjectedRank; /*!< Rank in the injected group sequencer
  73. This parameter must be a value of @ref ADCEx_injected_rank
  74. 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) */
  75. uint32_t InjectedSamplingTime; /*!< Sampling time value to be set for the selected channel.
  76. Unit: ADC clock cycles
  77. Conversion time is the addition of sampling time and processing time (12 ADC clock cycles at ADC resolution 12 bits, 11 cycles at 10 bits, 9 cycles at 8 bits, 7 cycles at 6 bits).
  78. This parameter can be a value of @ref ADC_sampling_times
  79. Caution: This parameter updates the parameter property of the channel, that can be used into regular and/or injected groups.
  80. If this same channel has been previously configured in the other group (regular/injected), it will be updated to last setting.
  81. Note: In case of usage of internal measurement channels (VrefInt/Vbat/TempSensor),
  82. sampling time constraints must be respected (sampling time can be adjusted in function of ADC clock frequency and sampling time setting)
  83. Refer to device datasheet for timings values, parameters TS_vrefint, TS_temp (values rough order: 4us min). */
  84. uint32_t InjectedOffset; /*!< Defines the offset to be subtracted from the raw converted data (for channels set on injected group only).
  85. Offset value must be a positive number.
  86. Depending of ADC resolution selected (12, 10, 8 or 6 bits),
  87. this parameter must be a number between Min_Data = 0x000 and Max_Data = 0xFFF, 0x3FF, 0xFF or 0x3F respectively. */
  88. uint32_t InjectedNbrOfConversion; /*!< Specifies the number of ranks that will be converted within the injected group sequencer.
  89. To use the injected group sequencer and convert several ranks, parameter 'ScanConvMode' must be enabled.
  90. This parameter must be a number between Min_Data = 1 and Max_Data = 4.
  91. Caution: this setting impacts the entire injected group. Therefore, call of HAL_ADCEx_InjectedConfigChannel() to
  92. configure a channel on injected group can impact the configuration of other channels previously set. */
  93. uint32_t InjectedDiscontinuousConvMode; /*!< Specifies whether the conversions sequence of injected group is performed in Complete-sequence/Discontinuous-sequence (main sequence subdivided in successive parts).
  94. Discontinuous mode is used only if sequencer is enabled (parameter 'ScanConvMode'). If sequencer is disabled, this parameter is discarded.
  95. Discontinuous mode can be enabled only if continuous mode is disabled. If continuous mode is enabled, this parameter setting is discarded.
  96. This parameter can be set to ENABLE or DISABLE.
  97. Note: For injected group, number of discontinuous ranks increment is fixed to one-by-one.
  98. Caution: this setting impacts the entire injected group. Therefore, call of HAL_ADCEx_InjectedConfigChannel() to
  99. configure a channel on injected group can impact the configuration of other channels previously set. */
  100. uint32_t AutoInjectedConv; /*!< Enables or disables the selected ADC automatic injected group conversion after regular one
  101. This parameter can be set to ENABLE or DISABLE.
  102. Note: To use Automatic injected conversion, discontinuous mode must be disabled ('DiscontinuousConvMode' and 'InjectedDiscontinuousConvMode' set to DISABLE)
  103. Note: To use Automatic injected conversion, injected group external triggers must be disabled ('ExternalTrigInjecConv' set to ADC_SOFTWARE_START)
  104. 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.
  105. To maintain JAUTO always enabled, DMA must be configured in circular mode.
  106. Caution: this setting impacts the entire injected group. Therefore, call of HAL_ADCEx_InjectedConfigChannel() to
  107. configure a channel on injected group can impact the configuration of other channels previously set. */
  108. uint32_t ExternalTrigInjecConv; /*!< Selects the external event used to trigger the conversion start of injected group.
  109. If set to ADC_INJECTED_SOFTWARE_START, external triggers are disabled.
  110. If set to external trigger source, triggering is on event rising edge.
  111. This parameter can be a value of @ref ADCEx_External_trigger_Source_Injected
  112. Note: This parameter must be modified when ADC is disabled (before ADC start conversion or after ADC stop conversion).
  113. 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)
  114. Caution: this setting impacts the entire injected group. Therefore, call of HAL_ADCEx_InjectedConfigChannel() to
  115. configure a channel on injected group can impact the configuration of other channels previously set. */
  116. uint32_t ExternalTrigInjecConvEdge; /*!< Selects the external trigger edge of injected group.
  117. This parameter can be a value of @ref ADCEx_External_trigger_edge_Injected.
  118. If trigger is set to ADC_INJECTED_SOFTWARE_START, this parameter is discarded.
  119. Caution: this setting impacts the entire injected group. Therefore, call of HAL_ADCEx_InjectedConfigChannel() to
  120. configure a channel on injected group can impact the configuration of other channels previously set. */
  121. }ADC_InjectionConfTypeDef;
  122. /**
  123. * @brief ADC Configuration multi-mode structure definition
  124. */
  125. typedef struct
  126. {
  127. uint32_t Mode; /*!< Configures the ADC to operate in independent or multi mode.
  128. This parameter can be a value of @ref ADCEx_Common_mode */
  129. uint32_t DMAAccessMode; /*!< Configures the Direct memory access mode for multi ADC mode.
  130. This parameter can be a value of @ref ADCEx_Direct_memory_access_mode_for_multi_mode */
  131. uint32_t TwoSamplingDelay; /*!< Configures the Delay between 2 sampling phases.
  132. This parameter can be a value of @ref ADC_delay_between_2_sampling_phases */
  133. }ADC_MultiModeTypeDef;
  134. /**
  135. * @}
  136. */
  137. /* Exported constants --------------------------------------------------------*/
  138. /** @defgroup ADCEx_Exported_Constants ADC Exported Constants
  139. * @{
  140. */
  141. /** @defgroup ADCEx_Common_mode ADC Common Mode
  142. * @{
  143. */
  144. #define ADC_MODE_INDEPENDENT ((uint32_t)0x00000000U)
  145. #define ADC_DUALMODE_REGSIMULT_INJECSIMULT ((uint32_t)ADC_CCR_MULTI_0)
  146. #define ADC_DUALMODE_REGSIMULT_ALTERTRIG ((uint32_t)ADC_CCR_MULTI_1)
  147. #define ADC_DUALMODE_INJECSIMULT ((uint32_t)(ADC_CCR_MULTI_2 | ADC_CCR_MULTI_0))
  148. #define ADC_DUALMODE_REGSIMULT ((uint32_t)(ADC_CCR_MULTI_2 | ADC_CCR_MULTI_1))
  149. #define ADC_DUALMODE_INTERL ((uint32_t)(ADC_CCR_MULTI_2 | ADC_CCR_MULTI_1 | ADC_CCR_MULTI_0))
  150. #define ADC_DUALMODE_ALTERTRIG ((uint32_t)(ADC_CCR_MULTI_3 | ADC_CCR_MULTI_0))
  151. #define ADC_TRIPLEMODE_REGSIMULT_INJECSIMULT ((uint32_t)(ADC_CCR_MULTI_4 | ADC_CCR_MULTI_0))
  152. #define ADC_TRIPLEMODE_REGSIMULT_AlterTrig ((uint32_t)(ADC_CCR_MULTI_4 | ADC_CCR_MULTI_1))
  153. #define ADC_TRIPLEMODE_INJECSIMULT ((uint32_t)(ADC_CCR_MULTI_4 | ADC_CCR_MULTI_2 | ADC_CCR_MULTI_0))
  154. #define ADC_TRIPLEMODE_REGSIMULT ((uint32_t)(ADC_CCR_MULTI_4 | ADC_CCR_MULTI_2 | ADC_CCR_MULTI_1))
  155. #define ADC_TRIPLEMODE_INTERL ((uint32_t)(ADC_CCR_MULTI_4 | ADC_CCR_MULTI_2 | ADC_CCR_MULTI_1 | ADC_CCR_MULTI_0))
  156. #define ADC_TRIPLEMODE_ALTERTRIG ((uint32_t)(ADC_CCR_MULTI_4 | ADC_CCR_MULTI_3 | ADC_CCR_MULTI_0))
  157. /**
  158. * @}
  159. */
  160. /** @defgroup ADCEx_Direct_memory_access_mode_for_multi_mode ADC Direct Memory Access Mode For Multi Mode
  161. * @{
  162. */
  163. #define ADC_DMAACCESSMODE_DISABLED ((uint32_t)0x00000000U) /*!< DMA mode disabled */
  164. #define ADC_DMAACCESSMODE_1 ((uint32_t)ADC_CCR_DMA_0) /*!< DMA mode 1 enabled (2 / 3 half-words one by one - 1 then 2 then 3)*/
  165. #define ADC_DMAACCESSMODE_2 ((uint32_t)ADC_CCR_DMA_1) /*!< DMA mode 2 enabled (2 / 3 half-words by pairs - 2&1 then 1&3 then 3&2)*/
  166. #define ADC_DMAACCESSMODE_3 ((uint32_t)ADC_CCR_DMA) /*!< DMA mode 3 enabled (2 / 3 bytes by pairs - 2&1 then 1&3 then 3&2) */
  167. /**
  168. * @}
  169. */
  170. /** @defgroup ADCEx_External_trigger_edge_Injected ADC External Trigger Edge Injected
  171. * @{
  172. */
  173. #define ADC_EXTERNALTRIGINJECCONVEDGE_NONE ((uint32_t)0x00000000U)
  174. #define ADC_EXTERNALTRIGINJECCONVEDGE_RISING ((uint32_t)ADC_CR2_JEXTEN_0)
  175. #define ADC_EXTERNALTRIGINJECCONVEDGE_FALLING ((uint32_t)ADC_CR2_JEXTEN_1)
  176. #define ADC_EXTERNALTRIGINJECCONVEDGE_RISINGFALLING ((uint32_t)ADC_CR2_JEXTEN)
  177. /**
  178. * @}
  179. */
  180. /** @defgroup ADCEx_External_trigger_Source_Injected ADC External Trigger Source Injected
  181. * @{
  182. */
  183. #define ADC_EXTERNALTRIGINJECCONV_T1_TRGO ((uint32_t)0x00000000U)
  184. #define ADC_EXTERNALTRIGINJECCONV_T1_CC4 ((uint32_t)ADC_CR2_JEXTSEL_0)
  185. #define ADC_EXTERNALTRIGINJECCONV_T2_TRGO ((uint32_t)ADC_CR2_JEXTSEL_1)
  186. #define ADC_EXTERNALTRIGINJECCONV_T2_CC1 ((uint32_t)(ADC_CR2_JEXTSEL_1 | ADC_CR2_JEXTSEL_0))
  187. #define ADC_EXTERNALTRIGINJECCONV_T3_CC4 ((uint32_t)ADC_CR2_JEXTSEL_2)
  188. #define ADC_EXTERNALTRIGINJECCONV_T4_TRGO ((uint32_t)(ADC_CR2_JEXTSEL_2 | ADC_CR2_JEXTSEL_0))
  189. #define ADC_EXTERNALTRIGINJECCONV_T8_CC4 ((uint32_t)(ADC_CR2_JEXTSEL_2 | ADC_CR2_JEXTSEL_1 | ADC_CR2_JEXTSEL_0))
  190. #define ADC_EXTERNALTRIGINJECCONV_T1_TRGO2 ((uint32_t)ADC_CR2_JEXTSEL_3)
  191. #define ADC_EXTERNALTRIGINJECCONV_T8_TRGO ((uint32_t)(ADC_CR2_JEXTSEL_3 | ADC_CR2_JEXTSEL_0))
  192. #define ADC_EXTERNALTRIGINJECCONV_T8_TRGO2 ((uint32_t)(ADC_CR2_JEXTSEL_3 | ADC_CR2_JEXTSEL_1))
  193. #define ADC_EXTERNALTRIGINJECCONV_T3_CC3 ((uint32_t)(ADC_CR2_JEXTSEL_3 | ADC_CR2_JEXTSEL_1 | ADC_CR2_JEXTSEL_0))
  194. #define ADC_EXTERNALTRIGINJECCONV_T5_TRGO ((uint32_t)(ADC_CR2_JEXTSEL_3 | ADC_CR2_JEXTSEL_2))
  195. #define ADC_EXTERNALTRIGINJECCONV_T3_CC1 ((uint32_t)(ADC_CR2_JEXTSEL_3 | ADC_CR2_JEXTSEL_2 | ADC_CR2_JEXTSEL_0))
  196. #define ADC_EXTERNALTRIGINJECCONV_T6_TRGO ((uint32_t)(ADC_CR2_JEXTSEL_3 | ADC_CR2_JEXTSEL_2 | ADC_CR2_JEXTSEL_1))
  197. #define ADC_INJECTED_SOFTWARE_START ((uint32_t)ADC_CR2_JEXTSEL + 1)
  198. /**
  199. * @}
  200. */
  201. /** @defgroup ADCEx_injected_rank ADC Injected Channel Rank
  202. * @{
  203. */
  204. #define ADC_INJECTED_RANK_1 ((uint32_t)0x00000001U)
  205. #define ADC_INJECTED_RANK_2 ((uint32_t)0x00000002U)
  206. #define ADC_INJECTED_RANK_3 ((uint32_t)0x00000003U)
  207. #define ADC_INJECTED_RANK_4 ((uint32_t)0x00000004U)
  208. /**
  209. * @}
  210. */
  211. /** @defgroup ADCEx_channels ADC Specific Channels
  212. * @{
  213. */
  214. #define ADC_CHANNEL_TEMPSENSOR ((uint32_t)ADC_CHANNEL_18 | 0x10000000U)
  215. /**
  216. * @}
  217. */
  218. /**
  219. * @}
  220. */
  221. /* Exported macro ------------------------------------------------------------*/
  222. /** @defgroup ADC_Exported_Macros ADC Exported Macros
  223. * @{
  224. */
  225. /**
  226. * @}
  227. */
  228. /* Exported functions --------------------------------------------------------*/
  229. /** @addtogroup ADCEx_Exported_Functions
  230. * @{
  231. */
  232. /** @addtogroup ADCEx_Exported_Functions_Group1
  233. * @{
  234. */
  235. /* I/O operation functions ******************************************************/
  236. HAL_StatusTypeDef HAL_ADCEx_InjectedStart(ADC_HandleTypeDef* hadc);
  237. HAL_StatusTypeDef HAL_ADCEx_InjectedStop(ADC_HandleTypeDef* hadc);
  238. HAL_StatusTypeDef HAL_ADCEx_InjectedPollForConversion(ADC_HandleTypeDef* hadc, uint32_t Timeout);
  239. HAL_StatusTypeDef HAL_ADCEx_InjectedStart_IT(ADC_HandleTypeDef* hadc);
  240. HAL_StatusTypeDef HAL_ADCEx_InjectedStop_IT(ADC_HandleTypeDef* hadc);
  241. uint32_t HAL_ADCEx_InjectedGetValue(ADC_HandleTypeDef* hadc, uint32_t InjectedRank);
  242. HAL_StatusTypeDef HAL_ADCEx_MultiModeStart_DMA(ADC_HandleTypeDef* hadc, uint32_t* pData, uint32_t Length);
  243. HAL_StatusTypeDef HAL_ADCEx_MultiModeStop_DMA(ADC_HandleTypeDef* hadc);
  244. uint32_t HAL_ADCEx_MultiModeGetValue(ADC_HandleTypeDef* hadc);
  245. void HAL_ADCEx_InjectedConvCpltCallback(ADC_HandleTypeDef* hadc);
  246. /* Peripheral Control functions *************************************************/
  247. HAL_StatusTypeDef HAL_ADCEx_InjectedConfigChannel(ADC_HandleTypeDef* hadc,ADC_InjectionConfTypeDef* sConfigInjected);
  248. HAL_StatusTypeDef HAL_ADCEx_MultiModeConfigChannel(ADC_HandleTypeDef* hadc, ADC_MultiModeTypeDef* multimode);
  249. /**
  250. * @}
  251. */
  252. /**
  253. * @}
  254. */
  255. /* Private types -------------------------------------------------------------*/
  256. /* Private variables ---------------------------------------------------------*/
  257. /* Private constants ---------------------------------------------------------*/
  258. /** @defgroup ADCEx_Private_Constants ADC Private Constants
  259. * @{
  260. */
  261. /**
  262. * @}
  263. */
  264. /* Private macros ------------------------------------------------------------*/
  265. /** @defgroup ADCEx_Private_Macros ADC Private Macros
  266. * @{
  267. */
  268. #define IS_ADC_CHANNEL(CHANNEL) (((CHANNEL) <= ADC_CHANNEL_18) || \
  269. ((CHANNEL) == ADC_CHANNEL_TEMPSENSOR))
  270. #define IS_ADC_MODE(__MODE__) (((__MODE__) == ADC_MODE_INDEPENDENT) || \
  271. ((__MODE__) == ADC_DUALMODE_REGSIMULT_INJECSIMULT) || \
  272. ((__MODE__) == ADC_DUALMODE_REGSIMULT_ALTERTRIG) || \
  273. ((__MODE__) == ADC_DUALMODE_INJECSIMULT) || \
  274. ((__MODE__) == ADC_DUALMODE_REGSIMULT) || \
  275. ((__MODE__) == ADC_DUALMODE_INTERL) || \
  276. ((__MODE__) == ADC_DUALMODE_ALTERTRIG) || \
  277. ((__MODE__) == ADC_TRIPLEMODE_REGSIMULT_INJECSIMULT) || \
  278. ((__MODE__) == ADC_TRIPLEMODE_REGSIMULT_AlterTrig) || \
  279. ((__MODE__) == ADC_TRIPLEMODE_INJECSIMULT) || \
  280. ((__MODE__) == ADC_TRIPLEMODE_REGSIMULT) || \
  281. ((__MODE__) == ADC_TRIPLEMODE_INTERL) || \
  282. ((__MODE__) == ADC_TRIPLEMODE_ALTERTRIG))
  283. #define IS_ADC_DMA_ACCESS_MODE(__MODE__) (((__MODE__) == ADC_DMAACCESSMODE_DISABLED) || \
  284. ((__MODE__) == ADC_DMAACCESSMODE_1) || \
  285. ((__MODE__) == ADC_DMAACCESSMODE_2) || \
  286. ((__MODE__) == ADC_DMAACCESSMODE_3))
  287. #define IS_ADC_EXT_INJEC_TRIG_EDGE(__EDGE__) (((__EDGE__) == ADC_EXTERNALTRIGINJECCONVEDGE_NONE) || \
  288. ((__EDGE__) == ADC_EXTERNALTRIGINJECCONVEDGE_RISING) || \
  289. ((__EDGE__) == ADC_EXTERNALTRIGINJECCONVEDGE_FALLING) || \
  290. ((__EDGE__) == ADC_EXTERNALTRIGINJECCONVEDGE_RISINGFALLING))
  291. #define IS_ADC_EXT_INJEC_TRIG(__INJTRIG__) (((__INJTRIG__) == ADC_EXTERNALTRIGINJECCONV_T1_TRGO) || \
  292. ((__INJTRIG__) == ADC_EXTERNALTRIGINJECCONV_T1_CC4) || \
  293. ((__INJTRIG__) == ADC_EXTERNALTRIGINJECCONV_T2_TRGO) || \
  294. ((__INJTRIG__) == ADC_EXTERNALTRIGINJECCONV_T2_CC1) || \
  295. ((__INJTRIG__) == ADC_EXTERNALTRIGINJECCONV_T3_CC4) || \
  296. ((__INJTRIG__) == ADC_EXTERNALTRIGINJECCONV_T4_TRGO) || \
  297. ((__INJTRIG__) == ADC_EXTERNALTRIGINJECCONV_T8_CC4) || \
  298. ((__INJTRIG__) == ADC_EXTERNALTRIGINJECCONV_T1_TRGO2) || \
  299. ((__INJTRIG__) == ADC_EXTERNALTRIGINJECCONV_T8_TRGO) || \
  300. ((__INJTRIG__) == ADC_EXTERNALTRIGINJECCONV_T8_TRGO2) || \
  301. ((__INJTRIG__) == ADC_EXTERNALTRIGINJECCONV_T3_CC3) || \
  302. ((__INJTRIG__) == ADC_EXTERNALTRIGINJECCONV_T5_TRGO) || \
  303. ((__INJTRIG__) == ADC_EXTERNALTRIGINJECCONV_T3_CC1) || \
  304. ((__INJTRIG__) == ADC_EXTERNALTRIGINJECCONV_T6_TRGO) || \
  305. ((__INJTRIG__) == ADC_INJECTED_SOFTWARE_START))
  306. #define IS_ADC_INJECTED_RANK(__RANK__) (((__RANK__) == ADC_INJECTED_RANK_1) || \
  307. ((__RANK__) == ADC_INJECTED_RANK_2) || \
  308. ((__RANK__) == ADC_INJECTED_RANK_3) || \
  309. ((__RANK__) == ADC_INJECTED_RANK_4))
  310. #define IS_ADC_INJECTED_LENGTH(__LENGTH__) (((__LENGTH__) >= ((uint32_t)1)) && ((__LENGTH__) <= ((uint32_t)4)))
  311. /**
  312. * @brief Set the selected injected Channel rank.
  313. * @param _CHANNELNB_: Channel number.
  314. * @param _RANKNB_: Rank number.
  315. * @param _JSQR_JL_: Sequence length.
  316. * @retval None
  317. */
  318. #define ADC_JSQR(_CHANNELNB_, _RANKNB_,_JSQR_JL_) (((uint32_t)((uint16_t)(_CHANNELNB_))) << (5 * (uint8_t)(((_RANKNB_) + 3) - (_JSQR_JL_))))
  319. /**
  320. * @}
  321. */
  322. /* Private functions ---------------------------------------------------------*/
  323. /** @defgroup ADCEx_Private_Functions ADC Private Functions
  324. * @{
  325. */
  326. /**
  327. * @}
  328. */
  329. /**
  330. * @}
  331. */
  332. /**
  333. * @}
  334. */
  335. #ifdef __cplusplus
  336. }
  337. #endif
  338. #endif /*__STM32F7xx_ADC_EX_H */
  339. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/