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.
 
 
 

547 lines
22 KiB

  1. /**
  2. ******************************************************************************
  3. * @file stm32h7xx_hal_dac.h
  4. * @author MCD Application Team
  5. * @brief Header file of DAC HAL module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * <h2><center>&copy; Copyright (c) 2017 STMicroelectronics.
  10. * All rights reserved.</center></h2>
  11. *
  12. * This software component is licensed by ST under BSD 3-Clause license,
  13. * the "License"; You may not use this file except in compliance with the
  14. * License. You may obtain a copy of the License at:
  15. * opensource.org/licenses/BSD-3-Clause
  16. *
  17. ******************************************************************************
  18. */
  19. /* Define to prevent recursive inclusion -------------------------------------*/
  20. #ifndef STM32H7xx_HAL_DAC_H
  21. #define STM32H7xx_HAL_DAC_H
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. /** @addtogroup STM32H7xx_HAL_Driver
  26. * @{
  27. */
  28. /* Includes ------------------------------------------------------------------*/
  29. #include "stm32h7xx_hal_def.h"
  30. #if defined(DAC1) || defined(DAC2)
  31. /** @addtogroup DAC
  32. * @{
  33. */
  34. /* Exported types ------------------------------------------------------------*/
  35. /** @defgroup DAC_Exported_Types DAC Exported Types
  36. * @{
  37. */
  38. /**
  39. * @brief HAL State structures definition
  40. */
  41. typedef enum
  42. {
  43. HAL_DAC_STATE_RESET = 0x00U, /*!< DAC not yet initialized or disabled */
  44. HAL_DAC_STATE_READY = 0x01U, /*!< DAC initialized and ready for use */
  45. HAL_DAC_STATE_BUSY = 0x02U, /*!< DAC internal processing is ongoing */
  46. HAL_DAC_STATE_TIMEOUT = 0x03U, /*!< DAC timeout state */
  47. HAL_DAC_STATE_ERROR = 0x04U /*!< DAC error state */
  48. } HAL_DAC_StateTypeDef;
  49. /**
  50. * @brief DAC handle Structure definition
  51. */
  52. #if (USE_HAL_DAC_REGISTER_CALLBACKS == 1)
  53. typedef struct __DAC_HandleTypeDef
  54. #else
  55. typedef struct
  56. #endif /* USE_HAL_DAC_REGISTER_CALLBACKS */
  57. {
  58. DAC_TypeDef *Instance; /*!< Register base address */
  59. __IO HAL_DAC_StateTypeDef State; /*!< DAC communication state */
  60. HAL_LockTypeDef Lock; /*!< DAC locking object */
  61. DMA_HandleTypeDef *DMA_Handle1; /*!< Pointer DMA handler for channel 1 */
  62. DMA_HandleTypeDef *DMA_Handle2; /*!< Pointer DMA handler for channel 2 */
  63. __IO uint32_t ErrorCode; /*!< DAC Error code */
  64. #if (USE_HAL_DAC_REGISTER_CALLBACKS == 1)
  65. void (* ConvCpltCallbackCh1) (struct __DAC_HandleTypeDef *hdac);
  66. void (* ConvHalfCpltCallbackCh1) (struct __DAC_HandleTypeDef *hdac);
  67. void (* ErrorCallbackCh1) (struct __DAC_HandleTypeDef *hdac);
  68. void (* DMAUnderrunCallbackCh1) (struct __DAC_HandleTypeDef *hdac);
  69. void (* ConvCpltCallbackCh2) (struct __DAC_HandleTypeDef *hdac);
  70. void (* ConvHalfCpltCallbackCh2) (struct __DAC_HandleTypeDef *hdac);
  71. void (* ErrorCallbackCh2) (struct __DAC_HandleTypeDef *hdac);
  72. void (* DMAUnderrunCallbackCh2) (struct __DAC_HandleTypeDef *hdac);
  73. void (* MspInitCallback) (struct __DAC_HandleTypeDef *hdac);
  74. void (* MspDeInitCallback ) (struct __DAC_HandleTypeDef *hdac);
  75. #endif /* USE_HAL_DAC_REGISTER_CALLBACKS */
  76. } DAC_HandleTypeDef;
  77. /**
  78. * @brief DAC Configuration sample and hold Channel structure definition
  79. */
  80. typedef struct
  81. {
  82. uint32_t DAC_SampleTime ; /*!< Specifies the Sample time for the selected channel.
  83. This parameter applies when DAC_SampleAndHold is DAC_SAMPLEANDHOLD_ENABLE.
  84. This parameter must be a number between Min_Data = 0 and Max_Data = 1023 */
  85. uint32_t DAC_HoldTime ; /*!< Specifies the hold time for the selected channel
  86. This parameter applies when DAC_SampleAndHold is DAC_SAMPLEANDHOLD_ENABLE.
  87. This parameter must be a number between Min_Data = 0 and Max_Data = 1023 */
  88. uint32_t DAC_RefreshTime ; /*!< Specifies the refresh time for the selected channel
  89. This parameter applies when DAC_SampleAndHold is DAC_SAMPLEANDHOLD_ENABLE.
  90. This parameter must be a number between Min_Data = 0 and Max_Data = 255 */
  91. } DAC_SampleAndHoldConfTypeDef;
  92. /**
  93. * @brief DAC Configuration regular Channel structure definition
  94. */
  95. typedef struct
  96. {
  97. uint32_t DAC_SampleAndHold; /*!< Specifies whether the DAC mode.
  98. This parameter can be a value of @ref DAC_SampleAndHold */
  99. uint32_t DAC_Trigger; /*!< Specifies the external trigger for the selected DAC channel.
  100. This parameter can be a value of @ref DAC_trigger_selection */
  101. uint32_t DAC_OutputBuffer; /*!< Specifies whether the DAC channel output buffer is enabled or disabled.
  102. This parameter can be a value of @ref DAC_output_buffer */
  103. uint32_t DAC_ConnectOnChipPeripheral ; /*!< Specifies whether the DAC output is connected or not to on chip peripheral .
  104. This parameter can be a value of @ref DAC_ConnectOnChipPeripheral */
  105. uint32_t DAC_UserTrimming; /*!< Specifies the trimming mode
  106. This parameter must be a value of @ref DAC_UserTrimming
  107. DAC_UserTrimming is either factory or user trimming */
  108. uint32_t DAC_TrimmingValue; /*!< Specifies the offset trimming value
  109. i.e. when DAC_SampleAndHold is DAC_TRIMMING_USER.
  110. This parameter must be a number between Min_Data = 1 and Max_Data = 31 */
  111. DAC_SampleAndHoldConfTypeDef DAC_SampleAndHoldConfig; /*!< Sample and Hold settings */
  112. } DAC_ChannelConfTypeDef;
  113. #if (USE_HAL_DAC_REGISTER_CALLBACKS == 1)
  114. /**
  115. * @brief HAL DAC Callback ID enumeration definition
  116. */
  117. typedef enum
  118. {
  119. HAL_DAC_CH1_COMPLETE_CB_ID = 0x00U, /*!< DAC CH1 Complete Callback ID */
  120. HAL_DAC_CH1_HALF_COMPLETE_CB_ID = 0x01U, /*!< DAC CH1 half Complete Callback ID */
  121. HAL_DAC_CH1_ERROR_ID = 0x02U, /*!< DAC CH1 error Callback ID */
  122. HAL_DAC_CH1_UNDERRUN_CB_ID = 0x03U, /*!< DAC CH1 underrun Callback ID */
  123. HAL_DAC_CH2_COMPLETE_CB_ID = 0x04U, /*!< DAC CH2 Complete Callback ID */
  124. HAL_DAC_CH2_HALF_COMPLETE_CB_ID = 0x05U, /*!< DAC CH2 half Complete Callback ID */
  125. HAL_DAC_CH2_ERROR_ID = 0x06U, /*!< DAC CH2 error Callback ID */
  126. HAL_DAC_CH2_UNDERRUN_CB_ID = 0x07U, /*!< DAC CH2 underrun Callback ID */
  127. HAL_DAC_MSPINIT_CB_ID = 0x08U, /*!< DAC MspInit Callback ID */
  128. HAL_DAC_MSPDEINIT_CB_ID = 0x09U, /*!< DAC MspDeInit Callback ID */
  129. HAL_DAC_ALL_CB_ID = 0x0AU /*!< DAC All ID */
  130. } HAL_DAC_CallbackIDTypeDef;
  131. /**
  132. * @brief HAL DAC Callback pointer definition
  133. */
  134. typedef void (*pDAC_CallbackTypeDef)(DAC_HandleTypeDef *hdac);
  135. #endif /* USE_HAL_DAC_REGISTER_CALLBACKS */
  136. /**
  137. * @}
  138. */
  139. /* Exported constants --------------------------------------------------------*/
  140. /** @defgroup DAC_Exported_Constants DAC Exported Constants
  141. * @{
  142. */
  143. /** @defgroup DAC_Error_Code DAC Error Code
  144. * @{
  145. */
  146. #define HAL_DAC_ERROR_NONE 0x00U /*!< No error */
  147. #define HAL_DAC_ERROR_DMAUNDERRUNCH1 0x01U /*!< DAC channel1 DMA underrun error */
  148. #define HAL_DAC_ERROR_DMAUNDERRUNCH2 0x02U /*!< DAC channel2 DMA underrun error */
  149. #define HAL_DAC_ERROR_DMA 0x04U /*!< DMA error */
  150. #define HAL_DAC_ERROR_TIMEOUT 0x08U /*!< Timeout error */
  151. #if (USE_HAL_DAC_REGISTER_CALLBACKS == 1)
  152. #define HAL_DAC_ERROR_INVALID_CALLBACK 0x10U /*!< Invalid callback error */
  153. #endif /* USE_HAL_DAC_REGISTER_CALLBACKS */
  154. /**
  155. * @}
  156. */
  157. /** @defgroup DAC_trigger_selection DAC trigger selection
  158. * @{
  159. */
  160. #define DAC_TRIGGER_NONE 0x00000000U /*!< Conversion is automatic once the DAC_DHRxxxx register has been loaded, and not by external trigger */
  161. #define DAC_TRIGGER_SOFTWARE ( DAC_CR_TEN1) /*!< Conversion started by software trigger for DAC channel */
  162. #define DAC_TRIGGER_T1_TRGO ( DAC_CR_TSEL1_0 | DAC_CR_TEN1) /*!< TIM1 TRGO selected as external conversion trigger for DAC channel */
  163. #define DAC_TRIGGER_T2_TRGO ( DAC_CR_TSEL1_1 | DAC_CR_TEN1) /*!< TIM2 TRGO selected as external conversion trigger for DAC channel */
  164. #define DAC_TRIGGER_T4_TRGO ( DAC_CR_TSEL1_1 | DAC_CR_TSEL1_0 | DAC_CR_TEN1) /*!< TIM4 TRGO selected as external conversion trigger for DAC channel */
  165. #define DAC_TRIGGER_T5_TRGO ( DAC_CR_TSEL1_2 | DAC_CR_TEN1) /*!< TIM5 TRGO selected as external conversion trigger for DAC channel */
  166. #define DAC_TRIGGER_T6_TRGO ( DAC_CR_TSEL1_2 | DAC_CR_TSEL1_0 | DAC_CR_TEN1) /*!< TIM6 TRGO selected as external conversion trigger for DAC channel */
  167. #define DAC_TRIGGER_T7_TRGO ( DAC_CR_TSEL1_2 | DAC_CR_TSEL1_1 | DAC_CR_TEN1) /*!< TIM7 TRGO selected as external conversion trigger for DAC channel */
  168. #define DAC_TRIGGER_T8_TRGO ( DAC_CR_TSEL1_2 | DAC_CR_TSEL1_1 | DAC_CR_TSEL1_0 | DAC_CR_TEN1) /*!< TIM8 TRGO selected as external conversion trigger for DAC channel */
  169. #define DAC_TRIGGER_T15_TRGO (DAC_CR_TSEL1_3 | DAC_CR_TEN1) /*!< TIM15 TRGO selected as external conversion trigger for DAC channel */
  170. #if defined(HRTIM1)
  171. #define DAC_TRIGGER_HR1_TRGO1 (DAC_CR_TSEL1_3 | DAC_CR_TSEL1_0 | DAC_CR_TEN1) /*!< HR1 TRGO1 selected as external conversion trigger for DAC channel */
  172. #define DAC_TRIGGER_HR1_TRGO2 (DAC_CR_TSEL1_3 | DAC_CR_TSEL1_1 | DAC_CR_TEN1) /*!< HR1 TRGO2 selected as external conversion trigger for DAC channel */
  173. #endif
  174. #define DAC_TRIGGER_LPTIM1_OUT (DAC_CR_TSEL1_3 | DAC_CR_TSEL1_1 | DAC_CR_TSEL1_0 | DAC_CR_TEN1) /*!< LPTIM1 OUT TRGO selected as external conversion trigger for DAC channel */
  175. #define DAC_TRIGGER_LPTIM2_OUT (DAC_CR_TSEL1_3 | DAC_CR_TSEL1_2 | DAC_CR_TEN1) /*!< LPTIM2 OUT TRGO selected as external conversion trigger for DAC channel */
  176. #define DAC_TRIGGER_EXT_IT9 (DAC_CR_TSEL1_3 | DAC_CR_TSEL1_2 | DAC_CR_TSEL1_0 | DAC_CR_TEN1) /*!< EXTI Line9 event selected as external conversion trigger for DAC channel */
  177. #if defined(TIM23)
  178. #define DAC_TRIGGER_T23_TRGO (DAC_CR_TSEL1_3 | DAC_CR_TSEL1_2 | DAC_CR_TSEL1_1 | DAC_CR_TEN1) /*!< TIM23 TRGO selected as external conversion trigger for DAC channel */
  179. #endif
  180. #if defined(TIM24)
  181. #define DAC_TRIGGER_T24_TRGO (DAC_CR_TSEL1_3 | DAC_CR_TSEL1_2 | DAC_CR_TSEL1_1 | DAC_CR_TSEL1_0 | DAC_CR_TEN1) /*!< TIM24 TRGO selected as external conversion trigger for DAC channel */
  182. #endif
  183. #if defined(DAC2)
  184. #define DAC_TRIGGER_LPTIM3_OUT (DAC_CR_TSEL1_3 | DAC_CR_TSEL1_2 | DAC_CR_TSEL1_1 | DAC_CR_TEN1) /*!< LPTIM3 OUT TRGO selected as external conversion trigger for DAC channel */
  185. #endif
  186. /**
  187. * @}
  188. */
  189. /** @defgroup DAC_output_buffer DAC output buffer
  190. * @{
  191. */
  192. #define DAC_OUTPUTBUFFER_ENABLE 0x00000000U
  193. #define DAC_OUTPUTBUFFER_DISABLE (DAC_MCR_MODE1_1)
  194. /**
  195. * @}
  196. */
  197. /** @defgroup DAC_Channel_selection DAC Channel selection
  198. * @{
  199. */
  200. #define DAC_CHANNEL_1 0x00000000U
  201. #define DAC_CHANNEL_2 0x00000010U
  202. /**
  203. * @}
  204. */
  205. /** @defgroup DAC_data_alignment DAC data alignment
  206. * @{
  207. */
  208. #define DAC_ALIGN_12B_R 0x00000000U
  209. #define DAC_ALIGN_12B_L 0x00000004U
  210. #define DAC_ALIGN_8B_R 0x00000008U
  211. /**
  212. * @}
  213. */
  214. /** @defgroup DAC_flags_definition DAC flags definition
  215. * @{
  216. */
  217. #define DAC_FLAG_DMAUDR1 (DAC_SR_DMAUDR1)
  218. #define DAC_FLAG_DMAUDR2 (DAC_SR_DMAUDR2)
  219. /**
  220. * @}
  221. */
  222. /** @defgroup DAC_IT_definition DAC IT definition
  223. * @{
  224. */
  225. #define DAC_IT_DMAUDR1 (DAC_SR_DMAUDR1)
  226. #define DAC_IT_DMAUDR2 (DAC_SR_DMAUDR2)
  227. /**
  228. * @}
  229. */
  230. /** @defgroup DAC_ConnectOnChipPeripheral DAC ConnectOnChipPeripheral
  231. * @{
  232. */
  233. #define DAC_CHIPCONNECT_EXTERNAL (1UL << 0)
  234. #define DAC_CHIPCONNECT_INTERNAL (1UL << 1)
  235. #define DAC_CHIPCONNECT_BOTH (1UL << 2)
  236. /**
  237. * @}
  238. */
  239. /** @defgroup DAC_UserTrimming DAC User Trimming
  240. * @{
  241. */
  242. #define DAC_TRIMMING_FACTORY (0x00000000UL) /*!< Factory trimming */
  243. #define DAC_TRIMMING_USER (0x00000001UL) /*!< User trimming */
  244. /**
  245. * @}
  246. */
  247. /** @defgroup DAC_SampleAndHold DAC power mode
  248. * @{
  249. */
  250. #define DAC_SAMPLEANDHOLD_DISABLE (0x00000000UL)
  251. #define DAC_SAMPLEANDHOLD_ENABLE (DAC_MCR_MODE1_2)
  252. /**
  253. * @}
  254. */
  255. /**
  256. * @}
  257. */
  258. /* Exported macro ------------------------------------------------------------*/
  259. /** @defgroup DAC_Exported_Macros DAC Exported Macros
  260. * @{
  261. */
  262. /** @brief Reset DAC handle state.
  263. * @param __HANDLE__ specifies the DAC handle.
  264. * @retval None
  265. */
  266. #if (USE_HAL_DAC_REGISTER_CALLBACKS == 1)
  267. #define __HAL_DAC_RESET_HANDLE_STATE(__HANDLE__) do { \
  268. (__HANDLE__)->State = HAL_DAC_STATE_RESET; \
  269. (__HANDLE__)->MspInitCallback = NULL; \
  270. (__HANDLE__)->MspDeInitCallback = NULL; \
  271. } while(0)
  272. #else
  273. #define __HAL_DAC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_DAC_STATE_RESET)
  274. #endif /* USE_HAL_DAC_REGISTER_CALLBACKS */
  275. /** @brief Enable the DAC channel.
  276. * @param __HANDLE__ specifies the DAC handle.
  277. * @param __DAC_Channel__ specifies the DAC channel
  278. * @retval None
  279. */
  280. #define __HAL_DAC_ENABLE(__HANDLE__, __DAC_Channel__) \
  281. ((__HANDLE__)->Instance->CR |= (DAC_CR_EN1 << ((__DAC_Channel__) & 0x10UL)))
  282. /** @brief Disable the DAC channel.
  283. * @param __HANDLE__ specifies the DAC handle
  284. * @param __DAC_Channel__ specifies the DAC channel.
  285. * @retval None
  286. */
  287. #define __HAL_DAC_DISABLE(__HANDLE__, __DAC_Channel__) \
  288. ((__HANDLE__)->Instance->CR &= ~(DAC_CR_EN1 << ((__DAC_Channel__) & 0x10UL)))
  289. /** @brief Set DHR12R1 alignment.
  290. * @param __ALIGNMENT__ specifies the DAC alignment
  291. * @retval None
  292. */
  293. #define DAC_DHR12R1_ALIGNMENT(__ALIGNMENT__) (0x00000008UL + (__ALIGNMENT__))
  294. /** @brief Set DHR12R2 alignment.
  295. * @param __ALIGNMENT__ specifies the DAC alignment
  296. * @retval None
  297. */
  298. #define DAC_DHR12R2_ALIGNMENT(__ALIGNMENT__) (0x00000014UL + (__ALIGNMENT__))
  299. /** @brief Set DHR12RD alignment.
  300. * @param __ALIGNMENT__ specifies the DAC alignment
  301. * @retval None
  302. */
  303. #define DAC_DHR12RD_ALIGNMENT(__ALIGNMENT__) (0x00000020UL + (__ALIGNMENT__))
  304. /** @brief Enable the DAC interrupt.
  305. * @param __HANDLE__ specifies the DAC handle
  306. * @param __INTERRUPT__ specifies the DAC interrupt.
  307. * This parameter can be any combination of the following values:
  308. * @arg DAC_IT_DMAUDR1 DAC channel 1 DMA underrun interrupt
  309. * @arg DAC_IT_DMAUDR2 DAC channel 2 DMA underrun interrupt
  310. * @retval None
  311. */
  312. #define __HAL_DAC_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->CR) |= (__INTERRUPT__))
  313. /** @brief Disable the DAC interrupt.
  314. * @param __HANDLE__ specifies the DAC handle
  315. * @param __INTERRUPT__ specifies the DAC interrupt.
  316. * This parameter can be any combination of the following values:
  317. * @arg DAC_IT_DMAUDR1 DAC channel 1 DMA underrun interrupt
  318. * @arg DAC_IT_DMAUDR2 DAC channel 2 DMA underrun interrupt
  319. * @retval None
  320. */
  321. #define __HAL_DAC_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->CR) &= ~(__INTERRUPT__))
  322. /** @brief Check whether the specified DAC interrupt source is enabled or not.
  323. * @param __HANDLE__ DAC handle
  324. * @param __INTERRUPT__ DAC interrupt source to check
  325. * This parameter can be any combination of the following values:
  326. * @arg DAC_IT_DMAUDR1 DAC channel 1 DMA underrun interrupt
  327. * @arg DAC_IT_DMAUDR2 DAC channel 2 DMA underrun interrupt
  328. * @retval State of interruption (SET or RESET)
  329. */
  330. #define __HAL_DAC_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->CR & (__INTERRUPT__)) == (__INTERRUPT__))
  331. /** @brief Get the selected DAC's flag status.
  332. * @param __HANDLE__ specifies the DAC handle.
  333. * @param __FLAG__ specifies the DAC flag to get.
  334. * This parameter can be any combination of the following values:
  335. * @arg DAC_FLAG_DMAUDR1 DAC channel 1 DMA underrun flag
  336. * @arg DAC_FLAG_DMAUDR2 DAC channel 2 DMA underrun flag
  337. * @retval None
  338. */
  339. #define __HAL_DAC_GET_FLAG(__HANDLE__, __FLAG__) ((((__HANDLE__)->Instance->SR) & (__FLAG__)) == (__FLAG__))
  340. /** @brief Clear the DAC's flag.
  341. * @param __HANDLE__ specifies the DAC handle.
  342. * @param __FLAG__ specifies the DAC flag to clear.
  343. * This parameter can be any combination of the following values:
  344. * @arg DAC_FLAG_DMAUDR1 DAC channel 1 DMA underrun flag
  345. * @arg DAC_FLAG_DMAUDR2 DAC channel 2 DMA underrun flag
  346. * @retval None
  347. */
  348. #define __HAL_DAC_CLEAR_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR) = (__FLAG__))
  349. /**
  350. * @}
  351. */
  352. /* Private macro -------------------------------------------------------------*/
  353. /** @defgroup DAC_Private_Macros DAC Private Macros
  354. * @{
  355. */
  356. #define IS_DAC_OUTPUT_BUFFER_STATE(STATE) (((STATE) == DAC_OUTPUTBUFFER_ENABLE) || \
  357. ((STATE) == DAC_OUTPUTBUFFER_DISABLE))
  358. #define IS_DAC_CHANNEL(CHANNEL) (((CHANNEL) == DAC_CHANNEL_1) || \
  359. ((CHANNEL) == DAC_CHANNEL_2))
  360. #define IS_DAC_ALIGN(ALIGN) (((ALIGN) == DAC_ALIGN_12B_R) || \
  361. ((ALIGN) == DAC_ALIGN_12B_L) || \
  362. ((ALIGN) == DAC_ALIGN_8B_R))
  363. #define IS_DAC_DATA(DATA) ((DATA) <= 0xFFF0UL)
  364. #define IS_DAC_REFRESHTIME(TIME) ((TIME) <= 0x000000FFUL)
  365. /**
  366. * @}
  367. */
  368. /* Include DAC HAL Extended module */
  369. #include "stm32h7xx_hal_dac_ex.h"
  370. /* Exported functions --------------------------------------------------------*/
  371. /** @addtogroup DAC_Exported_Functions
  372. * @{
  373. */
  374. /** @addtogroup DAC_Exported_Functions_Group1
  375. * @{
  376. */
  377. /* Initialization and de-initialization functions *****************************/
  378. HAL_StatusTypeDef HAL_DAC_Init(DAC_HandleTypeDef *hdac);
  379. HAL_StatusTypeDef HAL_DAC_DeInit(DAC_HandleTypeDef *hdac);
  380. void HAL_DAC_MspInit(DAC_HandleTypeDef *hdac);
  381. void HAL_DAC_MspDeInit(DAC_HandleTypeDef *hdac);
  382. /**
  383. * @}
  384. */
  385. /** @addtogroup DAC_Exported_Functions_Group2
  386. * @{
  387. */
  388. /* IO operation functions *****************************************************/
  389. HAL_StatusTypeDef HAL_DAC_Start(DAC_HandleTypeDef *hdac, uint32_t Channel);
  390. HAL_StatusTypeDef HAL_DAC_Stop(DAC_HandleTypeDef *hdac, uint32_t Channel);
  391. HAL_StatusTypeDef HAL_DAC_Start_DMA(DAC_HandleTypeDef *hdac, uint32_t Channel, uint32_t *pData, uint32_t Length,
  392. uint32_t Alignment);
  393. HAL_StatusTypeDef HAL_DAC_Stop_DMA(DAC_HandleTypeDef *hdac, uint32_t Channel);
  394. void HAL_DAC_IRQHandler(DAC_HandleTypeDef *hdac);
  395. HAL_StatusTypeDef HAL_DAC_SetValue(DAC_HandleTypeDef *hdac, uint32_t Channel, uint32_t Alignment, uint32_t Data);
  396. void HAL_DAC_ConvCpltCallbackCh1(DAC_HandleTypeDef *hdac);
  397. void HAL_DAC_ConvHalfCpltCallbackCh1(DAC_HandleTypeDef *hdac);
  398. void HAL_DAC_ErrorCallbackCh1(DAC_HandleTypeDef *hdac);
  399. void HAL_DAC_DMAUnderrunCallbackCh1(DAC_HandleTypeDef *hdac);
  400. #if (USE_HAL_DAC_REGISTER_CALLBACKS == 1)
  401. /* DAC callback registering/unregistering */
  402. HAL_StatusTypeDef HAL_DAC_RegisterCallback(DAC_HandleTypeDef *hdac, HAL_DAC_CallbackIDTypeDef CallbackID,
  403. pDAC_CallbackTypeDef pCallback);
  404. HAL_StatusTypeDef HAL_DAC_UnRegisterCallback(DAC_HandleTypeDef *hdac, HAL_DAC_CallbackIDTypeDef CallbackID);
  405. #endif /* USE_HAL_DAC_REGISTER_CALLBACKS */
  406. /**
  407. * @}
  408. */
  409. /** @addtogroup DAC_Exported_Functions_Group3
  410. * @{
  411. */
  412. /* Peripheral Control functions ***********************************************/
  413. uint32_t HAL_DAC_GetValue(DAC_HandleTypeDef *hdac, uint32_t Channel);
  414. HAL_StatusTypeDef HAL_DAC_ConfigChannel(DAC_HandleTypeDef *hdac, DAC_ChannelConfTypeDef *sConfig, uint32_t Channel);
  415. /**
  416. * @}
  417. */
  418. /** @addtogroup DAC_Exported_Functions_Group4
  419. * @{
  420. */
  421. /* Peripheral State and Error functions ***************************************/
  422. HAL_DAC_StateTypeDef HAL_DAC_GetState(DAC_HandleTypeDef *hdac);
  423. uint32_t HAL_DAC_GetError(DAC_HandleTypeDef *hdac);
  424. /**
  425. * @}
  426. */
  427. /**
  428. * @}
  429. */
  430. /** @defgroup DAC_Private_Functions DAC Private Functions
  431. * @{
  432. */
  433. void DAC_DMAConvCpltCh1(DMA_HandleTypeDef *hdma);
  434. void DAC_DMAErrorCh1(DMA_HandleTypeDef *hdma);
  435. void DAC_DMAHalfConvCpltCh1(DMA_HandleTypeDef *hdma);
  436. /**
  437. * @}
  438. */
  439. /**
  440. * @}
  441. */
  442. #endif /* DAC1 || DAC2 */
  443. /**
  444. * @}
  445. */
  446. #ifdef __cplusplus
  447. }
  448. #endif
  449. #endif /*STM32H7xx_HAL_DAC_H */
  450. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/