STM32L486xx HAL User Manual
Functions
IO operation functions
DAC Exported Functions

IO operation functions. More...

Functions

HAL_StatusTypeDef HAL_DAC_Start (DAC_HandleTypeDef *hdac, uint32_t Channel)
 Enables DAC and starts conversion of channel.
HAL_StatusTypeDef HAL_DAC_Stop (DAC_HandleTypeDef *hdac, uint32_t Channel)
 Disables DAC and stop conversion of channel.
HAL_StatusTypeDef HAL_DAC_Start_DMA (DAC_HandleTypeDef *hdac, uint32_t Channel, uint32_t *pData, uint32_t Length, uint32_t Alignment)
 Enables DAC and starts conversion of channel.
HAL_StatusTypeDef HAL_DAC_Stop_DMA (DAC_HandleTypeDef *hdac, uint32_t Channel)
 Disables DAC and stop conversion of channel.
void HAL_DAC_IRQHandler (DAC_HandleTypeDef *hdac)
 Handles DAC interrupt request This function uses the interruption of DMA underrun.
HAL_StatusTypeDef HAL_DAC_SetValue (DAC_HandleTypeDef *hdac, uint32_t Channel, uint32_t Alignment, uint32_t Data)
 Set the specified data holding register value for DAC channel.
__weak void HAL_DAC_ConvCpltCallbackCh1 (DAC_HandleTypeDef *hdac)
 Conversion complete callback in non-blocking mode for Channel1.
__weak void HAL_DAC_ConvHalfCpltCallbackCh1 (DAC_HandleTypeDef *hdac)
 Conversion half DMA transfer callback in non-blocking mode for Channel1.
__weak void HAL_DAC_ErrorCallbackCh1 (DAC_HandleTypeDef *hdac)
 Error DAC callback for Channel1.
__weak void HAL_DAC_DMAUnderrunCallbackCh1 (DAC_HandleTypeDef *hdac)
 DMA underrun DAC callback for channel1.
HAL_StatusTypeDef HAL_DAC_RegisterCallback (DAC_HandleTypeDef *hdac, HAL_DAC_CallbackIDTypeDef CallbackID, pDAC_CallbackTypeDef pCallback)
 Register a User DAC Callback To be used instead of the weak (surcharged) predefined callback.
HAL_StatusTypeDef HAL_DAC_UnRegisterCallback (DAC_HandleTypeDef *hdac, HAL_DAC_CallbackIDTypeDef CallbackID)
 Unregister a User DAC Callback DAC Callback is redirected to the weak (surcharged) predefined callback.

Detailed Description

IO operation functions.

  ==============================================================================
             ##### IO operation functions #####
  ==============================================================================
    [..]  This section provides functions allowing to:
      (+) Start conversion.
      (+) Stop conversion.
      (+) Start conversion and enable DMA transfer.
      (+) Stop conversion and disable DMA transfer.
      (+) Get result of conversion.


Function Documentation

Conversion complete callback in non-blocking mode for Channel1.

Parameters:
hdac,:pointer to a DAC_HandleTypeDef structure that contains the configuration information for the specified DAC.
Return values:
None

Definition at line 1065 of file stm32l4xx_hal_dac.c.

Referenced by DAC_DMAConvCpltCh1(), HAL_DAC_Init(), and HAL_DAC_UnRegisterCallback().

Conversion half DMA transfer callback in non-blocking mode for Channel1.

Parameters:
hdac,:pointer to a DAC_HandleTypeDef structure that contains the configuration information for the specified DAC.
Return values:
None

Definition at line 1081 of file stm32l4xx_hal_dac.c.

Referenced by DAC_DMAHalfConvCpltCh1(), HAL_DAC_Init(), and HAL_DAC_UnRegisterCallback().

DMA underrun DAC callback for channel1.

Parameters:
hdac,:pointer to a DAC_HandleTypeDef structure that contains the configuration information for the specified DAC.
Return values:
None

Definition at line 1113 of file stm32l4xx_hal_dac.c.

Referenced by HAL_DAC_Init(), HAL_DAC_IRQHandler(), and HAL_DAC_UnRegisterCallback().

Error DAC callback for Channel1.

Parameters:
hdac,:pointer to a DAC_HandleTypeDef structure that contains the configuration information for the specified DAC.
Return values:
None

Definition at line 1097 of file stm32l4xx_hal_dac.c.

Referenced by DAC_DMAErrorCh1(), HAL_DAC_Init(), and HAL_DAC_UnRegisterCallback().

Handles DAC interrupt request This function uses the interruption of DMA underrun.

Parameters:
hdac,:pointer to a DAC_HandleTypeDef structure that contains the configuration information for the specified DAC.
Return values:
None

Definition at line 957 of file stm32l4xx_hal_dac.c.

References __HAL_DAC_CLEAR_FLAG, __HAL_DAC_GET_FLAG, __HAL_DAC_GET_IT_SOURCE, DAC_FLAG_DMAUDR1, DAC_FLAG_DMAUDR2, DAC_IT_DMAUDR1, DAC_IT_DMAUDR2, __DAC_HandleTypeDef::DMAUnderrunCallbackCh1, __DAC_HandleTypeDef::DMAUnderrunCallbackCh2, __DAC_HandleTypeDef::ErrorCode, HAL_DAC_DMAUnderrunCallbackCh1(), HAL_DAC_ERROR_DMAUNDERRUNCH1, HAL_DAC_ERROR_DMAUNDERRUNCH2, HAL_DAC_STATE_ERROR, HAL_DACEx_DMAUnderrunCallbackCh2(), __DAC_HandleTypeDef::Instance, and __DAC_HandleTypeDef::State.

HAL_StatusTypeDef HAL_DAC_RegisterCallback ( DAC_HandleTypeDef hdac,
HAL_DAC_CallbackIDTypeDef  CallbackID,
pDAC_CallbackTypeDef  pCallback 
)

Register a User DAC Callback To be used instead of the weak (surcharged) predefined callback.

Parameters:
hdacDAC handle
CallbackIDID of the callback to be registered This parameter can be one of the following values:
pCallbackpointer to the Callback function
Return values:
status

Definition at line 1391 of file stm32l4xx_hal_dac.c.

References __DAC_HandleTypeDef::ConvCpltCallbackCh1, __DAC_HandleTypeDef::ConvCpltCallbackCh2, __DAC_HandleTypeDef::ConvHalfCpltCallbackCh1, __DAC_HandleTypeDef::ConvHalfCpltCallbackCh2, __DAC_HandleTypeDef::DMAUnderrunCallbackCh1, __DAC_HandleTypeDef::DMAUnderrunCallbackCh2, __DAC_HandleTypeDef::ErrorCallbackCh1, __DAC_HandleTypeDef::ErrorCallbackCh2, __DAC_HandleTypeDef::ErrorCode, HAL_DAC_CH1_COMPLETE_CB_ID, HAL_DAC_CH1_ERROR_ID, HAL_DAC_CH1_HALF_COMPLETE_CB_ID, HAL_DAC_CH1_UNDERRUN_CB_ID, HAL_DAC_CH2_COMPLETE_CB_ID, HAL_DAC_CH2_ERROR_ID, HAL_DAC_CH2_HALF_COMPLETE_CB_ID, HAL_DAC_CH2_UNDERRUN_CB_ID, HAL_DAC_ERROR_INVALID_CALLBACK, HAL_DAC_MSP_DEINIT_CB_ID, HAL_DAC_MSP_INIT_CB_ID, HAL_DAC_STATE_READY, HAL_DAC_STATE_RESET, __DAC_HandleTypeDef::MspDeInitCallback, __DAC_HandleTypeDef::MspInitCallback, and __DAC_HandleTypeDef::State.

HAL_StatusTypeDef HAL_DAC_SetValue ( DAC_HandleTypeDef hdac,
uint32_t  Channel,
uint32_t  Alignment,
uint32_t  Data 
)

Set the specified data holding register value for DAC channel.

Parameters:
hdac,:pointer to a DAC_HandleTypeDef structure that contains the configuration information for the specified DAC.
Channel,:The selected DAC channel. This parameter can be one of the following values:
  • DAC_CHANNEL_1: DAC Channel1 selected
  • DAC_CHANNEL_2: DAC Channel2 selected
Alignment,:Specifies the data alignment. This parameter can be one of the following values:
  • DAC_ALIGN_8B_R: 8bit right data alignment selected
  • DAC_ALIGN_12B_L: 12bit left data alignment selected
  • DAC_ALIGN_12B_R: 12bit right data alignment selected
Data,:Data to be loaded in the selected data holding register.
Return values:
HALstatus

Definition at line 1033 of file stm32l4xx_hal_dac.c.

References assert_param, DAC_CHANNEL_1, DAC_DHR12R1_ALIGNMENT, DAC_DHR12R2_ALIGNMENT, __DAC_HandleTypeDef::Instance, IS_DAC_ALIGN, IS_DAC_CHANNEL, and IS_DAC_DATA.

HAL_StatusTypeDef HAL_DAC_Start ( DAC_HandleTypeDef hdac,
uint32_t  Channel 
)

Enables DAC and starts conversion of channel.

Parameters:
hdac,:pointer to a DAC_HandleTypeDef structure that contains the configuration information for the specified DAC.
Channel,:The selected DAC channel. This parameter can be one of the following values:
  • DAC_CHANNEL_1: DAC Channel1 selected
  • DAC_CHANNEL_2: DAC Channel2 selected (when supported)
Return values:
HALstatus

Definition at line 557 of file stm32l4xx_hal_dac.c.

References __HAL_DAC_ENABLE, assert_param, DAC_CHANNEL_1, HAL_DAC_STATE_BUSY, HAL_DAC_STATE_READY, __DAC_HandleTypeDef::Instance, IS_DAC_CHANNEL, and __DAC_HandleTypeDef::State.

HAL_StatusTypeDef HAL_DAC_Start_DMA ( DAC_HandleTypeDef hdac,
uint32_t  Channel,
uint32_t *  pData,
uint32_t  Length,
uint32_t  Alignment 
)

Enables DAC and starts conversion of channel.

Parameters:
hdac,:pointer to a DAC_HandleTypeDef structure that contains the configuration information for the specified DAC.
Channel,:The selected DAC channel. This parameter can be one of the following values:
  • DAC_CHANNEL_1: DAC Channel1 selected
  • DAC_CHANNEL_2: DAC Channel2 selected
pData,:The destination peripheral Buffer address.
Length,:The length of data to be transferred from memory to DAC peripheral
Alignment,:Specifies the data alignment for DAC channel. This parameter can be one of the following values:
  • DAC_ALIGN_8B_R: 8bit right data alignment selected
  • DAC_ALIGN_12B_L: 12bit left data alignment selected
  • DAC_ALIGN_12B_R: 12bit right data alignment selected
Return values:
HALstatus

Definition at line 761 of file stm32l4xx_hal_dac.c.

References __HAL_DAC_ENABLE, __HAL_DAC_ENABLE_IT, assert_param, DAC_ALIGN_12B_L, DAC_ALIGN_12B_R, DAC_ALIGN_8B_R, DAC_CHANNEL_1, DAC_DMAConvCpltCh1(), DAC_DMAConvCpltCh2(), DAC_DMAErrorCh1(), DAC_DMAErrorCh2(), DAC_DMAHalfConvCpltCh1(), DAC_DMAHalfConvCpltCh2(), DAC_IT_DMAUDR1, DAC_IT_DMAUDR2, __DAC_HandleTypeDef::DMA_Handle1, __DAC_HandleTypeDef::DMA_Handle2, HAL_DAC_STATE_BUSY, HAL_DMA_Start_IT(), __DAC_HandleTypeDef::Instance, IS_DAC_ALIGN, IS_DAC_CHANNEL, __DAC_HandleTypeDef::State, __DMA_HandleTypeDef::XferCpltCallback, __DMA_HandleTypeDef::XferErrorCallback, and __DMA_HandleTypeDef::XferHalfCpltCallback.

HAL_StatusTypeDef HAL_DAC_Stop ( DAC_HandleTypeDef hdac,
uint32_t  Channel 
)

Disables DAC and stop conversion of channel.

Parameters:
hdac,:pointer to a DAC_HandleTypeDef structure that contains the configuration information for the specified DAC.
Channel,:The selected DAC channel. This parameter can be one of the following values:
  • DAC_CHANNEL_1: DAC Channel1 selected
  • DAC_CHANNEL_2: DAC Channel2 selected
Return values:
HALstatus

Definition at line 645 of file stm32l4xx_hal_dac.c.

References __HAL_DAC_DISABLE, assert_param, HAL_DAC_STATE_READY, IS_DAC_CHANNEL, and __DAC_HandleTypeDef::State.

HAL_StatusTypeDef HAL_DAC_Stop_DMA ( DAC_HandleTypeDef hdac,
uint32_t  Channel 
)

Disables DAC and stop conversion of channel.

Parameters:
hdac,:pointer to a DAC_HandleTypeDef structure that contains the configuration information for the specified DAC.
Channel,:The selected DAC channel. This parameter can be one of the following values:
  • DAC_CHANNEL_1: DAC Channel1 selected
  • DAC_CHANNEL_2: DAC Channel2 selected
Return values:
HALstatus

Definition at line 883 of file stm32l4xx_hal_dac.c.

References __HAL_DAC_DISABLE, __HAL_DAC_DISABLE_IT, assert_param, DAC_CHANNEL_1, DAC_IT_DMAUDR1, DAC_IT_DMAUDR2, __DAC_HandleTypeDef::DMA_Handle1, __DAC_HandleTypeDef::DMA_Handle2, HAL_DAC_STATE_ERROR, HAL_DAC_STATE_READY, HAL_DMA_Abort(), __DAC_HandleTypeDef::Instance, IS_DAC_CHANNEL, and __DAC_HandleTypeDef::State.

HAL_StatusTypeDef HAL_DAC_UnRegisterCallback ( DAC_HandleTypeDef hdac,
HAL_DAC_CallbackIDTypeDef  CallbackID 
)

Unregister a User DAC Callback DAC Callback is redirected to the weak (surcharged) predefined callback.

Parameters:
hdacDAC handle
CallbackIDID of the callback to be unregistered This parameter can be one of the following values:
Return values:
status

Definition at line 1497 of file stm32l4xx_hal_dac.c.

References __DAC_HandleTypeDef::ConvCpltCallbackCh1, __DAC_HandleTypeDef::ConvCpltCallbackCh2, __DAC_HandleTypeDef::ConvHalfCpltCallbackCh1, __DAC_HandleTypeDef::ConvHalfCpltCallbackCh2, __DAC_HandleTypeDef::DMAUnderrunCallbackCh1, __DAC_HandleTypeDef::DMAUnderrunCallbackCh2, __DAC_HandleTypeDef::ErrorCallbackCh1, __DAC_HandleTypeDef::ErrorCallbackCh2, __DAC_HandleTypeDef::ErrorCode, HAL_DAC_ALL_CB_ID, HAL_DAC_CH1_COMPLETE_CB_ID, HAL_DAC_CH1_ERROR_ID, HAL_DAC_CH1_HALF_COMPLETE_CB_ID, HAL_DAC_CH1_UNDERRUN_CB_ID, HAL_DAC_CH2_COMPLETE_CB_ID, HAL_DAC_CH2_ERROR_ID, HAL_DAC_CH2_HALF_COMPLETE_CB_ID, HAL_DAC_CH2_UNDERRUN_CB_ID, HAL_DAC_ConvCpltCallbackCh1(), HAL_DAC_ConvHalfCpltCallbackCh1(), HAL_DAC_DMAUnderrunCallbackCh1(), HAL_DAC_ERROR_INVALID_CALLBACK, HAL_DAC_ErrorCallbackCh1(), HAL_DAC_MSP_DEINIT_CB_ID, HAL_DAC_MSP_INIT_CB_ID, HAL_DAC_MspDeInit(), HAL_DAC_MspInit(), HAL_DAC_STATE_READY, HAL_DAC_STATE_RESET, HAL_DACEx_ConvCpltCallbackCh2(), HAL_DACEx_ConvHalfCpltCallbackCh2(), HAL_DACEx_DMAUnderrunCallbackCh2(), HAL_DACEx_ErrorCallbackCh2(), __DAC_HandleTypeDef::MspDeInitCallback, __DAC_HandleTypeDef::MspInitCallback, and __DAC_HandleTypeDef::State.