Go to the documentation of this file.
52 #ifndef __GR55xx_HAL_GPADC_H__
53 #define __GR55xx_HAL_GPADC_H__
168 #define GPADC_P_INPUT_SRC_VCM LL_GPADC_P_INPUT_SRC_VCM
169 #define GPADC_P_INPUT_SRC_IO1 LL_GPADC_P_INPUT_SRC_IO1
170 #define GPADC_P_INPUT_SRC_IO2 LL_GPADC_P_INPUT_SRC_IO2
171 #define GPADC_P_INPUT_SRC_IO3 LL_GPADC_P_INPUT_SRC_IO3
172 #define GPADC_P_INPUT_SRC_IO4 LL_GPADC_P_INPUT_SRC_IO4
173 #define GPADC_P_INPUT_SRC_IO5 LL_GPADC_P_INPUT_SRC_IO5
174 #define GPADC_P_INPUT_SRC_IO6 LL_GPADC_P_INPUT_SRC_IO6
175 #define GPADC_P_INPUT_SRC_IO7 LL_GPADC_P_INPUT_SRC_IO7
181 #define GPADC_N_INPUT_SRC_VCM LL_GPADC_N_INPUT_SRC_VCM
182 #define GPADC_N_INPUT_SRC_IO0 LL_GPADC_N_INPUT_SRC_IO0
183 #define GPADC_N_INPUT_SRC_IO1 LL_GPADC_N_INPUT_SRC_IO1
184 #define GPADC_N_INPUT_SRC_IO2 LL_GPADC_N_INPUT_SRC_IO2
185 #define GPADC_N_INPUT_SRC_IO3 LL_GPADC_N_INPUT_SRC_IO3
186 #define GPADC_N_INPUT_SRC_IO4 LL_GPADC_N_INPUT_SRC_IO4
187 #define GPADC_N_INPUT_SRC_IO5 LL_GPADC_N_INPUT_SRC_IO5
188 #define GPADC_N_INPUT_SRC_IO6 LL_GPADC_N_INPUT_SRC_IO6
194 #define GPADC_INPUT_DIFFERENTIAL LL_GPADC_INPUT_DIFFERENTIAL
195 #define GPADC_INPUT_SINGLE LL_GPADC_INPUT_SINGLE
201 #define GPADC_VDD_VALUE_1P8 LL_GPADC_VDD_VALUE_1P8
202 #define GPADC_VDD_VALUE_2P3 LL_GPADC_VDD_VALUE_2P3
208 #define GPADC_SPR_1M LL_GPADC_SPR_1M
209 #define GPADC_SPR_500K LL_GPADC_SPR_500K
210 #define GPADC_SPR_250K LL_GPADC_SPR_250K
211 #define GPADC_SPR_125K LL_GPADC_SPR_125K
217 #define GPADC_PGA_MODE_BYPASS LL_GPADC_PGA_MODE_BYPASS
218 #define GPADC_PGA_MODE_NORMAL LL_GPADC_PGA_MODE_NORMAL
224 #define GPADC_PGA_GAIN_0DB LL_GPADC_PGA_GAIN_0DB
225 #define GPADC_PGA_GAIN_5DB LL_GPADC_PGA_GAIN_5DB
226 #define GPADC_PGA_GAIN_10DB LL_GPADC_PGA_GAIN_10DB
227 #define GPADC_PGA_GAIN_20DB LL_GPADC_PGA_GAIN_20DB
234 #define HAL_GPADC_ERROR_NONE ((uint32_t)0x00000000)
235 #define HAL_GPADC_ERROR_TIMEOUT ((uint32_t)0x00000001)
236 #define HAL_GPADC_ERROR_DMA ((uint32_t)0x00000004)
237 #define HAL_GPADC_ERROR_INVALID_PARAM ((uint32_t)0x00000008)
251 #define __HAL_GPADC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->state = HAL_GPADC_STATE_RESET)
257 #define __HAL_GPADC_ENABLE(__HANDLE__) ll_gpadc_enable()
263 #define __HAL_GPADC_DISABLE(__HANDLE__) ll_gpadc_disable()
269 #define __HAL_GPADC_GET_FLAG_NOTEMPTY(__HANDLE__) ll_gpadc_is_fifo_notempty()
275 #define __HAL_GPADC_FLUSH_FIFO(__HANDLE__) do { \
276 while(ll_gpadc_is_fifo_notempty()) \
278 ll_gpadc_flush_fifo(); \
uint32_t hal_gpadc_get_error(gpadc_handle_t *p_gpadc)
Return the GPADC error code.
ll_gpadc_init_t gpadc_init_t
GPADC init structure definition.
hal_lock_t
HAL Lock structures definition.
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.
hal_status_t hal_gpadc_start_dma(gpadc_handle_t *p_gpadc, uint16_t *p_data, uint32_t length)
DMA for conversion.
GPADC handle Structure definition.
hal_status_t hal_gpadc_poll_for_conversion(gpadc_handle_t *p_gpadc, uint16_t *p_data, uint32_t length)
Polling for conversion.
LL DMA sg and llp config definition.
hal_gpadc_state_t hal_gpadc_get_state(gpadc_handle_t *p_gpadc)
Return the GPADC handle state.
hal_gpadc_state_t
HAL GPADC State Enumerations definition.
hal_status_t hal_gpadc_stop_dma(gpadc_handle_t *p_gpadc)
Abort ongoing conversion (blocking mode).
struct _hal_gpadc_callback hal_gpadc_callback_t
HAL GPADC Callback function definition.
hal_status_t hal_gpadc_deinit(gpadc_handle_t *p_gpadc)
De-initialize the GPADC peripheral.
hal_status_t hal_gpadc_suspend_reg(gpadc_handle_t *p_gpadc)
Suspend some registers related to GPADC configuration before sleep.
Header file containing functions prototypes of GPADC LL library.
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.
void hal_gpadc_msp_init(gpadc_handle_t *p_gpadc)
Initialize the GPADC MSP.
__IO hal_gpadc_state_t state
Header file containing functions prototypes of DMA HAL library.
HAL GPADC Callback function definition.
hal_status_t
HAL Status structures definition.
void(* gpadc_msp_deinit)(gpadc_handle_t *p_gpadc)
void(* gpadc_msp_init)(gpadc_handle_t *p_gpadc)
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 conj...
void hal_gpadc_conv_cplt_callback(gpadc_handle_t *p_gpadc)
Conversion completed callback.
void hal_gpadc_msp_deinit(gpadc_handle_t *p_gpadc)
De-initialize the GPADC MSP.
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 ass...
struct _gpadc_handle gpadc_handle_t
GPADC handle Structure definition.
DMA handle Structure definition.
This file contains HAL common definitions, enumeration, macros and structures definitions.
void(* gpadc_conv_cplt_callback)(gpadc_handle_t *p_gpadc)