Go to the documentation of this file.
52 #ifndef __GR533x_HAL_COMP_H__
53 #define __GR533x_HAL_COMP_H__
162 #define HAL_COMP_ERROR_NONE ((uint32_t)0x00000000)
163 #define HAL_COMP_ERROR_TIMEOUT ((uint32_t)0x00000001)
164 #define HAL_COMP_ERROR_INVALID_PARAM ((uint32_t)0x00000002)
171 #define COMP_INPUT_SRC_IO0 LL_COMP_INPUT_SRC_IO0
172 #define COMP_INPUT_SRC_IO1 LL_COMP_INPUT_SRC_IO1
173 #define COMP_INPUT_SRC_IO2 LL_COMP_INPUT_SRC_IO2
174 #define COMP_INPUT_SRC_IO3 LL_COMP_INPUT_SRC_IO3
175 #define COMP_INPUT_SRC_IO4 LL_COMP_INPUT_SRC_IO4
176 #define COMP_INPUT_SRC_IO5 LL_COMP_INPUT_SRC_IO5
177 #define COMP_INPUT_SRC_IO6 LL_COMP_INPUT_SRC_IO6
178 #define COMP_INPUT_SRC_IO7 LL_COMP_INPUT_SRC_IO7
179 #define COMP_INPUT_SRC_VBAT LL_COMP_INPUT_SRC_VBAT
180 #define COMP_INPUT_SRC_VREF LL_COMP_INPUT_SRC_VREF
186 #define COMP_REF_SRC_IO0 LL_COMP_REF_SRC_IO0
187 #define COMP_REF_SRC_IO1 LL_COMP_REF_SRC_IO1
188 #define COMP_REF_SRC_IO2 LL_COMP_REF_SRC_IO2
189 #define COMP_REF_SRC_IO3 LL_COMP_REF_SRC_IO3
190 #define COMP_REF_SRC_IO4 LL_COMP_REF_SRC_IO4
191 #define COMP_REF_SRC_IO5 LL_COMP_REF_SRC_IO5
192 #define COMP_REF_SRC_IO6 LL_COMP_REF_SRC_IO6
193 #define COMP_REF_SRC_IO7 LL_COMP_REF_SRC_IO7
194 #define COMP_REF_SRC_VBAT LL_COMP_REF_SRC_VBAT
195 #define COMP_REF_SRC_VREF LL_COMP_REF_SRC_VREF
201 #define COMP_HYST_POSITIVE LL_COMP_HYST_POSITIVE
202 #define COMP_HYST_NEGATIVE LL_COMP_HYST_NEGATIVE
208 #define COMP_WAKEUP_EDGE_BOTH LL_COMP_WAKEUP_EDGE_BOTH
209 #define COMP_WAKEUP_EDGE_FALLING LL_COMP_WAKEUP_EDGE_FALLING
210 #define COMP_WAKEUP_EDGE_RISING LL_COMP_WAKEUP_EDGE_RISING
216 #define COMP_RES_DEGENERATION_POSITIVE LL_COMP_RES_DEGENERATION_POSITIVE
217 #define COMP_RES_DEGENERATION_NEGATIVE LL_COMP_RES_DEGENERATION_NEGATIVE
223 #define COMP_DEFAULT_CONFIG LL_COMP_DEFAULT_CONFIG
236 #define IS_COMP_INPUT(__INPUT__) (((__INPUT__) == COMP_INPUT_SRC_IO0) || \
237 ((__INPUT__) == COMP_INPUT_SRC_IO1) || \
238 ((__INPUT__) == COMP_INPUT_SRC_IO2) || \
239 ((__INPUT__) == COMP_INPUT_SRC_IO3) || \
240 ((__INPUT__) == COMP_INPUT_SRC_IO4) || \
241 ((__INPUT__) == COMP_INPUT_SRC_IO5) || \
242 ((__INPUT__) == COMP_INPUT_SRC_IO6) || \
243 ((__INPUT__) == COMP_INPUT_SRC_IO7) || \
244 ((__INPUT__) == COMP_INPUT_SRC_VBAT)|| \
245 ((__INPUT__) == COMP_INPUT_SRC_VREF))
252 #define IS_COMP_REF(__INPUT__) (((__INPUT__) == COMP_REF_SRC_IO0) || \
253 ((__INPUT__) == COMP_REF_SRC_IO1) || \
254 ((__INPUT__) == COMP_REF_SRC_IO2) || \
255 ((__INPUT__) == COMP_REF_SRC_IO3) || \
256 ((__INPUT__) == COMP_REF_SRC_IO4) || \
257 ((__INPUT__) == COMP_REF_SRC_IO5) || \
258 ((__INPUT__) == COMP_REF_SRC_IO6) || \
259 ((__INPUT__) == COMP_REF_SRC_IO7) || \
260 ((__INPUT__) == COMP_REF_SRC_VBAT) || \
261 ((__INPUT__) == COMP_REF_SRC_VREF))
268 #define IS_COMP_HYST_POS(__INPUT__) ((__INPUT__) == COMP_HYST_POSITIVE)
275 #define IS_COMP_HYST_NEG(__INPUT__) ((__INPUT__) == COMP_HYST_NEGATIVE )
282 #define IS_COMP_RES_DEGENERATION_POS(__INPUT__) ((__INPUT__) == COMP_RES_DEGENERATION_POSITIVE)
289 #define IS_COMP_RES_DEGENERATION_NEG(__INPUT__) ((__INPUT__) == COMP_RES_DEGENERATION_NEGATIVE )
void hal_comp_irq_handler(comp_handle_t *p_comp)
Handle COMP interrupt request.
hal_lock_t
HAL Lock structures definition.
void hal_comp_rising_trigger_callback(comp_handle_t *p_comp)
comparator rising callback.
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 assoc...
HAL COMP Callback function definition.
uint32_t hal_comp_get_error(comp_handle_t *p_comp)
Return the COMP error code.
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 conju...
hal_comp_state_t
HAL COMP State Enumerations definition.
void hal_comp_falling_trigger_callback(comp_handle_t *p_comp)
comparator rising callback.
void(* comp_msp_deinit)(comp_handle_t *p_comp)
hal_comp_state_t hal_comp_get_state(comp_handle_t *p_comp)
Return the COMP handle state.
COMP handle Structure definition.
void(* comp_falling_trigger_callback)(comp_handle_t *p_comp)
ll_comp_init_t comp_init_t
COMP init structure definition.
struct _comp_handle comp_handle_t
COMP handle Structure definition.
struct _hal_comp_callback hal_comp_callback_t
HAL COMP Callback function definition.
hal_status_t hal_comp_stop(comp_handle_t *p_comp)
Stop the comparator.
void(* comp_rising_trigger_callback)(comp_handle_t *p_comp)
hal_status_t
HAL Status structures definition.
void hal_comp_msp_init(comp_handle_t *p_comp)
Initialize the COMP MSP.
hal_status_t hal_comp_suspend_reg(comp_handle_t *p_comp)
Suspend some registers related to COMP configuration before sleep.
void hal_comp_msp_deinit(comp_handle_t *p_comp)
De-initialize the COMP MSP.
void(* comp_msp_init)(comp_handle_t *p_comp)
hal_status_t hal_comp_deinit(comp_handle_t *p_comp)
De-initialize the COMP peripheral.
Header file containing functions prototypes of COMP LL library.
This file contains HAL common definitions, enumeration, macros and structures definitions.
hal_status_t hal_comp_start(comp_handle_t *p_comp)
Start the comparator.
__IO hal_comp_state_t state