Classes | Macros | Typedefs | Enumerations | Functions
hal_adc.h File Reference

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

`#include "ll_adc.h"`
`#include "hal_def.h"`
`#include "hal_dma.h"`
`#include "hal_pwr_mgmt.h"`

Go to the source code of this file.

## Classes
struct | _adc_handle
| ADC handle Structure definition. More...
struct | _hal_adc_callback
| HAL ADC Callback function definition. More...

## Macros
#define | HAL_ADC_ERROR_NONE ((uint32_t)0x00000000)
#define | HAL_ADC_ERROR_TIMEOUT ((uint32_t)0x00000001)
#define | HAL_ADC_ERROR_DMA ((uint32_t)0x00000004)
#define | HAL_ADC_ERROR_INVALID_PARAM ((uint32_t)0x00000008)
#define | ADC_CLK_16M LL_ADC_CLK_16M
#define | ADC_CLK_8M LL_ADC_CLK_8M
#define | ADC_CLK_4M LL_ADC_CLK_4M
#define | ADC_CLK_1M LL_ADC_CLK_1M
#define | ADC_CLK_16K LL_ADC_CLK_16K
#define | ADC_CLK_8K LL_ADC_CLK_8K
#define | ADC_CLK_4K LL_ADC_CLK_4K
#define | ADC_CLK_NONE LL_ADC_CLK_NONE
#define | ADC_REF_VALUE_0P8 LL_ADC_REF_VALUE_0P8
#define | ADC_REF_VALUE_1P2 LL_ADC_REF_VALUE_1P2
#define | ADC_REF_VALUE_1P6 LL_ADC_REF_VALUE_1P6
#define | ADC_REF_VALUE_2P0 LL_ADC_REF_VALUE_2P0
#define | ADC_INPUT_SINGLE LL_ADC_INPUT_SINGLE
#define | ADC_INPUT_DIFFERENTIAL LL_ADC_INPUT_DIFFERENTIAL
#define | ADC_INPUT_SRC_IO0 LL_ADC_INPUT_SRC_IO0
#define | ADC_INPUT_SRC_IO1 LL_ADC_INPUT_SRC_IO1
#define | ADC_INPUT_SRC_IO2 LL_ADC_INPUT_SRC_IO2
#define | ADC_INPUT_SRC_IO3 LL_ADC_INPUT_SRC_IO3
#define | ADC_INPUT_SRC_IO4 LL_ADC_INPUT_SRC_IO4
#define | ADC_INPUT_SRC_IO5 LL_ADC_INPUT_SRC_IO5
#define | ADC_INPUT_SRC_IO6 LL_ADC_INPUT_SRC_IO6
#define | ADC_INPUT_SRC_IO7 LL_ADC_INPUT_SRC_IO7
#define | ADC_INPUT_SRC_TMP LL_ADC_INPUT_SRC_TMP
#define | ADC_INPUT_SRC_BAT LL_ADC_INPUT_SRC_BAT
#define | ADC_INPUT_SRC_REF LL_ADC_INPUT_SRC_REF
#define | ADC_REF_SRC_BUF_INT LL_ADC_REF_SRC_BUF_INT
#define | ADC_REF_SRC_IO0 LL_ADC_REF_SRC_IO0
#define | ADC_REF_SRC_IO1 LL_ADC_REF_SRC_IO1
#define | ADC_REF_SRC_IO2 LL_ADC_REF_SRC_IO2
#define | ADC_REF_SRC_IO3 LL_ADC_REF_SRC_IO3
#define | ADC_DEFAULT_CONFIG LL_ADC_DEFAULT_CONFIG
| ADC_default_config initStruct default configuartion. More...
#define | __HAL_ADC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->state = HAL_ADC_STATE_RESET)
| Reset ADC handle states. More...
#define | __HAL_ADC_ENABLE(__HANDLE__) ll_adc_enable()
| Enable the specified ADC peripheral. More...
#define | __HAL_ADC_DISABLE(__HANDLE__) ll_adc_disable()
| Disable the specified ADC peripheral. More...
#define | __HAL_ADC_GET_FLAG_NOTEMPTY(__HANDLE__) ll_adc_is_fifo_notempty()
| Check the FIFO is not empty. More...
#define | __HAL_ADC_TRY_SWTOKEN_LOCK(__HANDLE__) ll_adc_try_lock_sw_token()
| Try to lock ADC token by SW. More...
#define | __HAL_ADC_FLUSH_FIFO(__HANDLE__)
| Flush the FIFO. More...
#define | IS_ADC_INPUT(__INPUT__)
| Check if ADC input source is valid. More...
#define | IS_ADC_INPUT_MODE(__MODE__)
| Check if ADC input mode is valid. More...
#define | IS_ADC_REF(__INPUT__)
| Check if ADC reference source is valid. More...
#define | IS_ADC_REF_VALUE(__VALUE__)
| Check if ADC reference value is valid. More...
#define | IS_ADC_CLOCK(__CLOCK__)
| Check if ADC clock is valid. More...

## Typedefs
typedef ll_adc_init_t | adc_init_t
| ADC init structure definition. More...
typedef struct _adc_handle | adc_handle_t
| ADC handle Structure definition. More...
typedef struct _hal_adc_callback | hal_adc_callback_t
| HAL ADC Callback function definition. More...

## Enumerations
enum | hal_adc_state_t { HAL_ADC_STATE_RESET = 0x00, HAL_ADC_STATE_READY = 0x01, HAL_ADC_STATE_BUSY = 0x02, HAL_ADC_STATE_ERROR = 0x04 }
| HAL ADC State Enumerations definition. More...

## Functions
hal_status_t | hal_adc_init (adc_handle_t *p_adc)
| Initialize the ADC according to the specified parameters in the adc_init_t and initialize the associated handle. More...
hal_status_t | hal_adc_deinit (adc_handle_t *p_adc)
| De-initialize the ADC peripheral. More...
void | hal_adc_msp_init (adc_handle_t *p_adc)
| Initialize the ADC MSP. More...
void | hal_adc_msp_deinit (adc_handle_t *p_adc)
| De-initialize the ADC MSP. More...
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...
hal_adc_state_t | hal_adc_get_state (adc_handle_t *p_adc)
| Return the ADC handle state. More...
uint32_t | hal_adc_get_error (adc_handle_t *p_adc)
| Return the ADC error code. More...
void | hal_adc_suspend_reg (adc_handle_t *p_adc)
| Suspend some registers related to ADC configuration before sleep. More...
void | hal_adc_resume_reg (adc_handle_t *p_adc)
| Restore some registers related to ADC configuration after sleep. This function must be used in conjunction with the hal_adc_suspend_reg(). More...
hal_pm_status_t | hal_pm_adc_suspend (adc_handle_t *p_adc)
| Suspend the specified ADC. More...
void | hal_pm_adc_resume (adc_handle_t *p_adc)
| Resume the specified ADC. More...
void | hal_adc_voltage_intern (adc_handle_t *p_adc, uint16_t *p_inbuf, double *p_outbuf, uint32_t buflen)
| Convert the ADC conversion results to a voltage value(internal reference). More...
void | hal_adc_voltage_extern (adc_handle_t *p_adc, double vref, uint16_t *p_inbuf, double *p_outbuf, uint32_t buflen)
| Convert the ADC conversion results to a voltage value(external reference). More...
void | hal_adc_temperature_conv (adc_handle_t *p_adc, uint16_t *p_inbuf, double *p_outbuf, uint32_t buflen)
| Convert the ADC conversion results to temperature value. More...
void | hal_adc_vbat_conv (adc_handle_t *p_adc, uint16_t *p_inbuf, double *p_outbuf, uint32_t buflen)
| Convert the ADC conversion results to battery value. More...

## Detailed Description

Header file containing functions prototypes of ADC 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 hal_adc.h.