gr55xx_hal_comp.h File Reference

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

#include "gr55xx_ll_comp.h"
#include "gr55xx_hal_def.h"

Go to the source code of this file.

Classes

struct  _comp_handle
 COMP handle Structure definition. More...
 
struct  _hal_comp_callback
 HAL COMP Callback function definition. More...
 

Macros

#define HAL_COMP_ERROR_NONE   ((uint32_t)0x00000000)
 
#define HAL_COMP_ERROR_TIMEOUT   ((uint32_t)0x00000001)
 
#define HAL_COMP_ERROR_INVALID_PARAM   ((uint32_t)0x00000002)
 
#define COMP_INPUT_SRC_IO0   LL_COMP_INPUT_SRC_IO0
 
#define COMP_INPUT_SRC_IO1   LL_COMP_INPUT_SRC_IO1
 
#define COMP_INPUT_SRC_IO2   LL_COMP_INPUT_SRC_IO2
 
#define COMP_INPUT_SRC_IO3   LL_COMP_INPUT_SRC_IO3
 
#define COMP_INPUT_SRC_IO4   LL_COMP_INPUT_SRC_IO4
 
#define COMP_INPUT_SRC_IO5   LL_COMP_INPUT_SRC_IO5
 
#define COMP_INPUT_SRC_IO6   LL_COMP_INPUT_SRC_IO6
 
#define COMP_INPUT_SRC_IO7   LL_COMP_INPUT_SRC_IO7
 
#define COMP_INPUT_SRC_VBAT   LL_COMP_INPUT_SRC_VBAT
 
#define COMP_INPUT_SRC_VREF   LL_COMP_INPUT_SRC_VREF
 
#define COMP_REF_SRC_IO0   LL_COMP_REF_SRC_IO0
 
#define COMP_REF_SRC_IO1   LL_COMP_REF_SRC_IO1
 
#define COMP_REF_SRC_IO2   LL_COMP_REF_SRC_IO2
 
#define COMP_REF_SRC_IO3   LL_COMP_REF_SRC_IO3
 
#define COMP_REF_SRC_IO4   LL_COMP_REF_SRC_IO4
 
#define COMP_REF_SRC_IO5   LL_COMP_REF_SRC_IO5
 
#define COMP_REF_SRC_IO6   LL_COMP_REF_SRC_IO6
 
#define COMP_REF_SRC_IO7   LL_COMP_REF_SRC_IO7
 
#define COMP_REF_SRC_VBAT   LL_COMP_REF_SRC_VBAT
 
#define COMP_REF_SRC_VREF   LL_COMP_REF_SRC_VREF
 
#define COMP_HYST_POSITIVE   LL_COMP_HYST_POSITIVE
 
#define COMP_HYST_NEGATIVE   LL_COMP_HYST_NEGATIVE
 
#define COMP_WAKEUP_EDGE_BOTH   LL_COMP_WAKEUP_EDGE_BOTH
 
#define COMP_WAKEUP_EDGE_FALLING   LL_COMP_WAKEUP_EDGE_FALLING
 
#define COMP_WAKEUP_EDGE_RISING   LL_COMP_WAKEUP_EDGE_RISING
 
#define COMP_RES_DEGENERATION_POSITIVE   LL_COMP_RES_DEGENERATION_POSITIVE
 
#define COMP_RES_DEGENERATION_NEGATIVE   LL_COMP_RES_DEGENERATION_NEGATIVE
 
#define COMP_DEFAULT_CONFIG   LL_COMP_DEFAULT_CONFIG
 Default configuartion for initializing structure. More...
 
#define IS_COMP_INPUT(__INPUT__)
 Check if COMP input source is valid. More...
 
#define IS_COMP_REF(__INPUT__)
 Check if COMP reference source is valid. More...
 
#define IS_COMP_HYST_POS(__INPUT__)   ((__INPUT__) == COMP_HYST_POSITIVE)
 Check if COMP reference source is valid. More...
 
#define IS_COMP_HYST_NEG(__INPUT__)   ((__INPUT__) == COMP_HYST_NEGATIVE )
 Check if COMP reference source is invalid. More...
 
#define IS_COMP_RES_DEGENERATION_POS(__INPUT__)   ((__INPUT__) == COMP_RES_DEGENERATION_POSITIVE)
 Check if COMP reference source is valid. More...
 
#define IS_COMP_RES_DEGENERATION_NEG(__INPUT__)   ((__INPUT__) == COMP_RES_DEGENERATION_NEGATIVE )
 Check if COMP reference source is invalid. More...
 

Typedefs

typedef ll_comp_init_t comp_init_t
 COMP init structure definition. More...
 
typedef struct _comp_handle comp_handle_t
 COMP handle Structure definition. More...
 
typedef struct _hal_comp_callback hal_comp_callback_t
 HAL COMP Callback function definition. More...
 

Enumerations

enum  hal_comp_state_t {
  HAL_COMP_STATE_RESET = 0x00,
  HAL_COMP_STATE_READY = 0x01,
  HAL_COMP_STATE_BUSY = 0x02,
  HAL_COMP_STATE_ERROR = 0x04
}
 HAL COMP State Enumerations definition. More...
 

Functions

hal_status_t hal_comp_init (comp_handle_t *p_comp)
 Initialize the COMP according to the specified parameters in the comp_init_t and initialize the associated handle. More...
 
hal_status_t hal_comp_deinit (comp_handle_t *p_comp)
 De-initialize the COMP peripheral. More...
 
void hal_comp_msp_init (comp_handle_t *p_comp)
 Initialize the COMP MSP. More...
 
void hal_comp_msp_deinit (comp_handle_t *p_comp)
 De-initialize the COMP MSP. More...
 
hal_status_t hal_comp_start (comp_handle_t *p_comp)
 Start the comparator. More...
 
hal_status_t hal_comp_stop (comp_handle_t *p_comp)
 Stop the comparator. More...
 
void hal_comp_irq_handler (comp_handle_t *p_comp)
 Handle COMP interrupt request. More...
 
void hal_comp_trigger_callback (comp_handle_t *p_comp)
 comparator callback. More...
 
hal_comp_state_t hal_comp_get_state (comp_handle_t *p_comp)
 Return the COMP handle state. More...
 
uint32_t hal_comp_get_error (comp_handle_t *p_comp)
 Return the COMP error code. More...
 
hal_status_t hal_comp_suspend_reg (comp_handle_t *p_comp)
 Suspend some registers related to COMP configuration before sleep. More...
 
hal_status_t hal_comp_resume_reg (comp_handle_t *p_comp)
 Restore some registers related to COMP configuration after sleep. This function must be used in conjunction with the hal_comp_suspend_reg(). More...
 

Detailed Description

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