stm32f10x_dac.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570
  1. /**
  2. ******************************************************************************
  3. * @file stm32f10x_dac.c
  4. * @author MCD Application Team
  5. * @version V3.4.0
  6. * @date 10/15/2010
  7. * @brief This file provides all the DAC firmware functions.
  8. ******************************************************************************
  9. * @copy
  10. *
  11. * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
  12. * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
  13. * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
  14. * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
  15. * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
  16. * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
  17. *
  18. * <h2><center>&copy; COPYRIGHT 2010 STMicroelectronics</center></h2>
  19. */
  20. /* Includes ------------------------------------------------------------------*/
  21. #include "stm32f10x_dac.h"
  22. #include "stm32f10x_rcc.h"
  23. /** @addtogroup STM32F10x_StdPeriph_Driver
  24. * @{
  25. */
  26. /** @defgroup DAC
  27. * @brief DAC driver modules
  28. * @{
  29. */
  30. /** @defgroup DAC_Private_TypesDefinitions
  31. * @{
  32. */
  33. /**
  34. * @}
  35. */
  36. /** @defgroup DAC_Private_Defines
  37. * @{
  38. */
  39. /* CR register Mask */
  40. #define CR_CLEAR_MASK ((uint32_t)0x00000FFE)
  41. /* DAC Dual Channels SWTRIG masks */
  42. #define DUAL_SWTRIG_SET ((uint32_t)0x00000003)
  43. #define DUAL_SWTRIG_RESET ((uint32_t)0xFFFFFFFC)
  44. /* DHR registers offsets */
  45. #define DHR12R1_OFFSET ((uint32_t)0x00000008)
  46. #define DHR12R2_OFFSET ((uint32_t)0x00000014)
  47. #define DHR12RD_OFFSET ((uint32_t)0x00000020)
  48. /* DOR register offset */
  49. #define DOR_OFFSET ((uint32_t)0x0000002C)
  50. /**
  51. * @}
  52. */
  53. /** @defgroup DAC_Private_Macros
  54. * @{
  55. */
  56. /**
  57. * @}
  58. */
  59. /** @defgroup DAC_Private_Variables
  60. * @{
  61. */
  62. /**
  63. * @}
  64. */
  65. /** @defgroup DAC_Private_FunctionPrototypes
  66. * @{
  67. */
  68. /**
  69. * @}
  70. */
  71. /** @defgroup DAC_Private_Functions
  72. * @{
  73. */
  74. /**
  75. * @brief Deinitializes the DAC peripheral registers to their default reset values.
  76. * @param None
  77. * @retval None
  78. */
  79. void DAC_DeInit(void)
  80. {
  81. /* Enable DAC reset state */
  82. RCC_APB1PeriphResetCmd(RCC_APB1Periph_DAC, ENABLE);
  83. /* Release DAC from reset state */
  84. RCC_APB1PeriphResetCmd(RCC_APB1Periph_DAC, DISABLE);
  85. }
  86. /**
  87. * @brief Initializes the DAC peripheral according to the specified
  88. * parameters in the DAC_InitStruct.
  89. * @param DAC_Channel: the selected DAC channel.
  90. * This parameter can be one of the following values:
  91. * @arg DAC_Channel_1: DAC Channel1 selected
  92. * @arg DAC_Channel_2: DAC Channel2 selected
  93. * @param DAC_InitStruct: pointer to a DAC_InitTypeDef structure that
  94. * contains the configuration information for the specified DAC channel.
  95. * @retval None
  96. */
  97. void DAC_Init(uint32_t DAC_Channel, DAC_InitTypeDef* DAC_InitStruct)
  98. {
  99. uint32_t tmpreg1 = 0, tmpreg2 = 0;
  100. /* Check the DAC parameters */
  101. assert_param(IS_DAC_TRIGGER(DAC_InitStruct->DAC_Trigger));
  102. assert_param(IS_DAC_GENERATE_WAVE(DAC_InitStruct->DAC_WaveGeneration));
  103. assert_param(IS_DAC_LFSR_UNMASK_TRIANGLE_AMPLITUDE(DAC_InitStruct->DAC_LFSRUnmask_TriangleAmplitude));
  104. assert_param(IS_DAC_OUTPUT_BUFFER_STATE(DAC_InitStruct->DAC_OutputBuffer));
  105. /*---------------------------- DAC CR Configuration --------------------------*/
  106. /* Get the DAC CR value */
  107. tmpreg1 = DAC->CR;
  108. /* Clear BOFFx, TENx, TSELx, WAVEx and MAMPx bits */
  109. tmpreg1 &= ~(CR_CLEAR_MASK << DAC_Channel);
  110. /* Configure for the selected DAC channel: buffer output, trigger, wave genration,
  111. mask/amplitude for wave genration */
  112. /* Set TSELx and TENx bits according to DAC_Trigger value */
  113. /* Set WAVEx bits according to DAC_WaveGeneration value */
  114. /* Set MAMPx bits according to DAC_LFSRUnmask_TriangleAmplitude value */
  115. /* Set BOFFx bit according to DAC_OutputBuffer value */
  116. tmpreg2 = (DAC_InitStruct->DAC_Trigger | DAC_InitStruct->DAC_WaveGeneration |
  117. DAC_InitStruct->DAC_LFSRUnmask_TriangleAmplitude | DAC_InitStruct->DAC_OutputBuffer);
  118. /* Calculate CR register value depending on DAC_Channel */
  119. tmpreg1 |= tmpreg2 << DAC_Channel;
  120. /* Write to DAC CR */
  121. DAC->CR = tmpreg1;
  122. }
  123. /**
  124. * @brief Fills each DAC_InitStruct member with its default value.
  125. * @param DAC_InitStruct : pointer to a DAC_InitTypeDef structure which will
  126. * be initialized.
  127. * @retval None
  128. */
  129. void DAC_StructInit(DAC_InitTypeDef* DAC_InitStruct)
  130. {
  131. /*--------------- Reset DAC init structure parameters values -----------------*/
  132. /* Initialize the DAC_Trigger member */
  133. DAC_InitStruct->DAC_Trigger = DAC_Trigger_None;
  134. /* Initialize the DAC_WaveGeneration member */
  135. DAC_InitStruct->DAC_WaveGeneration = DAC_WaveGeneration_None;
  136. /* Initialize the DAC_LFSRUnmask_TriangleAmplitude member */
  137. DAC_InitStruct->DAC_LFSRUnmask_TriangleAmplitude = DAC_LFSRUnmask_Bit0;
  138. /* Initialize the DAC_OutputBuffer member */
  139. DAC_InitStruct->DAC_OutputBuffer = DAC_OutputBuffer_Enable;
  140. }
  141. /**
  142. * @brief Enables or disables the specified DAC channel.
  143. * @param DAC_Channel: the selected DAC channel.
  144. * This parameter can be one of the following values:
  145. * @arg DAC_Channel_1: DAC Channel1 selected
  146. * @arg DAC_Channel_2: DAC Channel2 selected
  147. * @param NewState: new state of the DAC channel.
  148. * This parameter can be: ENABLE or DISABLE.
  149. * @retval None
  150. */
  151. void DAC_Cmd(uint32_t DAC_Channel, FunctionalState NewState)
  152. {
  153. /* Check the parameters */
  154. assert_param(IS_DAC_CHANNEL(DAC_Channel));
  155. assert_param(IS_FUNCTIONAL_STATE(NewState));
  156. if (NewState != DISABLE)
  157. {
  158. /* Enable the selected DAC channel */
  159. DAC->CR |= (DAC_CR_EN1 << DAC_Channel);
  160. }
  161. else
  162. {
  163. /* Disable the selected DAC channel */
  164. DAC->CR &= ~(DAC_CR_EN1 << DAC_Channel);
  165. }
  166. }
  167. #if defined (STM32F10X_LD_VL) || defined (STM32F10X_MD_VL) || defined (STM32F10X_HD_VL)
  168. /**
  169. * @brief Enables or disables the specified DAC interrupts.
  170. * @param DAC_Channel: the selected DAC channel.
  171. * This parameter can be one of the following values:
  172. * @arg DAC_Channel_1: DAC Channel1 selected
  173. * @arg DAC_Channel_2: DAC Channel2 selected
  174. * @param DAC_IT: specifies the DAC interrupt sources to be enabled or disabled.
  175. * This parameter can be the following values:
  176. * @arg DAC_IT_DMAUDR: DMA underrun interrupt mask
  177. * @param NewState: new state of the specified DAC interrupts.
  178. * This parameter can be: ENABLE or DISABLE.
  179. * @retval None
  180. */
  181. void DAC_ITConfig(uint32_t DAC_Channel, uint32_t DAC_IT, FunctionalState NewState)
  182. {
  183. /* Check the parameters */
  184. assert_param(IS_DAC_CHANNEL(DAC_Channel));
  185. assert_param(IS_FUNCTIONAL_STATE(NewState));
  186. assert_param(IS_DAC_IT(DAC_IT));
  187. if (NewState != DISABLE)
  188. {
  189. /* Enable the selected DAC interrupts */
  190. DAC->CR |= (DAC_IT << DAC_Channel);
  191. }
  192. else
  193. {
  194. /* Disable the selected DAC interrupts */
  195. DAC->CR &= (~(uint32_t)(DAC_IT << DAC_Channel));
  196. }
  197. }
  198. #endif
  199. /**
  200. * @brief Enables or disables the specified DAC channel DMA request.
  201. * @param DAC_Channel: the selected DAC channel.
  202. * This parameter can be one of the following values:
  203. * @arg DAC_Channel_1: DAC Channel1 selected
  204. * @arg DAC_Channel_2: DAC Channel2 selected
  205. * @param NewState: new state of the selected DAC channel DMA request.
  206. * This parameter can be: ENABLE or DISABLE.
  207. * @retval None
  208. */
  209. void DAC_DMACmd(uint32_t DAC_Channel, FunctionalState NewState)
  210. {
  211. /* Check the parameters */
  212. assert_param(IS_DAC_CHANNEL(DAC_Channel));
  213. assert_param(IS_FUNCTIONAL_STATE(NewState));
  214. if (NewState != DISABLE)
  215. {
  216. /* Enable the selected DAC channel DMA request */
  217. DAC->CR |= (DAC_CR_DMAEN1 << DAC_Channel);
  218. }
  219. else
  220. {
  221. /* Disable the selected DAC channel DMA request */
  222. DAC->CR &= ~(DAC_CR_DMAEN1 << DAC_Channel);
  223. }
  224. }
  225. /**
  226. * @brief Enables or disables the selected DAC channel software trigger.
  227. * @param DAC_Channel: the selected DAC channel.
  228. * This parameter can be one of the following values:
  229. * @arg DAC_Channel_1: DAC Channel1 selected
  230. * @arg DAC_Channel_2: DAC Channel2 selected
  231. * @param NewState: new state of the selected DAC channel software trigger.
  232. * This parameter can be: ENABLE or DISABLE.
  233. * @retval None
  234. */
  235. void DAC_SoftwareTriggerCmd(uint32_t DAC_Channel, FunctionalState NewState)
  236. {
  237. /* Check the parameters */
  238. assert_param(IS_DAC_CHANNEL(DAC_Channel));
  239. assert_param(IS_FUNCTIONAL_STATE(NewState));
  240. if (NewState != DISABLE)
  241. {
  242. /* Enable software trigger for the selected DAC channel */
  243. DAC->SWTRIGR |= (uint32_t)DAC_SWTRIGR_SWTRIG1 << (DAC_Channel >> 4);
  244. }
  245. else
  246. {
  247. /* Disable software trigger for the selected DAC channel */
  248. DAC->SWTRIGR &= ~((uint32_t)DAC_SWTRIGR_SWTRIG1 << (DAC_Channel >> 4));
  249. }
  250. }
  251. /**
  252. * @brief Enables or disables simultaneously the two DAC channels software
  253. * triggers.
  254. * @param NewState: new state of the DAC channels software triggers.
  255. * This parameter can be: ENABLE or DISABLE.
  256. * @retval None
  257. */
  258. void DAC_DualSoftwareTriggerCmd(FunctionalState NewState)
  259. {
  260. /* Check the parameters */
  261. assert_param(IS_FUNCTIONAL_STATE(NewState));
  262. if (NewState != DISABLE)
  263. {
  264. /* Enable software trigger for both DAC channels */
  265. DAC->SWTRIGR |= DUAL_SWTRIG_SET ;
  266. }
  267. else
  268. {
  269. /* Disable software trigger for both DAC channels */
  270. DAC->SWTRIGR &= DUAL_SWTRIG_RESET;
  271. }
  272. }
  273. /**
  274. * @brief Enables or disables the selected DAC channel wave generation.
  275. * @param DAC_Channel: the selected DAC channel.
  276. * This parameter can be one of the following values:
  277. * @arg DAC_Channel_1: DAC Channel1 selected
  278. * @arg DAC_Channel_2: DAC Channel2 selected
  279. * @param DAC_Wave: Specifies the wave type to enable or disable.
  280. * This parameter can be one of the following values:
  281. * @arg DAC_Wave_Noise: noise wave generation
  282. * @arg DAC_Wave_Triangle: triangle wave generation
  283. * @param NewState: new state of the selected DAC channel wave generation.
  284. * This parameter can be: ENABLE or DISABLE.
  285. * @retval None
  286. */
  287. void DAC_WaveGenerationCmd(uint32_t DAC_Channel, uint32_t DAC_Wave, FunctionalState NewState)
  288. {
  289. /* Check the parameters */
  290. assert_param(IS_DAC_CHANNEL(DAC_Channel));
  291. assert_param(IS_DAC_WAVE(DAC_Wave));
  292. assert_param(IS_FUNCTIONAL_STATE(NewState));
  293. if (NewState != DISABLE)
  294. {
  295. /* Enable the selected wave generation for the selected DAC channel */
  296. DAC->CR |= DAC_Wave << DAC_Channel;
  297. }
  298. else
  299. {
  300. /* Disable the selected wave generation for the selected DAC channel */
  301. DAC->CR &= ~(DAC_Wave << DAC_Channel);
  302. }
  303. }
  304. /**
  305. * @brief Set the specified data holding register value for DAC channel1.
  306. * @param DAC_Align: Specifies the data alignement for DAC channel1.
  307. * This parameter can be one of the following values:
  308. * @arg DAC_Align_8b_R: 8bit right data alignement selected
  309. * @arg DAC_Align_12b_L: 12bit left data alignement selected
  310. * @arg DAC_Align_12b_R: 12bit right data alignement selected
  311. * @param Data : Data to be loaded in the selected data holding register.
  312. * @retval None
  313. */
  314. void DAC_SetChannel1Data(uint32_t DAC_Align, uint16_t Data)
  315. {
  316. __IO uint32_t tmp = 0;
  317. /* Check the parameters */
  318. assert_param(IS_DAC_ALIGN(DAC_Align));
  319. assert_param(IS_DAC_DATA(Data));
  320. tmp = (uint32_t)DAC_BASE;
  321. tmp += DHR12R1_OFFSET + DAC_Align;
  322. /* Set the DAC channel1 selected data holding register */
  323. *(__IO uint32_t *) tmp = Data;
  324. }
  325. /**
  326. * @brief Set the specified data holding register value for DAC channel2.
  327. * @param DAC_Align: Specifies the data alignement for DAC channel2.
  328. * This parameter can be one of the following values:
  329. * @arg DAC_Align_8b_R: 8bit right data alignement selected
  330. * @arg DAC_Align_12b_L: 12bit left data alignement selected
  331. * @arg DAC_Align_12b_R: 12bit right data alignement selected
  332. * @param Data : Data to be loaded in the selected data holding register.
  333. * @retval None
  334. */
  335. void DAC_SetChannel2Data(uint32_t DAC_Align, uint16_t Data)
  336. {
  337. __IO uint32_t tmp = 0;
  338. /* Check the parameters */
  339. assert_param(IS_DAC_ALIGN(DAC_Align));
  340. assert_param(IS_DAC_DATA(Data));
  341. tmp = (uint32_t)DAC_BASE;
  342. tmp += DHR12R2_OFFSET + DAC_Align;
  343. /* Set the DAC channel2 selected data holding register */
  344. *(__IO uint32_t *)tmp = Data;
  345. }
  346. /**
  347. * @brief Set the specified data holding register value for dual channel
  348. * DAC.
  349. * @param DAC_Align: Specifies the data alignement for dual channel DAC.
  350. * This parameter can be one of the following values:
  351. * @arg DAC_Align_8b_R: 8bit right data alignement selected
  352. * @arg DAC_Align_12b_L: 12bit left data alignement selected
  353. * @arg DAC_Align_12b_R: 12bit right data alignement selected
  354. * @param Data2: Data for DAC Channel2 to be loaded in the selected data
  355. * holding register.
  356. * @param Data1: Data for DAC Channel1 to be loaded in the selected data
  357. * holding register.
  358. * @retval None
  359. */
  360. void DAC_SetDualChannelData(uint32_t DAC_Align, uint16_t Data2, uint16_t Data1)
  361. {
  362. uint32_t data = 0, tmp = 0;
  363. /* Check the parameters */
  364. assert_param(IS_DAC_ALIGN(DAC_Align));
  365. assert_param(IS_DAC_DATA(Data1));
  366. assert_param(IS_DAC_DATA(Data2));
  367. /* Calculate and set dual DAC data holding register value */
  368. if (DAC_Align == DAC_Align_8b_R)
  369. {
  370. data = ((uint32_t)Data2 << 8) | Data1;
  371. }
  372. else
  373. {
  374. data = ((uint32_t)Data2 << 16) | Data1;
  375. }
  376. tmp = (uint32_t)DAC_BASE;
  377. tmp += DHR12RD_OFFSET + DAC_Align;
  378. /* Set the dual DAC selected data holding register */
  379. *(__IO uint32_t *)tmp = data;
  380. }
  381. /**
  382. * @brief Returns the last data output value of the selected DAC cahnnel.
  383. * @param DAC_Channel: the selected DAC channel.
  384. * This parameter can be one of the following values:
  385. * @arg DAC_Channel_1: DAC Channel1 selected
  386. * @arg DAC_Channel_2: DAC Channel2 selected
  387. * @retval The selected DAC channel data output value.
  388. */
  389. uint16_t DAC_GetDataOutputValue(uint32_t DAC_Channel)
  390. {
  391. __IO uint32_t tmp = 0;
  392. /* Check the parameters */
  393. assert_param(IS_DAC_CHANNEL(DAC_Channel));
  394. tmp = (uint32_t) DAC_BASE ;
  395. tmp += DOR_OFFSET + ((uint32_t)DAC_Channel >> 2);
  396. /* Returns the DAC channel data output register value */
  397. return (uint16_t) (*(__IO uint32_t*) tmp);
  398. }
  399. #if defined (STM32F10X_LD_VL) || defined (STM32F10X_MD_VL) || defined (STM32F10X_HD_VL)
  400. /**
  401. * @brief Checks whether the specified DAC flag is set or not.
  402. * @param DAC_Channel: thee selected DAC channel.
  403. * This parameter can be one of the following values:
  404. * @arg DAC_Channel_1: DAC Channel1 selected
  405. * @arg DAC_Channel_2: DAC Channel2 selected
  406. * @param DAC_FLAG: specifies the flag to check.
  407. * This parameter can be only of the following value:
  408. * @arg DAC_FLAG_DMAUDR: DMA underrun flag
  409. * @retval The new state of DAC_FLAG (SET or RESET).
  410. */
  411. FlagStatus DAC_GetFlagStatus(uint32_t DAC_Channel, uint32_t DAC_FLAG)
  412. {
  413. FlagStatus bitstatus = RESET;
  414. /* Check the parameters */
  415. assert_param(IS_DAC_CHANNEL(DAC_Channel));
  416. assert_param(IS_DAC_FLAG(DAC_FLAG));
  417. /* Check the status of the specified DAC flag */
  418. if ((DAC->SR & (DAC_FLAG << DAC_Channel)) != (uint8_t)RESET)
  419. {
  420. /* DAC_FLAG is set */
  421. bitstatus = SET;
  422. }
  423. else
  424. {
  425. /* DAC_FLAG is reset */
  426. bitstatus = RESET;
  427. }
  428. /* Return the DAC_FLAG status */
  429. return bitstatus;
  430. }
  431. /**
  432. * @brief Clears the DAC channelx's pending flags.
  433. * @param DAC_Channel: the selected DAC channel.
  434. * This parameter can be one of the following values:
  435. * @arg DAC_Channel_1: DAC Channel1 selected
  436. * @arg DAC_Channel_2: DAC Channel2 selected
  437. * @param DAC_FLAG: specifies the flag to clear.
  438. * This parameter can be of the following value:
  439. * @arg DAC_FLAG_DMAUDR: DMA underrun flag
  440. * @retval None
  441. */
  442. void DAC_ClearFlag(uint32_t DAC_Channel, uint32_t DAC_FLAG)
  443. {
  444. /* Check the parameters */
  445. assert_param(IS_DAC_CHANNEL(DAC_Channel));
  446. assert_param(IS_DAC_FLAG(DAC_FLAG));
  447. /* Clear the selected DAC flags */
  448. DAC->SR = (DAC_FLAG << DAC_Channel);
  449. }
  450. /**
  451. * @brief Checks whether the specified DAC interrupt has occurred or not.
  452. * @param DAC_Channel: the selected DAC channel.
  453. * This parameter can be one of the following values:
  454. * @arg DAC_Channel_1: DAC Channel1 selected
  455. * @arg DAC_Channel_2: DAC Channel2 selected
  456. * @param DAC_IT: specifies the DAC interrupt source to check.
  457. * This parameter can be the following values:
  458. * @arg DAC_IT_DMAUDR: DMA underrun interrupt mask
  459. * @retval The new state of DAC_IT (SET or RESET).
  460. */
  461. ITStatus DAC_GetITStatus(uint32_t DAC_Channel, uint32_t DAC_IT)
  462. {
  463. ITStatus bitstatus = RESET;
  464. uint32_t enablestatus = 0;
  465. /* Check the parameters */
  466. assert_param(IS_DAC_CHANNEL(DAC_Channel));
  467. assert_param(IS_DAC_IT(DAC_IT));
  468. /* Get the DAC_IT enable bit status */
  469. enablestatus = (DAC->CR & (DAC_IT << DAC_Channel)) ;
  470. /* Check the status of the specified DAC interrupt */
  471. if (((DAC->SR & (DAC_IT << DAC_Channel)) != (uint32_t)RESET) && enablestatus)
  472. {
  473. /* DAC_IT is set */
  474. bitstatus = SET;
  475. }
  476. else
  477. {
  478. /* DAC_IT is reset */
  479. bitstatus = RESET;
  480. }
  481. /* Return the DAC_IT status */
  482. return bitstatus;
  483. }
  484. /**
  485. * @brief Clears the DAC channelx’s interrupt pending bits.
  486. * @param DAC_Channel: the selected DAC channel.
  487. * This parameter can be one of the following values:
  488. * @arg DAC_Channel_1: DAC Channel1 selected
  489. * @arg DAC_Channel_2: DAC Channel2 selected
  490. * @param DAC_IT: specifies the DAC interrupt pending bit to clear.
  491. * This parameter can be the following values:
  492. * @arg DAC_IT_DMAUDR: DMA underrun interrupt mask
  493. * @retval None
  494. */
  495. void DAC_ClearITPendingBit(uint32_t DAC_Channel, uint32_t DAC_IT)
  496. {
  497. /* Check the parameters */
  498. assert_param(IS_DAC_CHANNEL(DAC_Channel));
  499. assert_param(IS_DAC_IT(DAC_IT));
  500. /* Clear the selected DAC interrupt pending bits */
  501. DAC->SR = (DAC_IT << DAC_Channel);
  502. }
  503. #endif
  504. /**
  505. * @}
  506. */
  507. /**
  508. * @}
  509. */
  510. /**
  511. * @}
  512. */
  513. /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/