gr55xx_hal_gpadc.h File Reference

Header file containing functions prototypes of GPADC HAL library. More...

#include "gr55xx_ll_gpadc.h"
#include "gr55xx_hal_def.h"
#include "gr55xx_hal_dma.h"

Go to the source code of this file.

Classes

struct  _gpadc_handle
 GPADC handle Structure definition. More...
 
struct  _hal_gpadc_callback
 HAL GPADC Callback function definition. More...
 

Macros

#define GPADC_P_INPUT_SRC_VCM   LL_GPADC_P_INPUT_SRC_VCM
 
#define GPADC_P_INPUT_SRC_IO1   LL_GPADC_P_INPUT_SRC_IO1
 
#define GPADC_P_INPUT_SRC_IO2   LL_GPADC_P_INPUT_SRC_IO2
 
#define GPADC_P_INPUT_SRC_IO3   LL_GPADC_P_INPUT_SRC_IO3
 
#define GPADC_P_INPUT_SRC_IO4   LL_GPADC_P_INPUT_SRC_IO4
 
#define GPADC_P_INPUT_SRC_IO5   LL_GPADC_P_INPUT_SRC_IO5
 
#define GPADC_P_INPUT_SRC_IO6   LL_GPADC_P_INPUT_SRC_IO6
 
#define GPADC_P_INPUT_SRC_IO7   LL_GPADC_P_INPUT_SRC_IO7
 
#define GPADC_N_INPUT_SRC_VCM   LL_GPADC_N_INPUT_SRC_VCM
 
#define GPADC_N_INPUT_SRC_IO0   LL_GPADC_N_INPUT_SRC_IO0
 
#define GPADC_N_INPUT_SRC_IO1   LL_GPADC_N_INPUT_SRC_IO1
 
#define GPADC_N_INPUT_SRC_IO2   LL_GPADC_N_INPUT_SRC_IO2
 
#define GPADC_N_INPUT_SRC_IO3   LL_GPADC_N_INPUT_SRC_IO3
 
#define GPADC_N_INPUT_SRC_IO4   LL_GPADC_N_INPUT_SRC_IO4
 
#define GPADC_N_INPUT_SRC_IO5   LL_GPADC_N_INPUT_SRC_IO5
 
#define GPADC_N_INPUT_SRC_IO6   LL_GPADC_N_INPUT_SRC_IO6
 
#define GPADC_INPUT_DIFFERENTIAL   LL_GPADC_INPUT_DIFFERENTIAL
 
#define GPADC_INPUT_SINGLE   LL_GPADC_INPUT_SINGLE
 
#define GPADC_VDD_VALUE_1P8   LL_GPADC_VDD_VALUE_1P8
 
#define GPADC_VDD_VALUE_2P3   LL_GPADC_VDD_VALUE_2P3
 
#define GPADC_SPR_1M   LL_GPADC_SPR_1M
 
#define GPADC_SPR_500K   LL_GPADC_SPR_500K
 
#define GPADC_SPR_250K   LL_GPADC_SPR_250K
 
#define GPADC_SPR_125K   LL_GPADC_SPR_125K
 
#define GPADC_PGA_MODE_BYPASS   LL_GPADC_PGA_MODE_BYPASS
 
#define GPADC_PGA_MODE_NORMAL   LL_GPADC_PGA_MODE_NORMAL
 
#define GPADC_PGA_GAIN_0DB   LL_GPADC_PGA_GAIN_0DB
 
#define GPADC_PGA_GAIN_5DB   LL_GPADC_PGA_GAIN_5DB
 
#define GPADC_PGA_GAIN_10DB   LL_GPADC_PGA_GAIN_10DB
 
#define GPADC_PGA_GAIN_20DB   LL_GPADC_PGA_GAIN_20DB
 
#define HAL_GPADC_ERROR_NONE   ((uint32_t)0x00000000)
 
#define HAL_GPADC_ERROR_TIMEOUT   ((uint32_t)0x00000001)
 
#define HAL_GPADC_ERROR_DMA   ((uint32_t)0x00000004)
 
#define HAL_GPADC_ERROR_INVALID_PARAM   ((uint32_t)0x00000008)
 
#define __HAL_GPADC_RESET_HANDLE_STATE(__HANDLE__)   ((__HANDLE__)->state = HAL_GPADC_STATE_RESET)
 Reset GPADC handle states. More...
 
#define __HAL_GPADC_ENABLE(__HANDLE__)   ll_gpadc_enable()
 Enable the specified GPADC peripheral. More...
 
#define __HAL_GPADC_DISABLE(__HANDLE__)   ll_gpadc_disable()
 Disable the specified GPADC peripheral. More...
 
#define __HAL_GPADC_GET_FLAG_NOTEMPTY(__HANDLE__)   ll_gpadc_is_fifo_notempty()
 Check the FIFO is not empty. More...
 
#define __HAL_GPADC_FLUSH_FIFO(__HANDLE__)
 Flush the FIFO. More...
 

Typedefs

typedef ll_gpadc_init_t gpadc_init_t
 GPADC init structure definition. More...
 
typedef struct _gpadc_handle gpadc_handle_t
 GPADC handle Structure definition. More...
 
typedef struct _hal_gpadc_callback hal_gpadc_callback_t
 HAL GPADC Callback function definition. More...
 

Enumerations

enum  hal_gpadc_state_t {
  HAL_GPADC_STATE_RESET = 0x00,
  HAL_GPADC_STATE_READY = 0x01,
  HAL_GPADC_STATE_BUSY = 0x02,
  HAL_GPADC_STATE_ERROR = 0x04
}
 HAL GPADC State Enumerations definition. 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

Header file containing functions prototypes of GPADC HAL library.

Author
BLE Driver Team
Attention
#####Copyright (c) 2019 GOODIX All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of GOODIX nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition in file gr55xx_hal_gpadc.h.