IO Operation Functions

ADC polling and DMA conversion management functions. More...

Functions

hal_status_t hal_adc_set_dma_threshold (adc_handle_t *p_adc, uint32_t threshold)
 Set the FIFO threshold for DMA trigger. More...
 
uint32_t hal_adc_get_dma_threshold (adc_handle_t *p_adc)
 Get the FIFO threshold for DMA trigger. More...
 
hal_status_t hal_adc_poll_for_conversion (adc_handle_t *p_adc, uint16_t *p_data, uint32_t length)
 Polling for conversion. More...
 
hal_status_t hal_adc_start_dma (adc_handle_t *p_adc, uint16_t *p_data, uint32_t length)
 DMA for conversion. More...
 
hal_status_t hal_adc_stop_dma (adc_handle_t *p_adc)
 Abort ongoing conversion (blocking mode). More...
 
void hal_adc_conv_cplt_callback (adc_handle_t *p_adc)
 Conversion completed callback. More...
 

Detailed Description

ADC polling and DMA conversion management functions.

Function Documentation

◆ hal_adc_conv_cplt_callback()

void hal_adc_conv_cplt_callback ( adc_handle_t p_adc)

Conversion completed callback.

Note
This function should not be modified. When the callback is needed, the hal_adc_msp_deinit can be implemented in the user file.
Parameters
[in]p_adcPointer to an ADC handle which contains the configuration information for the specified ADC module.

◆ hal_adc_get_dma_threshold()

uint32_t hal_adc_get_dma_threshold ( adc_handle_t p_adc)

Get the FIFO threshold for DMA trigger.

Parameters
[in]p_adcPointer to an ADC handle which contains the configuration information for the specified ADC module.
Returns
FIFO threshold

◆ hal_adc_poll_for_conversion()

hal_status_t hal_adc_poll_for_conversion ( adc_handle_t p_adc,
uint16_t *  p_data,
uint32_t  length 
)

Polling for conversion.

Parameters
[in]p_adcPointer to an ADC handle.
[in]p_dataPointer to data buffer which to store ADC conversion results.
[in]lengthLength of data buffer.
Return values
HAL_OKOperation is OK.
HAL_ERRORParameter error or operation not supported.
HAL_BUSYDriver is busy.
HAL_TIMEOUTTimeout occurred.

◆ hal_adc_set_dma_threshold()

hal_status_t hal_adc_set_dma_threshold ( adc_handle_t p_adc,
uint32_t  threshold 
)

Set the FIFO threshold for DMA trigger.

Parameters
[in]p_adcPointer to an ADC handle which contains the configuration information for the specified ADC module.
[in]thresholdFIFO threshold value ranging bwtween 0x0U ~ 0x64U.
Return values
HAL_OKOperation is OK.
HAL_ERRORParameter error or operation not supported.
HAL_BUSYDriver is busy.
HAL_TIMEOUTTimeout occurred.

◆ hal_adc_start_dma()

hal_status_t hal_adc_start_dma ( adc_handle_t p_adc,
uint16_t *  p_data,
uint32_t  length 
)

DMA for conversion.

Parameters
[in]p_adcPointer to an ADC handle.
[in]p_dataPointer to data buffer which to store ADC conversion results.
[in]lengthLength of data buffer, ranging between 0 and 4095.
Return values
HAL_OKOperation is OK.
HAL_ERRORParameter error or operation not supported.
HAL_BUSYDriver is busy.
HAL_TIMEOUTTimeout occurred.

◆ hal_adc_stop_dma()

hal_status_t hal_adc_stop_dma ( adc_handle_t p_adc)

Abort ongoing conversion (blocking mode).

Note
This procedure could be only used for aborting conversion started in DMA mode. This procedure performs following operations:
  • Disable ADC clock, stop conversion
  • Abort DMA transfer by calling hal_dma_abort (in case of transfer in DMA mode)
  • Set handle State to READY. This procedure is executed in blocking mode: when exiting function, Abort is considered as completed.
Parameters
[in]p_adcADC handle.
Return values
HAL_OKOperation is OK.
HAL_ERRORParameter error or operation not supported.
HAL_BUSYDriver is busy.
HAL_TIMEOUTTimeout occurred.