stm32f4xx_hal_adc.h 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766
  1. /**
  2. ******************************************************************************
  3. * @file stm32f4xx_hal_adc.h
  4. * @author MCD Application Team
  5. * @version V1.4.3
  6. * @date 11-December-2015
  7. * @brief Header file containing functions prototypes of ADC HAL library.
  8. ******************************************************************************
  9. * @attention
  10. *
  11. * <h2><center>&copy; COPYRIGHT(c) 2015 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 __STM32F4xx_ADC_H
  39. #define __STM32F4xx_ADC_H
  40. #ifdef __cplusplus
  41. extern "C" {
  42. #endif
  43. /* Includes ------------------------------------------------------------------*/
  44. #include "stm32f4xx_hal_def.h"
  45. /** @addtogroup STM32F4xx_HAL_Driver
  46. * @{
  47. */
  48. /** @addtogroup ADC
  49. * @{
  50. */
  51. /* Exported types ------------------------------------------------------------*/
  52. /** @defgroup ADC_Exported_Types ADC Exported Types
  53. * @{
  54. */
  55. /**
  56. * @brief HAL State structures definition
  57. */
  58. typedef enum
  59. {
  60. HAL_ADC_STATE_RESET = 0x00, /*!< ADC not yet initialized or disabled */
  61. HAL_ADC_STATE_READY = 0x01, /*!< ADC peripheral ready for use */
  62. HAL_ADC_STATE_BUSY = 0x02, /*!< An internal process is ongoing */
  63. HAL_ADC_STATE_BUSY_REG = 0x12, /*!< Regular conversion is ongoing */
  64. HAL_ADC_STATE_BUSY_INJ = 0x22, /*!< Injected conversion is ongoing */
  65. HAL_ADC_STATE_BUSY_INJ_REG = 0x32, /*!< Injected and regular conversion are ongoing */
  66. HAL_ADC_STATE_TIMEOUT = 0x03, /*!< Timeout state */
  67. HAL_ADC_STATE_ERROR = 0x04, /*!< ADC state error */
  68. HAL_ADC_STATE_EOC = 0x05, /*!< Conversion is completed */
  69. HAL_ADC_STATE_EOC_REG = 0x15, /*!< Regular conversion is completed */
  70. HAL_ADC_STATE_EOC_INJ = 0x25, /*!< Injected conversion is completed */
  71. HAL_ADC_STATE_EOC_INJ_REG = 0x35, /*!< Injected and regular conversion are completed */
  72. HAL_ADC_STATE_AWD = 0x06 /*!< ADC state analog watchdog */
  73. }HAL_ADC_StateTypeDef;
  74. /**
  75. * @brief ADC Init structure definition
  76. */
  77. typedef struct
  78. {
  79. uint32_t ClockPrescaler; /*!< Select the frequency of the clock to the ADC. The clock is common for
  80. all the ADCs.
  81. This parameter can be a value of @ref ADC_ClockPrescaler */
  82. uint32_t Resolution; /*!< Configures the ADC resolution dual mode.
  83. This parameter can be a value of @ref ADC_Resolution */
  84. uint32_t DataAlign; /*!< Specifies whether the ADC data alignment is left or right.
  85. This parameter can be a value of @ref ADC_data_align */
  86. uint32_t ScanConvMode; /*!< Specifies whether the conversion is performed in Scan (multi channels) or
  87. Single (one channel) mode.
  88. This parameter can be set to ENABLE or DISABLE */
  89. uint32_t EOCSelection; /*!< Specifies whether the EOC flag is set
  90. at the end of single channel conversion or at the end of all conversions.
  91. This parameter can be a value of @ref ADC_EOCSelection
  92. Note: Impact on overrun when not using DMA: When EOCSelection is set to ADC_EOC_SINGLE_CONV,
  93. overrun detection is automatically enabled, in this case each conversion data must be read.
  94. To perform ADC conversions without having to read all conversion data, this parameter must
  95. be set to ADC_EOC_SEQ_CONV */
  96. uint32_t ContinuousConvMode; /*!< Specifies whether the conversion is performed in Continuous or Single mode.
  97. This parameter can be set to ENABLE or DISABLE. */
  98. uint32_t DMAContinuousRequests; /*!< Specifies whether the DMA requests is performed in Continuous or in Single mode.
  99. This parameter can be set to ENABLE or DISABLE. */
  100. uint32_t NbrOfConversion; /*!< Specifies the number of ADC conversions that will be done using the sequencer for
  101. regular channel group.
  102. This parameter must be a number between Min_Data = 1 and Max_Data = 16. */
  103. uint32_t DiscontinuousConvMode; /*!< Specifies whether the conversion is performed in Discontinuous or not
  104. for regular channels.
  105. This parameter can be set to ENABLE or DISABLE. */
  106. uint32_t NbrOfDiscConversion; /*!< Specifies the number of ADC discontinuous conversions that will be done
  107. using the sequencer for regular channel group.
  108. This parameter must be a number between Min_Data = 1 and Max_Data = 8. */
  109. uint32_t ExternalTrigConv; /*!< Selects the external event used to trigger the conversion start of regular group.
  110. If set to ADC_SOFTWARE_START, external triggers are disabled.
  111. This parameter can be a value of @ref ADC_External_trigger_Source_Regular
  112. Note: This parameter can be modified only if there is no conversion is ongoing. */
  113. uint32_t ExternalTrigConvEdge; /*!< Selects the external trigger edge of regular group.
  114. If trigger is set to ADC_SOFTWARE_START, this parameter is discarded.
  115. This parameter can be a value of @ref ADC_External_trigger_edge_Regular
  116. Note: This parameter can be modified only if there is no conversion is ongoing. */
  117. }ADC_InitTypeDef;
  118. /**
  119. * @brief ADC handle Structure definition
  120. */
  121. typedef struct
  122. {
  123. ADC_TypeDef *Instance; /*!< Register base address */
  124. ADC_InitTypeDef Init; /*!< ADC required parameters */
  125. __IO uint32_t NbrOfCurrentConversionRank; /*!< ADC number of current conversion rank */
  126. DMA_HandleTypeDef *DMA_Handle; /*!< Pointer DMA Handler */
  127. HAL_LockTypeDef Lock; /*!< ADC locking object */
  128. __IO HAL_ADC_StateTypeDef State; /*!< ADC communication state */
  129. __IO uint32_t ErrorCode; /*!< ADC Error code */
  130. }ADC_HandleTypeDef;
  131. /**
  132. * @brief ADC Configuration regular Channel structure definition
  133. */
  134. typedef struct
  135. {
  136. uint32_t Channel; /*!< The ADC channel to configure.
  137. This parameter can be a value of @ref ADC_channels */
  138. uint32_t Rank; /*!< The rank in the regular group sequencer.
  139. This parameter must be a number between Min_Data = 1 and Max_Data = 16 */
  140. uint32_t SamplingTime; /*!< The sample time value to be set for the selected channel.
  141. This parameter can be a value of @ref ADC_sampling_times */
  142. uint32_t Offset; /*!< Reserved for future use, can be set to 0 */
  143. }ADC_ChannelConfTypeDef;
  144. /**
  145. * @brief ADC Configuration multi-mode structure definition
  146. */
  147. typedef struct
  148. {
  149. uint32_t WatchdogMode; /*!< Configures the ADC analog watchdog mode.
  150. This parameter can be a value of @ref ADC_analog_watchdog_selection */
  151. uint32_t HighThreshold; /*!< Configures the ADC analog watchdog High threshold value.
  152. This parameter must be a 12-bit value. */
  153. uint32_t LowThreshold; /*!< Configures the ADC analog watchdog High threshold value.
  154. This parameter must be a 12-bit value. */
  155. uint32_t Channel; /*!< Configures ADC channel for the analog watchdog.
  156. This parameter has an effect only if watchdog mode is configured on single channel
  157. This parameter can be a value of @ref ADC_channels */
  158. uint32_t ITMode; /*!< Specifies whether the analog watchdog is configured
  159. is interrupt mode or in polling mode.
  160. This parameter can be set to ENABLE or DISABLE */
  161. uint32_t WatchdogNumber; /*!< Reserved for future use, can be set to 0 */
  162. }ADC_AnalogWDGConfTypeDef;
  163. /**
  164. * @}
  165. */
  166. /* Exported constants --------------------------------------------------------*/
  167. /** @defgroup ADC_Exported_Constants ADC Exported Constants
  168. * @{
  169. */
  170. /** @defgroup ADC_Error_Code ADC Error Code
  171. * @{
  172. */
  173. #define HAL_ADC_ERROR_NONE ((uint32_t)0x00) /*!< No error */
  174. #define HAL_ADC_ERROR_OVR ((uint32_t)0x01) /*!< OVR error */
  175. #define HAL_ADC_ERROR_DMA ((uint32_t)0x02) /*!< DMA transfer error */
  176. /**
  177. * @}
  178. */
  179. /** @defgroup ADC_ClockPrescaler ADC Clock Prescaler
  180. * @{
  181. */
  182. #define ADC_CLOCK_SYNC_PCLK_DIV2 ((uint32_t)0x00000000)
  183. #define ADC_CLOCK_SYNC_PCLK_DIV4 ((uint32_t)ADC_CCR_ADCPRE_0)
  184. #define ADC_CLOCK_SYNC_PCLK_DIV6 ((uint32_t)ADC_CCR_ADCPRE_1)
  185. #define ADC_CLOCK_SYNC_PCLK_DIV8 ((uint32_t)ADC_CCR_ADCPRE)
  186. /**
  187. * @}
  188. */
  189. /** @defgroup ADC_delay_between_2_sampling_phases ADC Delay Between 2 Sampling Phases
  190. * @{
  191. */
  192. #define ADC_TWOSAMPLINGDELAY_5CYCLES ((uint32_t)0x00000000)
  193. #define ADC_TWOSAMPLINGDELAY_6CYCLES ((uint32_t)ADC_CCR_DELAY_0)
  194. #define ADC_TWOSAMPLINGDELAY_7CYCLES ((uint32_t)ADC_CCR_DELAY_1)
  195. #define ADC_TWOSAMPLINGDELAY_8CYCLES ((uint32_t)(ADC_CCR_DELAY_1 | ADC_CCR_DELAY_0))
  196. #define ADC_TWOSAMPLINGDELAY_9CYCLES ((uint32_t)ADC_CCR_DELAY_2)
  197. #define ADC_TWOSAMPLINGDELAY_10CYCLES ((uint32_t)(ADC_CCR_DELAY_2 | ADC_CCR_DELAY_0))
  198. #define ADC_TWOSAMPLINGDELAY_11CYCLES ((uint32_t)(ADC_CCR_DELAY_2 | ADC_CCR_DELAY_1))
  199. #define ADC_TWOSAMPLINGDELAY_12CYCLES ((uint32_t)(ADC_CCR_DELAY_2 | ADC_CCR_DELAY_1 | ADC_CCR_DELAY_0))
  200. #define ADC_TWOSAMPLINGDELAY_13CYCLES ((uint32_t)ADC_CCR_DELAY_3)
  201. #define ADC_TWOSAMPLINGDELAY_14CYCLES ((uint32_t)(ADC_CCR_DELAY_3 | ADC_CCR_DELAY_0))
  202. #define ADC_TWOSAMPLINGDELAY_15CYCLES ((uint32_t)(ADC_CCR_DELAY_3 | ADC_CCR_DELAY_1))
  203. #define ADC_TWOSAMPLINGDELAY_16CYCLES ((uint32_t)(ADC_CCR_DELAY_3 | ADC_CCR_DELAY_1 | ADC_CCR_DELAY_0))
  204. #define ADC_TWOSAMPLINGDELAY_17CYCLES ((uint32_t)(ADC_CCR_DELAY_3 | ADC_CCR_DELAY_2))
  205. #define ADC_TWOSAMPLINGDELAY_18CYCLES ((uint32_t)(ADC_CCR_DELAY_3 | ADC_CCR_DELAY_2 | ADC_CCR_DELAY_0))
  206. #define ADC_TWOSAMPLINGDELAY_19CYCLES ((uint32_t)(ADC_CCR_DELAY_3 | ADC_CCR_DELAY_2 | ADC_CCR_DELAY_1))
  207. #define ADC_TWOSAMPLINGDELAY_20CYCLES ((uint32_t)ADC_CCR_DELAY)
  208. /**
  209. * @}
  210. */
  211. /** @defgroup ADC_Resolution ADC Resolution
  212. * @{
  213. */
  214. #define ADC_RESOLUTION_12B ((uint32_t)0x00000000)
  215. #define ADC_RESOLUTION_10B ((uint32_t)ADC_CR1_RES_0)
  216. #define ADC_RESOLUTION_8B ((uint32_t)ADC_CR1_RES_1)
  217. #define ADC_RESOLUTION_6B ((uint32_t)ADC_CR1_RES)
  218. /**
  219. * @}
  220. */
  221. /** @defgroup ADC_External_trigger_edge_Regular ADC External Trigger Edge Regular
  222. * @{
  223. */
  224. #define ADC_EXTERNALTRIGCONVEDGE_NONE ((uint32_t)0x00000000)
  225. #define ADC_EXTERNALTRIGCONVEDGE_RISING ((uint32_t)ADC_CR2_EXTEN_0)
  226. #define ADC_EXTERNALTRIGCONVEDGE_FALLING ((uint32_t)ADC_CR2_EXTEN_1)
  227. #define ADC_EXTERNALTRIGCONVEDGE_RISINGFALLING ((uint32_t)ADC_CR2_EXTEN)
  228. /**
  229. * @}
  230. */
  231. /** @defgroup ADC_External_trigger_Source_Regular ADC External Trigger Source Regular
  232. * @{
  233. */
  234. /* Note: Parameter ADC_SOFTWARE_START is a software parameter used for */
  235. /* compatibility with other STM32 devices. */
  236. #define ADC_EXTERNALTRIGCONV_T1_CC1 ((uint32_t)0x00000000)
  237. #define ADC_EXTERNALTRIGCONV_T1_CC2 ((uint32_t)ADC_CR2_EXTSEL_0)
  238. #define ADC_EXTERNALTRIGCONV_T1_CC3 ((uint32_t)ADC_CR2_EXTSEL_1)
  239. #define ADC_EXTERNALTRIGCONV_T2_CC2 ((uint32_t)(ADC_CR2_EXTSEL_1 | ADC_CR2_EXTSEL_0))
  240. #define ADC_EXTERNALTRIGCONV_T2_CC3 ((uint32_t)ADC_CR2_EXTSEL_2)
  241. #define ADC_EXTERNALTRIGCONV_T2_CC4 ((uint32_t)(ADC_CR2_EXTSEL_2 | ADC_CR2_EXTSEL_0))
  242. #define ADC_EXTERNALTRIGCONV_T2_TRGO ((uint32_t)(ADC_CR2_EXTSEL_2 | ADC_CR2_EXTSEL_1))
  243. #define ADC_EXTERNALTRIGCONV_T3_CC1 ((uint32_t)(ADC_CR2_EXTSEL_2 | ADC_CR2_EXTSEL_1 | ADC_CR2_EXTSEL_0))
  244. #define ADC_EXTERNALTRIGCONV_T3_TRGO ((uint32_t)ADC_CR2_EXTSEL_3)
  245. #define ADC_EXTERNALTRIGCONV_T4_CC4 ((uint32_t)(ADC_CR2_EXTSEL_3 | ADC_CR2_EXTSEL_0))
  246. #define ADC_EXTERNALTRIGCONV_T5_CC1 ((uint32_t)(ADC_CR2_EXTSEL_3 | ADC_CR2_EXTSEL_1))
  247. #define ADC_EXTERNALTRIGCONV_T5_CC2 ((uint32_t)(ADC_CR2_EXTSEL_3 | ADC_CR2_EXTSEL_1 | ADC_CR2_EXTSEL_0))
  248. #define ADC_EXTERNALTRIGCONV_T5_CC3 ((uint32_t)(ADC_CR2_EXTSEL_3 | ADC_CR2_EXTSEL_2))
  249. #define ADC_EXTERNALTRIGCONV_T8_CC1 ((uint32_t)(ADC_CR2_EXTSEL_3 | ADC_CR2_EXTSEL_2 | ADC_CR2_EXTSEL_0))
  250. #define ADC_EXTERNALTRIGCONV_T8_TRGO ((uint32_t)(ADC_CR2_EXTSEL_3 | ADC_CR2_EXTSEL_2 | ADC_CR2_EXTSEL_1))
  251. #define ADC_EXTERNALTRIGCONV_Ext_IT11 ((uint32_t)ADC_CR2_EXTSEL)
  252. #define ADC_SOFTWARE_START ((uint32_t)ADC_CR2_EXTSEL + 1)
  253. /**
  254. * @}
  255. */
  256. /** @defgroup ADC_data_align ADC Data Align
  257. * @{
  258. */
  259. #define ADC_DATAALIGN_RIGHT ((uint32_t)0x00000000)
  260. #define ADC_DATAALIGN_LEFT ((uint32_t)ADC_CR2_ALIGN)
  261. /**
  262. * @}
  263. */
  264. /** @defgroup ADC_channels ADC Common Channels
  265. * @{
  266. */
  267. #define ADC_CHANNEL_0 ((uint32_t)0x00000000)
  268. #define ADC_CHANNEL_1 ((uint32_t)ADC_CR1_AWDCH_0)
  269. #define ADC_CHANNEL_2 ((uint32_t)ADC_CR1_AWDCH_1)
  270. #define ADC_CHANNEL_3 ((uint32_t)(ADC_CR1_AWDCH_1 | ADC_CR1_AWDCH_0))
  271. #define ADC_CHANNEL_4 ((uint32_t)ADC_CR1_AWDCH_2)
  272. #define ADC_CHANNEL_5 ((uint32_t)(ADC_CR1_AWDCH_2 | ADC_CR1_AWDCH_0))
  273. #define ADC_CHANNEL_6 ((uint32_t)(ADC_CR1_AWDCH_2 | ADC_CR1_AWDCH_1))
  274. #define ADC_CHANNEL_7 ((uint32_t)(ADC_CR1_AWDCH_2 | ADC_CR1_AWDCH_1 | ADC_CR1_AWDCH_0))
  275. #define ADC_CHANNEL_8 ((uint32_t)ADC_CR1_AWDCH_3)
  276. #define ADC_CHANNEL_9 ((uint32_t)(ADC_CR1_AWDCH_3 | ADC_CR1_AWDCH_0))
  277. #define ADC_CHANNEL_10 ((uint32_t)(ADC_CR1_AWDCH_3 | ADC_CR1_AWDCH_1))
  278. #define ADC_CHANNEL_11 ((uint32_t)(ADC_CR1_AWDCH_3 | ADC_CR1_AWDCH_1 | ADC_CR1_AWDCH_0))
  279. #define ADC_CHANNEL_12 ((uint32_t)(ADC_CR1_AWDCH_3 | ADC_CR1_AWDCH_2))
  280. #define ADC_CHANNEL_13 ((uint32_t)(ADC_CR1_AWDCH_3 | ADC_CR1_AWDCH_2 | ADC_CR1_AWDCH_0))
  281. #define ADC_CHANNEL_14 ((uint32_t)(ADC_CR1_AWDCH_3 | ADC_CR1_AWDCH_2 | ADC_CR1_AWDCH_1))
  282. #define ADC_CHANNEL_15 ((uint32_t)(ADC_CR1_AWDCH_3 | ADC_CR1_AWDCH_2 | ADC_CR1_AWDCH_1 | ADC_CR1_AWDCH_0))
  283. #define ADC_CHANNEL_16 ((uint32_t)ADC_CR1_AWDCH_4)
  284. #define ADC_CHANNEL_17 ((uint32_t)(ADC_CR1_AWDCH_4 | ADC_CR1_AWDCH_0))
  285. #define ADC_CHANNEL_18 ((uint32_t)(ADC_CR1_AWDCH_4 | ADC_CR1_AWDCH_1))
  286. #define ADC_CHANNEL_VREFINT ((uint32_t)ADC_CHANNEL_17)
  287. #define ADC_CHANNEL_VBAT ((uint32_t)ADC_CHANNEL_18)
  288. /**
  289. * @}
  290. */
  291. /** @defgroup ADC_sampling_times ADC Sampling Times
  292. * @{
  293. */
  294. #define ADC_SAMPLETIME_3CYCLES ((uint32_t)0x00000000)
  295. #define ADC_SAMPLETIME_15CYCLES ((uint32_t)ADC_SMPR1_SMP10_0)
  296. #define ADC_SAMPLETIME_28CYCLES ((uint32_t)ADC_SMPR1_SMP10_1)
  297. #define ADC_SAMPLETIME_56CYCLES ((uint32_t)(ADC_SMPR1_SMP10_1 | ADC_SMPR1_SMP10_0))
  298. #define ADC_SAMPLETIME_84CYCLES ((uint32_t)ADC_SMPR1_SMP10_2)
  299. #define ADC_SAMPLETIME_112CYCLES ((uint32_t)(ADC_SMPR1_SMP10_2 | ADC_SMPR1_SMP10_0))
  300. #define ADC_SAMPLETIME_144CYCLES ((uint32_t)(ADC_SMPR1_SMP10_2 | ADC_SMPR1_SMP10_1))
  301. #define ADC_SAMPLETIME_480CYCLES ((uint32_t)ADC_SMPR1_SMP10)
  302. /**
  303. * @}
  304. */
  305. /** @defgroup ADC_EOCSelection ADC EOC Selection
  306. * @{
  307. */
  308. #define ADC_EOC_SEQ_CONV ((uint32_t)0x00000000)
  309. #define ADC_EOC_SINGLE_CONV ((uint32_t)0x00000001)
  310. #define ADC_EOC_SINGLE_SEQ_CONV ((uint32_t)0x00000002) /*!< reserved for future use */
  311. /**
  312. * @}
  313. */
  314. /** @defgroup ADC_Event_type ADC Event Type
  315. * @{
  316. */
  317. #define ADC_AWD_EVENT ((uint32_t)ADC_FLAG_AWD)
  318. #define ADC_OVR_EVENT ((uint32_t)ADC_FLAG_OVR)
  319. /**
  320. * @}
  321. */
  322. /** @defgroup ADC_analog_watchdog_selection ADC Analog Watchdog Selection
  323. * @{
  324. */
  325. #define ADC_ANALOGWATCHDOG_SINGLE_REG ((uint32_t)(ADC_CR1_AWDSGL | ADC_CR1_AWDEN))
  326. #define ADC_ANALOGWATCHDOG_SINGLE_INJEC ((uint32_t)(ADC_CR1_AWDSGL | ADC_CR1_JAWDEN))
  327. #define ADC_ANALOGWATCHDOG_SINGLE_REGINJEC ((uint32_t)(ADC_CR1_AWDSGL | ADC_CR1_AWDEN | ADC_CR1_JAWDEN))
  328. #define ADC_ANALOGWATCHDOG_ALL_REG ((uint32_t)ADC_CR1_AWDEN)
  329. #define ADC_ANALOGWATCHDOG_ALL_INJEC ((uint32_t)ADC_CR1_JAWDEN)
  330. #define ADC_ANALOGWATCHDOG_ALL_REGINJEC ((uint32_t)(ADC_CR1_AWDEN | ADC_CR1_JAWDEN))
  331. #define ADC_ANALOGWATCHDOG_NONE ((uint32_t)0x00000000)
  332. /**
  333. * @}
  334. */
  335. /** @defgroup ADC_interrupts_definition ADC Interrupts Definition
  336. * @{
  337. */
  338. #define ADC_IT_EOC ((uint32_t)ADC_CR1_EOCIE)
  339. #define ADC_IT_AWD ((uint32_t)ADC_CR1_AWDIE)
  340. #define ADC_IT_JEOC ((uint32_t)ADC_CR1_JEOCIE)
  341. #define ADC_IT_OVR ((uint32_t)ADC_CR1_OVRIE)
  342. /**
  343. * @}
  344. */
  345. /** @defgroup ADC_flags_definition ADC Flags Definition
  346. * @{
  347. */
  348. #define ADC_FLAG_AWD ((uint32_t)ADC_SR_AWD)
  349. #define ADC_FLAG_EOC ((uint32_t)ADC_SR_EOC)
  350. #define ADC_FLAG_JEOC ((uint32_t)ADC_SR_JEOC)
  351. #define ADC_FLAG_JSTRT ((uint32_t)ADC_SR_JSTRT)
  352. #define ADC_FLAG_STRT ((uint32_t)ADC_SR_STRT)
  353. #define ADC_FLAG_OVR ((uint32_t)ADC_SR_OVR)
  354. /**
  355. * @}
  356. */
  357. /** @defgroup ADC_channels_type ADC Channels Type
  358. * @{
  359. */
  360. #define ADC_ALL_CHANNELS ((uint32_t)0x00000001)
  361. #define ADC_REGULAR_CHANNELS ((uint32_t)0x00000002) /*!< reserved for future use */
  362. #define ADC_INJECTED_CHANNELS ((uint32_t)0x00000003) /*!< reserved for future use */
  363. /**
  364. * @}
  365. */
  366. /**
  367. * @}
  368. */
  369. /* Exported macro ------------------------------------------------------------*/
  370. /** @defgroup ADC_Exported_Macros ADC Exported Macros
  371. * @{
  372. */
  373. /** @brief Reset ADC handle state
  374. * @param __HANDLE__: ADC handle
  375. * @retval None
  376. */
  377. #define __HAL_ADC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_ADC_STATE_RESET)
  378. /**
  379. * @brief Enable the ADC peripheral.
  380. * @param __HANDLE__: ADC handle
  381. * @retval None
  382. */
  383. #define __HAL_ADC_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR2 |= ADC_CR2_ADON)
  384. /**
  385. * @brief Disable the ADC peripheral.
  386. * @param __HANDLE__: ADC handle
  387. * @retval None
  388. */
  389. #define __HAL_ADC_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR2 &= ~ADC_CR2_ADON)
  390. /**
  391. * @brief Enable the ADC end of conversion interrupt.
  392. * @param __HANDLE__: specifies the ADC Handle.
  393. * @param __INTERRUPT__: ADC Interrupt.
  394. * @retval None
  395. */
  396. #define __HAL_ADC_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->CR1) |= (__INTERRUPT__))
  397. /**
  398. * @brief Disable the ADC end of conversion interrupt.
  399. * @param __HANDLE__: specifies the ADC Handle.
  400. * @param __INTERRUPT__: ADC interrupt.
  401. * @retval None
  402. */
  403. #define __HAL_ADC_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->CR1) &= ~(__INTERRUPT__))
  404. /** @brief Check if the specified ADC interrupt source is enabled or disabled.
  405. * @param __HANDLE__: specifies the ADC Handle.
  406. * @param __INTERRUPT__: specifies the ADC interrupt source to check.
  407. * @retval The new state of __IT__ (TRUE or FALSE).
  408. */
  409. #define __HAL_ADC_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->CR1 & (__INTERRUPT__)) == (__INTERRUPT__))
  410. /**
  411. * @brief Clear the ADC's pending flags.
  412. * @param __HANDLE__: specifies the ADC Handle.
  413. * @param __FLAG__: ADC flag.
  414. * @retval None
  415. */
  416. #define __HAL_ADC_CLEAR_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR) = ~(__FLAG__))
  417. /**
  418. * @brief Get the selected ADC's flag status.
  419. * @param __HANDLE__: specifies the ADC Handle.
  420. * @param __FLAG__: ADC flag.
  421. * @retval None
  422. */
  423. #define __HAL_ADC_GET_FLAG(__HANDLE__, __FLAG__) ((((__HANDLE__)->Instance->SR) & (__FLAG__)) == (__FLAG__))
  424. /**
  425. * @}
  426. */
  427. /* Include ADC HAL Extension module */
  428. #include "stm32f4xx_hal_adc_ex.h"
  429. /* Exported functions --------------------------------------------------------*/
  430. /** @addtogroup ADC_Exported_Functions
  431. * @{
  432. */
  433. /** @addtogroup ADC_Exported_Functions_Group1
  434. * @{
  435. */
  436. /* Initialization/de-initialization functions ***********************************/
  437. HAL_StatusTypeDef HAL_ADC_Init(ADC_HandleTypeDef* hadc);
  438. HAL_StatusTypeDef HAL_ADC_DeInit(ADC_HandleTypeDef *hadc);
  439. void HAL_ADC_MspInit(ADC_HandleTypeDef* hadc);
  440. void HAL_ADC_MspDeInit(ADC_HandleTypeDef* hadc);
  441. /**
  442. * @}
  443. */
  444. /** @addtogroup ADC_Exported_Functions_Group2
  445. * @{
  446. */
  447. /* I/O operation functions ******************************************************/
  448. HAL_StatusTypeDef HAL_ADC_Start(ADC_HandleTypeDef* hadc);
  449. HAL_StatusTypeDef HAL_ADC_Stop(ADC_HandleTypeDef* hadc);
  450. HAL_StatusTypeDef HAL_ADC_PollForConversion(ADC_HandleTypeDef* hadc, uint32_t Timeout);
  451. HAL_StatusTypeDef HAL_ADC_PollForEvent(ADC_HandleTypeDef* hadc, uint32_t EventType, uint32_t Timeout);
  452. HAL_StatusTypeDef HAL_ADC_Start_IT(ADC_HandleTypeDef* hadc);
  453. HAL_StatusTypeDef HAL_ADC_Stop_IT(ADC_HandleTypeDef* hadc);
  454. void HAL_ADC_IRQHandler(ADC_HandleTypeDef* hadc);
  455. HAL_StatusTypeDef HAL_ADC_Start_DMA(ADC_HandleTypeDef* hadc, uint32_t* pData, uint32_t Length);
  456. HAL_StatusTypeDef HAL_ADC_Stop_DMA(ADC_HandleTypeDef* hadc);
  457. uint32_t HAL_ADC_GetValue(ADC_HandleTypeDef* hadc);
  458. void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc);
  459. void HAL_ADC_ConvHalfCpltCallback(ADC_HandleTypeDef* hadc);
  460. void HAL_ADC_LevelOutOfWindowCallback(ADC_HandleTypeDef* hadc);
  461. void HAL_ADC_ErrorCallback(ADC_HandleTypeDef *hadc);
  462. /**
  463. * @}
  464. */
  465. /** @addtogroup ADC_Exported_Functions_Group3
  466. * @{
  467. */
  468. /* Peripheral Control functions *************************************************/
  469. HAL_StatusTypeDef HAL_ADC_ConfigChannel(ADC_HandleTypeDef* hadc, ADC_ChannelConfTypeDef* sConfig);
  470. HAL_StatusTypeDef HAL_ADC_AnalogWDGConfig(ADC_HandleTypeDef* hadc, ADC_AnalogWDGConfTypeDef* AnalogWDGConfig);
  471. /**
  472. * @}
  473. */
  474. /** @addtogroup ADC_Exported_Functions_Group4
  475. * @{
  476. */
  477. /* Peripheral State functions ***************************************************/
  478. HAL_ADC_StateTypeDef HAL_ADC_GetState(ADC_HandleTypeDef* hadc);
  479. uint32_t HAL_ADC_GetError(ADC_HandleTypeDef *hadc);
  480. /**
  481. * @}
  482. */
  483. /**
  484. * @}
  485. */
  486. /* Private types -------------------------------------------------------------*/
  487. /* Private variables ---------------------------------------------------------*/
  488. /* Private constants ---------------------------------------------------------*/
  489. /** @defgroup ADC_Private_Constants ADC Private Constants
  490. * @{
  491. */
  492. /* Delay for ADC stabilization time. */
  493. /* Maximum delay is 1us (refer to device datasheet, parameter tSTAB). */
  494. /* Unit: us */
  495. #define ADC_STAB_DELAY_US ((uint32_t) 3)
  496. /* Delay for temperature sensor stabilization time. */
  497. /* Maximum delay is 10us (refer to device datasheet, parameter tSTART). */
  498. /* Unit: us */
  499. #define ADC_TEMPSENSOR_DELAY_US ((uint32_t) 10)
  500. /**
  501. * @}
  502. */
  503. /* Private macros ------------------------------------------------------------*/
  504. /** @defgroup ADC_Private_Macros ADC Private Macros
  505. * @{
  506. */
  507. #define IS_ADC_CLOCKPRESCALER(ADC_CLOCK) (((ADC_CLOCK) == ADC_CLOCK_SYNC_PCLK_DIV2) || \
  508. ((ADC_CLOCK) == ADC_CLOCK_SYNC_PCLK_DIV4) || \
  509. ((ADC_CLOCK) == ADC_CLOCK_SYNC_PCLK_DIV6) || \
  510. ((ADC_CLOCK) == ADC_CLOCK_SYNC_PCLK_DIV8))
  511. #define IS_ADC_SAMPLING_DELAY(DELAY) (((DELAY) == ADC_TWOSAMPLINGDELAY_5CYCLES) || \
  512. ((DELAY) == ADC_TWOSAMPLINGDELAY_6CYCLES) || \
  513. ((DELAY) == ADC_TWOSAMPLINGDELAY_7CYCLES) || \
  514. ((DELAY) == ADC_TWOSAMPLINGDELAY_8CYCLES) || \
  515. ((DELAY) == ADC_TWOSAMPLINGDELAY_9CYCLES) || \
  516. ((DELAY) == ADC_TWOSAMPLINGDELAY_10CYCLES) || \
  517. ((DELAY) == ADC_TWOSAMPLINGDELAY_11CYCLES) || \
  518. ((DELAY) == ADC_TWOSAMPLINGDELAY_12CYCLES) || \
  519. ((DELAY) == ADC_TWOSAMPLINGDELAY_13CYCLES) || \
  520. ((DELAY) == ADC_TWOSAMPLINGDELAY_14CYCLES) || \
  521. ((DELAY) == ADC_TWOSAMPLINGDELAY_15CYCLES) || \
  522. ((DELAY) == ADC_TWOSAMPLINGDELAY_16CYCLES) || \
  523. ((DELAY) == ADC_TWOSAMPLINGDELAY_17CYCLES) || \
  524. ((DELAY) == ADC_TWOSAMPLINGDELAY_18CYCLES) || \
  525. ((DELAY) == ADC_TWOSAMPLINGDELAY_19CYCLES) || \
  526. ((DELAY) == ADC_TWOSAMPLINGDELAY_20CYCLES))
  527. #define IS_ADC_RESOLUTION(RESOLUTION) (((RESOLUTION) == ADC_RESOLUTION_12B) || \
  528. ((RESOLUTION) == ADC_RESOLUTION_10B) || \
  529. ((RESOLUTION) == ADC_RESOLUTION_8B) || \
  530. ((RESOLUTION) == ADC_RESOLUTION_6B))
  531. #define IS_ADC_EXT_TRIG_EDGE(EDGE) (((EDGE) == ADC_EXTERNALTRIGCONVEDGE_NONE) || \
  532. ((EDGE) == ADC_EXTERNALTRIGCONVEDGE_RISING) || \
  533. ((EDGE) == ADC_EXTERNALTRIGCONVEDGE_FALLING) || \
  534. ((EDGE) == ADC_EXTERNALTRIGCONVEDGE_RISINGFALLING))
  535. #define IS_ADC_EXT_TRIG(REGTRIG) (((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC1) || \
  536. ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC2) || \
  537. ((REGTRIG) == ADC_EXTERNALTRIGCONV_T1_CC3) || \
  538. ((REGTRIG) == ADC_EXTERNALTRIGCONV_T2_CC2) || \
  539. ((REGTRIG) == ADC_EXTERNALTRIGCONV_T2_CC3) || \
  540. ((REGTRIG) == ADC_EXTERNALTRIGCONV_T2_CC4) || \
  541. ((REGTRIG) == ADC_EXTERNALTRIGCONV_T2_TRGO) || \
  542. ((REGTRIG) == ADC_EXTERNALTRIGCONV_T3_CC1) || \
  543. ((REGTRIG) == ADC_EXTERNALTRIGCONV_T3_TRGO) || \
  544. ((REGTRIG) == ADC_EXTERNALTRIGCONV_T4_CC4) || \
  545. ((REGTRIG) == ADC_EXTERNALTRIGCONV_T5_CC1) || \
  546. ((REGTRIG) == ADC_EXTERNALTRIGCONV_T5_CC2) || \
  547. ((REGTRIG) == ADC_EXTERNALTRIGCONV_T5_CC3) || \
  548. ((REGTRIG) == ADC_EXTERNALTRIGCONV_T8_CC1) || \
  549. ((REGTRIG) == ADC_EXTERNALTRIGCONV_T8_TRGO) || \
  550. ((REGTRIG) == ADC_EXTERNALTRIGCONV_Ext_IT11)|| \
  551. ((REGTRIG) == ADC_SOFTWARE_START))
  552. #define IS_ADC_DATA_ALIGN(ALIGN) (((ALIGN) == ADC_DATAALIGN_RIGHT) || \
  553. ((ALIGN) == ADC_DATAALIGN_LEFT))
  554. #define IS_ADC_SAMPLE_TIME(TIME) (((TIME) == ADC_SAMPLETIME_3CYCLES) || \
  555. ((TIME) == ADC_SAMPLETIME_15CYCLES) || \
  556. ((TIME) == ADC_SAMPLETIME_28CYCLES) || \
  557. ((TIME) == ADC_SAMPLETIME_56CYCLES) || \
  558. ((TIME) == ADC_SAMPLETIME_84CYCLES) || \
  559. ((TIME) == ADC_SAMPLETIME_112CYCLES) || \
  560. ((TIME) == ADC_SAMPLETIME_144CYCLES) || \
  561. ((TIME) == ADC_SAMPLETIME_480CYCLES))
  562. #define IS_ADC_EOCSelection(EOCSelection) (((EOCSelection) == ADC_EOC_SINGLE_CONV) || \
  563. ((EOCSelection) == ADC_EOC_SEQ_CONV) || \
  564. ((EOCSelection) == ADC_EOC_SINGLE_SEQ_CONV))
  565. #define IS_ADC_EVENT_TYPE(EVENT) (((EVENT) == ADC_AWD_EVENT) || \
  566. ((EVENT) == ADC_OVR_EVENT))
  567. #define IS_ADC_ANALOG_WATCHDOG(WATCHDOG) (((WATCHDOG) == ADC_ANALOGWATCHDOG_SINGLE_REG) || \
  568. ((WATCHDOG) == ADC_ANALOGWATCHDOG_SINGLE_INJEC) || \
  569. ((WATCHDOG) == ADC_ANALOGWATCHDOG_SINGLE_REGINJEC) || \
  570. ((WATCHDOG) == ADC_ANALOGWATCHDOG_ALL_REG) || \
  571. ((WATCHDOG) == ADC_ANALOGWATCHDOG_ALL_INJEC) || \
  572. ((WATCHDOG) == ADC_ANALOGWATCHDOG_ALL_REGINJEC) || \
  573. ((WATCHDOG) == ADC_ANALOGWATCHDOG_NONE))
  574. #define IS_ADC_CHANNELS_TYPE(CHANNEL_TYPE) (((CHANNEL_TYPE) == ADC_ALL_CHANNELS) || \
  575. ((CHANNEL_TYPE) == ADC_REGULAR_CHANNELS) || \
  576. ((CHANNEL_TYPE) == ADC_INJECTED_CHANNELS))
  577. #define IS_ADC_THRESHOLD(THRESHOLD) ((THRESHOLD) <= ((uint32_t)0xFFF))
  578. #define IS_ADC_REGULAR_LENGTH(LENGTH) (((LENGTH) >= ((uint32_t)1)) && ((LENGTH) <= ((uint32_t)16)))
  579. #define IS_ADC_REGULAR_RANK(RANK) (((RANK) >= ((uint32_t)1)) && ((RANK) <= ((uint32_t)16)))
  580. #define IS_ADC_REGULAR_DISC_NUMBER(NUMBER) (((NUMBER) >= ((uint32_t)1)) && ((NUMBER) <= ((uint32_t)8)))
  581. #define IS_ADC_RANGE(RESOLUTION, ADC_VALUE) \
  582. ((((RESOLUTION) == ADC_RESOLUTION_12B) && ((ADC_VALUE) <= ((uint32_t)0x0FFF))) || \
  583. (((RESOLUTION) == ADC_RESOLUTION_10B) && ((ADC_VALUE) <= ((uint32_t)0x03FF))) || \
  584. (((RESOLUTION) == ADC_RESOLUTION_8B) && ((ADC_VALUE) <= ((uint32_t)0x00FF))) || \
  585. (((RESOLUTION) == ADC_RESOLUTION_6B) && ((ADC_VALUE) <= ((uint32_t)0x003F))))
  586. /**
  587. * @brief Set ADC Regular channel sequence length.
  588. * @param _NbrOfConversion_: Regular channel sequence length.
  589. * @retval None
  590. */
  591. #define ADC_SQR1(_NbrOfConversion_) (((_NbrOfConversion_) - (uint8_t)1) << 20)
  592. /**
  593. * @brief Set the ADC's sample time for channel numbers between 10 and 18.
  594. * @param _SAMPLETIME_: Sample time parameter.
  595. * @param _CHANNELNB_: Channel number.
  596. * @retval None
  597. */
  598. #define ADC_SMPR1(_SAMPLETIME_, _CHANNELNB_) ((_SAMPLETIME_) << (3 * (((uint32_t)((uint16_t)(_CHANNELNB_))) - 10)))
  599. /**
  600. * @brief Set the ADC's sample time for channel numbers between 0 and 9.
  601. * @param _SAMPLETIME_: Sample time parameter.
  602. * @param _CHANNELNB_: Channel number.
  603. * @retval None
  604. */
  605. #define ADC_SMPR2(_SAMPLETIME_, _CHANNELNB_) ((_SAMPLETIME_) << (3 * ((uint32_t)((uint16_t)(_CHANNELNB_)))))
  606. /**
  607. * @brief Set the selected regular channel rank for rank between 1 and 6.
  608. * @param _CHANNELNB_: Channel number.
  609. * @param _RANKNB_: Rank number.
  610. * @retval None
  611. */
  612. #define ADC_SQR3_RK(_CHANNELNB_, _RANKNB_) (((uint32_t)((uint16_t)(_CHANNELNB_))) << (5 * ((_RANKNB_) - 1)))
  613. /**
  614. * @brief Set the selected regular channel rank for rank between 7 and 12.
  615. * @param _CHANNELNB_: Channel number.
  616. * @param _RANKNB_: Rank number.
  617. * @retval None
  618. */
  619. #define ADC_SQR2_RK(_CHANNELNB_, _RANKNB_) (((uint32_t)((uint16_t)(_CHANNELNB_))) << (5 * ((_RANKNB_) - 7)))
  620. /**
  621. * @brief Set the selected regular channel rank for rank between 13 and 16.
  622. * @param _CHANNELNB_: Channel number.
  623. * @param _RANKNB_: Rank number.
  624. * @retval None
  625. */
  626. #define ADC_SQR1_RK(_CHANNELNB_, _RANKNB_) (((uint32_t)((uint16_t)(_CHANNELNB_))) << (5 * ((_RANKNB_) - 13)))
  627. /**
  628. * @brief Enable ADC continuous conversion mode.
  629. * @param _CONTINUOUS_MODE_: Continuous mode.
  630. * @retval None
  631. */
  632. #define ADC_CR2_CONTINUOUS(_CONTINUOUS_MODE_) ((_CONTINUOUS_MODE_) << 1)
  633. /**
  634. * @brief Configures the number of discontinuous conversions for the regular group channels.
  635. * @param _NBR_DISCONTINUOUSCONV_: Number of discontinuous conversions.
  636. * @retval None
  637. */
  638. #define ADC_CR1_DISCONTINUOUS(_NBR_DISCONTINUOUSCONV_) (((_NBR_DISCONTINUOUSCONV_) - 1) << POSITION_VAL(ADC_CR1_DISCNUM))
  639. /**
  640. * @brief Enable ADC scan mode.
  641. * @param _SCANCONV_MODE_: Scan conversion mode.
  642. * @retval None
  643. */
  644. #define ADC_CR1_SCANCONV(_SCANCONV_MODE_) ((_SCANCONV_MODE_) << 8)
  645. /**
  646. * @brief Enable the ADC end of conversion selection.
  647. * @param _EOCSelection_MODE_: End of conversion selection mode.
  648. * @retval None
  649. */
  650. #define ADC_CR2_EOCSelection(_EOCSelection_MODE_) ((_EOCSelection_MODE_) << 10)
  651. /**
  652. * @brief Enable the ADC DMA continuous request.
  653. * @param _DMAContReq_MODE_: DMA continuous request mode.
  654. * @retval None
  655. */
  656. #define ADC_CR2_DMAContReq(_DMAContReq_MODE_) ((_DMAContReq_MODE_) << 9)
  657. /**
  658. * @brief Return resolution bits in CR1 register.
  659. * @param __HANDLE__: ADC handle
  660. * @retval None
  661. */
  662. #define ADC_GET_RESOLUTION(__HANDLE__) (((__HANDLE__)->Instance->CR1) & ADC_CR1_RES)
  663. /**
  664. * @}
  665. */
  666. /* Private functions ---------------------------------------------------------*/
  667. /** @defgroup ADC_Private_Functions ADC Private Functions
  668. * @{
  669. */
  670. /**
  671. * @}
  672. */
  673. /**
  674. * @}
  675. */
  676. /**
  677. * @}
  678. */
  679. #ifdef __cplusplus
  680. }
  681. #endif
  682. #endif /*__STM32F4xx_ADC_H */
  683. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/