Initialization and de-initialization Functions

Initialization and Configuration functions. More...

Functions

hal_status_t hal_gpadc_init (gpadc_handle_t *p_gpadc)
 Initialize the GPADC according to the specified parameters in the gpadc_init_t and initialize the associated handle. More...
 
hal_status_t hal_gpadc_deinit (gpadc_handle_t *p_gpadc)
 De-initialize the GPADC peripheral. More...
 
void hal_gpadc_msp_init (gpadc_handle_t *p_gpadc)
 Initialize the GPADC MSP. More...
 
void hal_gpadc_msp_deinit (gpadc_handle_t *p_gpadc)
 De-initialize the GPADC MSP. More...
 
hal_status_t hal_gpadc_poll_for_conversion (gpadc_handle_t *p_gpadc, uint16_t *p_data, uint32_t length)
 Polling for conversion. More...
 
hal_status_t hal_gpadc_start_dma (gpadc_handle_t *p_gpadc, uint16_t *p_data, uint32_t length)
 DMA for conversion. More...
 
hal_status_t hal_gpadc_start_dma_sg_llp (gpadc_handle_t *p_gpadc, uint16_t *p_data, uint32_t length, dma_sg_llp_config_t *sg_llp_config)
 DMA for conversion. More...
 
hal_status_t hal_gpadc_stop_dma (gpadc_handle_t *p_gpadc)
 Abort ongoing conversion (blocking mode). More...
 
void hal_gpadc_conv_cplt_callback (gpadc_handle_t *p_gpadc)
 Conversion completed callback. More...
 
hal_gpadc_state_t hal_gpadc_get_state (gpadc_handle_t *p_gpadc)
 Return the GPADC handle state. More...
 
uint32_t hal_gpadc_get_error (gpadc_handle_t *p_gpadc)
 Return the GPADC error code. More...
 
hal_status_t hal_gpadc_suspend_reg (gpadc_handle_t *p_gpadc)
 Suspend some registers related to GPADC configuration before sleep. More...
 
hal_status_t hal_gpadc_resume_reg (gpadc_handle_t *p_gpadc)
 Restore some registers related to GPADC configuration after sleep. This function must be used in conjunction with the hal_gpadc_suspend_reg(). More...
 
void hal_gr55xx_gpadc_code_to_voltage (gpadc_handle_t *p_gpadc, uint16_t *inbuf, float *outbuf, uint32_t buflen)
 Convert the GPADC conversion results to a voltage value. More...
 

Detailed Description

Initialization and Configuration functions.

Function Documentation

◆ hal_gpadc_conv_cplt_callback()

void hal_gpadc_conv_cplt_callback ( gpadc_handle_t p_gpadc)

Conversion completed callback.

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

◆ hal_gpadc_deinit()

hal_status_t hal_gpadc_deinit ( gpadc_handle_t p_gpadc)

De-initialize the GPADC peripheral.

Parameters
[in]p_gpadcPointer to an GPADC handle which contains the configuration information for the specified GPADC module.
Return values
HAL_OKOperation is OK.
HAL_ERRORParameter error or operation not supported.
HAL_BUSYDriver is busy.
HAL_TIMEOUTTimeout occurred.

◆ hal_gpadc_get_error()

uint32_t hal_gpadc_get_error ( gpadc_handle_t p_gpadc)

Return the GPADC error code.

Parameters
[in]p_gpadcPointer to an GPADC handle which contains the configuration information for the specified GPADC module.
Returns
GPADC error code in bitmap format

◆ hal_gpadc_get_state()

hal_gpadc_state_t hal_gpadc_get_state ( gpadc_handle_t p_gpadc)

Return the GPADC handle state.

Parameters
[in]p_gpadcPointer to an GPADC handle which contains the configuration information for the specified GPADC module.
Return values
HAL_GPADC_STATE_RESETPeripheral not initialized.
HAL_GPADC_STATE_READYPeripheral initialized and ready for use.
HAL_GPADC_STATE_BUSYAn internal process is ongoing.
HAL_GPADC_STATE_ERRORPeripheral in error.

◆ hal_gpadc_init()

hal_status_t hal_gpadc_init ( gpadc_handle_t p_gpadc)

Initialize the GPADC according to the specified parameters in the gpadc_init_t and initialize the associated handle.

Parameters
[in]p_gpadcPointer to an GPADC handle which contains the configuration information for the specified GPADC module.
Return values
HAL_OKOperation is OK.
HAL_ERRORParameter error or operation not supported.
HAL_BUSYDriver is busy.
HAL_TIMEOUTTimeout occurred.

◆ hal_gpadc_msp_deinit()

void hal_gpadc_msp_deinit ( gpadc_handle_t p_gpadc)

De-initialize the GPADC MSP.

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

◆ hal_gpadc_msp_init()

void hal_gpadc_msp_init ( gpadc_handle_t p_gpadc)

Initialize the GPADC MSP.

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

◆ hal_gpadc_poll_for_conversion()

hal_status_t hal_gpadc_poll_for_conversion ( gpadc_handle_t p_gpadc,
uint16_t *  p_data,
uint32_t  length 
)

Polling for conversion.

Parameters
[in]p_gpadcPointer to an GPADC handle.
[in]p_dataPointer to data buffer which to store GPADC 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_gpadc_resume_reg()

hal_status_t hal_gpadc_resume_reg ( gpadc_handle_t p_gpadc)

Restore some registers related to GPADC configuration after sleep. This function must be used in conjunction with the hal_gpadc_suspend_reg().

Parameters
[in]p_gpadcPointer to a GPADC handle which contains the configuration information for the specified GPADC module.
Return values
HAL_OKOperation is OK.
HAL_ERRORParameter error or operation not supported.
HAL_BUSYDriver is busy.
HAL_TIMEOUTTimeout occurred.

◆ hal_gpadc_start_dma()

hal_status_t hal_gpadc_start_dma ( gpadc_handle_t p_gpadc,
uint16_t *  p_data,
uint32_t  length 
)

DMA for conversion.

Parameters
[in]p_gpadcPointer to an GPADC handle.
[in]p_dataPointer to data buffer which to store GPADC 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_gpadc_start_dma_sg_llp()

hal_status_t hal_gpadc_start_dma_sg_llp ( gpadc_handle_t p_gpadc,
uint16_t *  p_data,
uint32_t  length,
dma_sg_llp_config_t sg_llp_config 
)

DMA for conversion.

Parameters
[in]p_gpadcPointer to an GPADC handle.
[in]p_dataPointer to data buffer which to store GPADC conversion results.
[in]lengthLength of data buffer, ranging between 0 and 4095.
[in]sg_llp_configThe config of source and destination's SG and LLP functions.
Return values
HAL_OKOperation is OK.
HAL_ERRORParameter error or operation not supported.
HAL_BUSYDriver is busy.
HAL_TIMEOUTTimeout occurred.

◆ hal_gpadc_stop_dma()

hal_status_t hal_gpadc_stop_dma ( gpadc_handle_t p_gpadc)

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 GPADC 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_gpadcGPADC handle.
Return values
HAL_OKOperation is OK.
HAL_ERRORParameter error or operation not supported.
HAL_BUSYDriver is busy.
HAL_TIMEOUTTimeout occurred.

◆ hal_gpadc_suspend_reg()

hal_status_t hal_gpadc_suspend_reg ( gpadc_handle_t p_gpadc)

Suspend some registers related to GPADC configuration before sleep.

Parameters
[in]p_gpadcPointer to a GPADC handle which contains the configuration information for the specified GPADC module.
Return values
HAL_OKOperation is OK.
HAL_ERRORParameter error or operation not supported.
HAL_BUSYDriver is busy.
HAL_TIMEOUTTimeout occurred.

◆ hal_gr55xx_gpadc_code_to_voltage()

void hal_gr55xx_gpadc_code_to_voltage ( gpadc_handle_t p_gpadc,
uint16_t *  inbuf,
float *  outbuf,
uint32_t  buflen 
)

Convert the GPADC conversion results to a voltage value.

Parameters
[in]p_gpadcPointer to a GPADC handle which contains the configuration information for the specified GPADC module.
[in]inbufPointer to data buffer which storage GPADC conversion results.
[out]outbufPointer to data buffer which to storage voltage results.
[in]buflenLength of data buffer, ranging between 0 and 4095.
Returns
Result of operation.