nu_adc.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418
  1. /**************************************************************************//**
  2. * @file nu_adc.h
  3. * @version V0.10
  4. * $Revision: 2 $
  5. * $Date: 19/01/11 11:23a $
  6. * @brief M031 Series ADC Driver Header File
  7. *
  8. * @note
  9. * SPDX-License-Identifier: Apache-2.0
  10. * Copyright (C) 2018 Nuvoton Technology Corp. All rights reserved.
  11. *****************************************************************************/
  12. #ifndef __NU_ADC_H__
  13. #define __NU_ADC_H__
  14. #ifdef __cplusplus
  15. extern "C"
  16. {
  17. #endif
  18. /** @addtogroup Standard_Driver Standard Driver
  19. @{
  20. */
  21. /** @addtogroup ADC_Driver ADC Driver
  22. @{
  23. */
  24. /** @addtogroup ADC_EXPORTED_CONSTANTS ADC Exported Constants
  25. @{
  26. */
  27. /*---------------------------------------------------------------------------------------------------------*/
  28. /* ADCR Constant Definitions */
  29. /*---------------------------------------------------------------------------------------------------------*/
  30. #define ADC_ADCR_ADEN_CONVERTER_DISABLE (0UL<<ADC_ADCR_ADEN_Pos) /*!< ADC converter disable \hideinitializer */
  31. #define ADC_ADCR_ADEN_CONVERTER_ENABLE (1UL<<ADC_ADCR_ADEN_Pos) /*!< ADC converter enable \hideinitializer */
  32. #define ADC_ADCR_ADMD_SINGLE (0UL<<ADC_ADCR_ADMD_Pos) /*!< Single mode \hideinitializer */
  33. #define ADC_ADCR_ADMD_BURST (1UL<<ADC_ADCR_ADMD_Pos) /*!< Burst mode \hideinitializer */
  34. #define ADC_ADCR_ADMD_SINGLE_CYCLE (2UL<<ADC_ADCR_ADMD_Pos) /*!< Single cycle scan mode \hideinitializer */
  35. #define ADC_ADCR_ADMD_CONTINUOUS (3UL<<ADC_ADCR_ADMD_Pos) /*!< Continuous scan mode \hideinitializer */
  36. #define ADC_ADCR_DIFFEN_SINGLE_END (0UL<<ADC_ADCR_DIFFEN_Pos) /*!< Single-end input mode \hideinitializer */
  37. #define ADC_ADCR_DIFFEN_DIFFERENTIAL (1UL<<ADC_ADCR_DIFFEN_Pos) /*!< Differential input mode \hideinitializer */
  38. #define ADC_ADCR_DMOF_UNSIGNED_OUTPUT (0UL<<ADC_ADCR_DMOF_Pos) /*!< Select the straight binary format as the output format of the conversion result \hideinitializer */
  39. #define ADC_ADCR_DMOF_TWOS_COMPLEMENT (1UL<<ADC_ADCR_DMOF_Pos) /*!< Select the 2's complement format as the output format of the conversion result \hideinitializer */
  40. #define ADC_ADCR_TRGEN_DISABLE (0UL<<ADC_ADCR_TRGEN_Pos) /*!< Disable triggering of A/D conversion by external STADC pin or PWM \hideinitializer */
  41. #define ADC_ADCR_TRGEN_ENABLE (1UL<<ADC_ADCR_TRGEN_Pos) /*!< Enable triggering of A/D conversion by external STADC pin or PWM \hideinitializer */
  42. #define ADC_ADCR_TRGS_STADC (0UL<<ADC_ADCR_TRGS_Pos) /*!< A/D conversion is started by external STADC pin \hideinitializer */
  43. #define ADC_ADCR_TRGS_TIMER (1UL<<ADC_ADCR_TRGS_Pos) /*!< A/D conversion is started by Timer \hideinitializer */
  44. #define ADC_ADCR_TRGS_BPWM (2UL<<ADC_ADCR_TRGS_Pos) /*!< A/D conversion is started by BPWM \hideinitializer */
  45. #define ADC_ADCR_TRGS_PWM (3UL<<ADC_ADCR_TRGS_Pos) /*!< A/D conversion is started by PWM \hideinitializer */
  46. #define ADC_ADCR_TRGCOND_LOW_LEVEL (0UL<<ADC_ADCR_TRGCOND_Pos) /*!< STADC Low level active \hideinitializer */
  47. #define ADC_ADCR_TRGCOND_HIGH_LEVEL (1UL<<ADC_ADCR_TRGCOND_Pos) /*!< STADC High level active \hideinitializer */
  48. #define ADC_ADCR_TRGCOND_FALLING_EDGE (2UL<<ADC_ADCR_TRGCOND_Pos) /*!< STADC Falling edge active \hideinitializer */
  49. #define ADC_ADCR_TRGCOND_RISING_EDGE (3UL<<ADC_ADCR_TRGCOND_Pos) /*!< STADC Rising edge active \hideinitializer */
  50. /*---------------------------------------------------------------------------------------------------------*/
  51. /* ADCMPR Constant Definitions */
  52. /*---------------------------------------------------------------------------------------------------------*/
  53. #define ADC_ADCMPR_CMPD(x) ((x) << ADC_ADCMPR_CMPD_Pos) /*!< Compare value for compare function \hideinitializer */
  54. #define ADC_ADCMPR_CMPMATCNT(x) (((x)-1) << ADC_ADCMPR_CMPMATCNT_Pos) /*!< Match count for compare function \hideinitializer */
  55. #define ADC_ADCMPR_CMPCH(x) ((x) << ADC_ADCMPR_CMPCH_Pos) /*!< Compare channel for compare function \hideinitializer */
  56. #define ADC_ADCMPR_CMPCOND_LESS_THAN (0<<ADC_ADCMPR_CMPCOND_Pos) /*!< The compare condition is "less than" \hideinitializer */
  57. #define ADC_ADCMPR_CMPCOND_GREATER_OR_EQUAL (1<<ADC_ADCMPR_CMPCOND_Pos) /*!< The compare condition is "greater than or equal to" \hideinitializer */
  58. #define ADC_ADCMPR_CMPIE_INTERRUPT_ENABLE (ADC_ADCMPR_CMPIE_Msk) /*!< The compare function interrupt enable \hideinitializer */
  59. /*---------------------------------------------------------------------------------------------------------*/
  60. /* ADC Interrupt Constant Definitions */
  61. /*---------------------------------------------------------------------------------------------------------*/
  62. #define ADC_ADF_INT (ADC_ADSR0_ADF_Msk) /*!< ADC convert complete interrupt \hideinitializer */
  63. #define ADC_CMP0_INT (ADC_ADSR0_CMPF0_Msk) /*!< ADC comparator 0 interrupt \hideinitializer */
  64. #define ADC_CMP1_INT (ADC_ADSR0_CMPF1_Msk) /*!< ADC comparator 1 interrupt \hideinitializer */
  65. /*---------------------------------------------------------------------------------------------------------*/
  66. /* ADC Operation Mode Constant Definitions */
  67. /*---------------------------------------------------------------------------------------------------------*/
  68. #define ADC_SINGLE_MODE 0 /*!< ADC single mode \hideinitializer */
  69. #define ADC_BURST_MODE 1 /*!< ADC burst mode \hideinitializer */
  70. #define ADC_SINGLE_CYCLE_MODE 2 /*!< ADC single-cycle scan mode \hideinitializer */
  71. #define ADC_CONTINUOUS_MODE 3 /*!< ADC continuous scan mode \hideinitializer */
  72. /*---------------------------------------------------------------------------------------------------------*/
  73. /* ADC Trigger Condition Constant Definitions */
  74. /*---------------------------------------------------------------------------------------------------------*/
  75. #define ADC_LOW_LEVEL 0 /*!< ADC external trigger condition is low level trigger \hideinitializer */
  76. #define ADC_HIGH_LEVEL 1 /*!< ADC external trigger condition is high level trigger \hideinitializer */
  77. #define ADC_FALLING_EDGE 2 /*!< ADC external trigger condition is falling edge trigger \hideinitializer */
  78. #define ADC_RISING_EDGE 3 /*!< ADC external trigger condition is rising edge trigger \hideinitializer */
  79. /*---------------------------------------------------------------------------------------------------------*/
  80. /* ADC Compare Condition Constant Definitions */
  81. /*---------------------------------------------------------------------------------------------------------*/
  82. #define ADC_LESS_THAN 0 /*!< ADC compare condition is "less than the compare value" \hideinitializer */
  83. #define ADC_GREATER_OR_EQUAL 1 /*!< ADC compare condition is "greater than or equal to the compare value" \hideinitializer */
  84. /*@}*/ /* end of group ADC_EXPORTED_CONSTANTS */
  85. /** @addtogroup ADC_EXPORTED_FUNCTIONS ADC Exported Functions
  86. @{
  87. */
  88. /**
  89. * @brief Get conversion data of specified channel.
  90. * @param[in] adc The pointer of the specified ADC module.
  91. * @param[in] u32ChNum ADC Channel, valid value are from 0 to 15 and 29.
  92. * @return 16-bit data.
  93. * @details Read RSLT bit field to get conversion data.
  94. * \hideinitializer
  95. */
  96. #define ADC_GET_CONVERSION_DATA(adc, u32ChNum) ((adc)->ADDR[(u32ChNum)] & ADC_ADDR_RSLT_Msk)
  97. /**
  98. * @brief Return the user-specified interrupt flags.
  99. * @param[in] adc The pointer of the specified ADC module.
  100. * @param[in] u32Mask The combination of following interrupt status bits. Each bit corresponds to a interrupt status.
  101. * Valid values are:
  102. * - \ref ADC_ADF_INT :Convert complete interrupt flag.
  103. * - \ref ADC_CMP0_INT :Comparator 0 interrupt flag.
  104. * - \ref ADC_CMP1_INT :Comparator 1 interrupt flag.
  105. * @return User specified interrupt flags.
  106. * @details Get the status of the ADC interrupt flag.
  107. * \hideinitializer
  108. */
  109. #define ADC_GET_INT_FLAG(adc, u32Mask) ((adc)->ADSR0 & (u32Mask))
  110. /**
  111. * @brief This macro clear the selected interrupt status bits.
  112. * @param[in] adc The pointer of the specified ADC module.
  113. * @param[in] u32Mask The combination of following interrupt status bits. Each bit corresponds to a interrupt status.
  114. * Valid values are:
  115. * - \ref ADC_ADF_INT :Convert complete interrupt flag.
  116. * - \ref ADC_CMP0_INT :Comparator 0 interrupt flag.
  117. * - \ref ADC_CMP1_INT :Comparator 1 interrupt flag.
  118. * @return None
  119. * @details ADF (ADSR0[0])/CMPF0 (ADSR0[1])/CMPF1 (ADSR0[2]) can be cleared by writing 1 to itself.
  120. * \hideinitializer
  121. */
  122. #define ADC_CLR_INT_FLAG(adc, u32Mask) ((adc)->ADSR0 = (u32Mask))
  123. /**
  124. * @brief Get the busy state of ADC.
  125. * @param[in] adc The pointer of the specified ADC module.
  126. * @retval 0 ADC is not busy.
  127. * @retval 1 ADC is busy.
  128. * @details ADSR0[7] (BUSY) is a mirror of ADCR[11] (ADST).
  129. * \hideinitializer
  130. */
  131. #define ADC_IS_BUSY(adc) ((adc)->ADSR0 & ADC_ADSR0_BUSY_Msk ? 1 : 0)
  132. /**
  133. * @brief Check if the ADC conversion data is over written or not.
  134. * @param[in] adc The pointer of the specified ADC module.
  135. * @param[in] u32ChNum ADC Channel, valid value are from 0 to 15 and 29.
  136. * @retval 0 ADC data is not overrun.
  137. * @retval 1 ADC data is overrun.
  138. * @details ADSR2[31:0] (OVERRUN) is the mirror of ADDR0~31[16] OVERRUN bits.
  139. * \hideinitializer
  140. */
  141. #define ADC_IS_DATA_OVERRUN(adc, u32ChNum) (((adc)->ADSR2 & (1<<(u32ChNum))) ? 1 : 0)
  142. /**
  143. * @brief Check if the ADC conversion data is valid or not.
  144. * @param[in] adc The pointer of the specified ADC module.
  145. * @param[in] u32ChNum ADC Channel, valid value are from 0 to 15 and 29.
  146. * @retval 0 ADC data is not valid.
  147. * @retval 1 ADC data is valid.
  148. * @details VALID (ADDR0~31[17]) is set to 1 when corresponding channel analog input conversion is completed and cleared by hardware after ADDR register is read.
  149. * \hideinitializer
  150. */
  151. #define ADC_IS_DATA_VALID(adc, u32ChNum) ((adc)->ADSR1 & (0x1<<(u32ChNum)) ? 1 : 0)
  152. /**
  153. * @brief Power down ADC module.
  154. * @param[in] adc The pointer of the specified ADC module.
  155. * @return None
  156. * @details Disable A/D converter analog circuit for saving power consumption.
  157. * \hideinitializer
  158. */
  159. #define ADC_POWER_DOWN(adc) ((adc)->ADCR &= ~ADC_ADCR_ADEN_Msk)
  160. /**
  161. * @brief Power on ADC module.
  162. * @param[in] adc The pointer of the specified ADC module.
  163. * @return None
  164. * @details Before starting A/D conversion function, ADEN bit (ADCR[0]) should be set to 1.
  165. * \hideinitializer
  166. */
  167. #define ADC_POWER_ON(adc) ((adc)->ADCR |= ADC_ADCR_ADEN_Msk)
  168. /**
  169. * @brief Configure the comparator 0 and enable it.
  170. * @param[in] adc The pointer of the specified ADC module.
  171. * @param[in] u32ChNum Specifies the source channel, valid value are from 0 to 15 and 29.
  172. * @param[in] u32Condition Specifies the compare condition. Valid values are:
  173. * - \ref ADC_ADCMPR_CMPCOND_LESS_THAN :The compare condition is "less than the compare value".
  174. * - \ref ADC_ADCMPR_CMPCOND_GREATER_OR_EQUAL :The compare condition is "greater than or equal to the compare value".
  175. * @param[in] u32Data Specifies the compare value, valid value are between 0 ~ 0xFFF.
  176. * @param[in] u32MatchCount Specifies the match count setting, valid values are between 1~16.
  177. * @return None
  178. * @details For example, ADC_ENABLE_CMP0(ADC, 5, ADC_ADCMPR_CMPCOND_GREATER_OR_EQUAL, 0x800, 10);
  179. * means ADC will assert comparator 0 flag if channel 5 conversion result is greater than or
  180. * equal to 0x800 for 10 times continuously.
  181. * \hideinitializer
  182. */
  183. #define ADC_ENABLE_CMP0(adc, \
  184. u32ChNum, \
  185. u32Condition, \
  186. u32Data, \
  187. u32MatchCount) ((adc)->ADCMPR[0] = ((u32ChNum) << ADC_ADCMPR_CMPCH_Pos) | \
  188. (u32Condition) | \
  189. ((u32Data) << ADC_ADCMPR_CMPD_Pos) | \
  190. (((u32MatchCount) - 1) << ADC_ADCMPR_CMPMATCNT_Pos) |\
  191. ADC_ADCMPR_CMPEN_Msk)
  192. /**
  193. * @brief Disable comparator 0
  194. * @param[in] adc The pointer of the specified ADC module
  195. * @return None
  196. * @details Set CMPEN (ADCMPR0[0]) to 0 and reset comparator 0 configurations to disable ADC compare function.
  197. * \hideinitializer
  198. */
  199. #define ADC_DISABLE_CMP0(adc) ((adc)->ADCMPR[0] = 0)
  200. /**
  201. * @brief Configure the comparator 1 and enable it.
  202. * @param[in] adc The pointer of the specified ADC module.
  203. * @param[in] u32ChNum Specifies the source channel, valid value are from 0 to 15 and 29.
  204. * @param[in] u32Condition Specifies the compare condition. Valid values are:
  205. * - \ref ADC_ADCMPR_CMPCOND_LESS_THAN :The compare condition is "less than the compare value".
  206. * - \ref ADC_ADCMPR_CMPCOND_GREATER_OR_EQUAL :The compare condition is "greater than or equal to the compare value".
  207. * @param[in] u32Data Specifies the compare value, valid value are between 0 ~ 0xFFF.
  208. * @param[in] u32MatchCount Specifies the match count setting, valid values are between 1~16.
  209. * @return None
  210. * @details For example, ADC_ENABLE_CMP1(ADC, 5, ADC_ADCMPR_CMPCOND_GREATER_OR_EQUAL, 0x800, 10);
  211. * means ADC will assert comparator 1 flag if channel 5 conversion result is greater than or
  212. * equal to 0x800 for 10 times continuously.
  213. * \hideinitializer
  214. */
  215. #define ADC_ENABLE_CMP1(adc, \
  216. u32ChNum, \
  217. u32Condition, \
  218. u32Data, \
  219. u32MatchCount) ((adc)->ADCMPR[1] = ((u32ChNum) << ADC_ADCMPR_CMPCH_Pos) | \
  220. (u32Condition) | \
  221. ((u32Data) << ADC_ADCMPR_CMPD_Pos) | \
  222. (((u32MatchCount) - 1) << ADC_ADCMPR_CMPMATCNT_Pos) |\
  223. ADC_ADCMPR_CMPEN_Msk)
  224. /**
  225. * @brief Disable comparator 1.
  226. * @param[in] adc The pointer of the specified ADC module.
  227. * @return None
  228. * @details Set CMPEN (ADCMPR1[0]) to 0 and reset comparator 1 configurations to disable ADC compare function.
  229. * \hideinitializer
  230. */
  231. #define ADC_DISABLE_CMP1(adc) ((adc)->ADCMPR[1] = 0)
  232. /**
  233. * @brief Enable the compare window mode.
  234. * @param[in] adc The pointer of the specified ADC module.
  235. * @param[in] u32CMP Specifies the compare register, valid value are 0.
  236. * @return None
  237. * @details CMPF0 (ADSR0[1]) will be set when both ADC_CMP0 and ADC_CMP1 compared condition matched.
  238. * \hideinitializer
  239. */
  240. #define ADC_ENABLE_CMP_WINDOW_MODE(adc, u32CMP) ((adc)->ADCMPR[(u32CMP)] |= ADC_ADCMPR_CMPWEN_Msk)
  241. /**
  242. * @brief Disable the compare window mode.
  243. * @param[in] adc The pointer of the specified ADC module.
  244. * @param[in] u32CMP Specifies the compare register, valid value are 0.
  245. * @return None
  246. * @details Disable the compare window mode for specified ADC module.
  247. * \hideinitializer
  248. */
  249. #define ADC_DISABLE_CMP_WINDOW_MODE(adc, u32CMP) ((adc)->ADCMPR[(u32CMP)] &= ~ADC_ADCMPR_CMPWEN_Msk)
  250. /**
  251. * @brief Set ADC input channel.
  252. * @param[in] adc The pointer of the specified ADC module.
  253. * @param[in] u32Mask Channel enable bit. Each bit corresponds to a input channel. Bit 0 is channel 0, bit 1 is channel 1..., bit 15 is channel 15.
  254. * @return None
  255. * @details Enabled channel will be converted while ADC starts.
  256. * @note In single mode, ADC can only convert 1 channel. If more than 1 channel are enabled, only the channel with smallest number will be converted.
  257. * \hideinitializer
  258. */
  259. #define ADC_SET_INPUT_CHANNEL(adc, u32Mask) ((adc)->ADCHER = ((adc)->ADCHER & ~ADC_ADCHER_CHEN_Msk) | (u32Mask))
  260. /**
  261. * @brief Set the output format mode.
  262. * @param[in] adc The pointer of the specified ADC module.
  263. * @param[in] u32Format Decides the output format. Valid values are:
  264. * - \ref ADC_ADCR_DMOF_UNSIGNED_OUTPUT : Select the straight binary format as the output format of the conversion result.
  265. * - \ref ADC_ADCR_DMOF_TWOS_COMPLEMENT : Select the 2's complement format as the output format of the conversion result.
  266. * @return None
  267. * @details The macro is used to set the output format of ADC differential input mode.
  268. * @note ADC compare function can not support 2's complement output format, u32Format should be set to ADC_ADCR_DMOF_UNSIGNED_OUTPUT.
  269. * \hideinitializer
  270. */
  271. #define ADC_SET_DMOF(adc, u32Format) ((adc)->ADCR = ((adc)->ADCR & ~ADC_ADCR_DMOF_Msk) | (u32Format))
  272. /**
  273. * @brief Start the A/D conversion.
  274. * @param[in] adc The pointer of the specified ADC module.
  275. * @return None
  276. * @details Set ADST bit to 1 to start the A/D conversion.
  277. * \hideinitializer
  278. */
  279. #define ADC_START_CONV(adc) ((adc)->ADCR |= ADC_ADCR_ADST_Msk)
  280. /**
  281. * @brief Stop the A/D conversion.
  282. * @param[in] adc The pointer of the specified ADC module.
  283. * @return None
  284. * @details ADST (ADCR[11]) will be cleared to 0 by hardware automatically at the ends of single mode and single-cycle scan mode.
  285. * In continuous scan mode and burst mode, A/D conversion is continuously performed until software writes 0 to this bit.
  286. * @note When the ADST bit is cleared to 0, the ADST bit must be kept at 0 at least one ADC peripheral clock period
  287. * before setting it to 1 again, otherwise the A/D converter may not work.
  288. * If ADST bit is cleared to 0 when ADC is in converting, the BUSY bit will be cleared to 0 immediately,
  289. * ADC will terminate the current conversion and enter idle state directly.
  290. * \hideinitializer
  291. */
  292. #define ADC_STOP_CONV(adc) ((adc)->ADCR &= ~ADC_ADCR_ADST_Msk)
  293. /**
  294. * @brief Enable PDMA transfer.
  295. * @param[in] adc The pointer of the specified ADC module
  296. * @return None
  297. * @details Enable PDMA to transfer the conversion data.
  298. * @note While enable PDMA transfer, software must set ADIE = 0 to disable interrupt.
  299. * \hideinitializer
  300. */
  301. #define ADC_ENABLE_PDMA(adc) ((adc)->ADCR |= ADC_ADCR_PTEN_Msk)
  302. /**
  303. * @brief Disable PDMA transfer.
  304. * @param[in] adc The pointer of the specified ADC module
  305. * @return None
  306. * @details Disable PDMA to transfer the conversion data.
  307. * \hideinitializer
  308. */
  309. #define ADC_DISABLE_PDMA(adc) ((adc)->ADCR &= ~ADC_ADCR_PTEN_Msk)
  310. /**
  311. * @brief Get PDMA current transfer data
  312. * @param[in] adc The pointer of the specified ADC module.
  313. * @return PDMA current transfer data
  314. * \hideinitializer
  315. */
  316. #define ADC_GET_PDMA_DATA(adc) ((adc)->ADPDMA & ADC_ADPDMA_CURDAT_Msk)
  317. /**
  318. * @brief Enable the interrupt(s) selected by u32Mask parameter.
  319. * @param[in] adc The pointer of the specified ADC module
  320. * @param[in] u32Mask The combination of interrupt status bits listed below. Each bit
  321. * corresponds to a interrupt status. This parameter decides which
  322. * interrupts will be enabled.
  323. * - \ref ADC_ADF_INT :ADC convert complete interrupt
  324. * - \ref ADC_CMP0_INT :ADC comparator 0 interrupt
  325. * - \ref ADC_CMP1_INT :ADC comparator 1 interrupt
  326. * @return None
  327. * \hideinitializer
  328. */
  329. #define ADC_ENABLE_INT ADC_EnableInt
  330. /**
  331. * @brief Disable the interrupt(s) selected by u32Mask parameter.
  332. * @param[in] adc The pointer of the specified ADC module
  333. * @param[in] u32Mask The combination of interrupt status bits listed below. Each bit
  334. * corresponds to a interrupt status. This parameter decides which
  335. * interrupts will be disabled.
  336. * - \ref ADC_ADF_INT :ADC convert complete interrupt
  337. * - \ref ADC_CMP0_INT :ADC comparator 0 interrupt
  338. * - \ref ADC_CMP1_INT :ADC comparator 1 interrupt
  339. * @return None
  340. * \hideinitializer
  341. */
  342. #define ADC_DISABLE_INT ADC_DisableInt
  343. void ADC_Open(ADC_T *adc,
  344. uint32_t u32InputMode,
  345. uint32_t u32OpMode,
  346. uint32_t u32ChMask);
  347. void ADC_Close(ADC_T *adc);
  348. void ADC_EnableHWTrigger(ADC_T *adc,
  349. uint32_t u32Source,
  350. uint32_t u32Param);
  351. void ADC_DisableHWTrigger(ADC_T *adc);
  352. void ADC_EnableInt(ADC_T *adc, uint32_t u32Mask);
  353. void ADC_DisableInt(ADC_T *adc, uint32_t u32Mask);
  354. void ADC_SetExtendSampleTime(ADC_T *adc,
  355. uint32_t u32ModuleNum,
  356. uint32_t u32ExtendSampleTime);
  357. /*@}*/ /* end of group ADC_EXPORTED_FUNCTIONS */
  358. /*@}*/ /* end of group ADC_Driver */
  359. /*@}*/ /* end of group Standard_Driver */
  360. #ifdef __cplusplus
  361. }
  362. #endif
  363. #endif //__NU_ADC_H__
  364. /*** (C) COPYRIGHT 2018 Nuvoton Technology Corp. ***/