Go to the documentation of this file.
52 #ifndef __GR55xx_HAL_COMP_H__
53 #define __GR55xx_HAL_COMP_H__
167 #define HAL_COMP_ERROR_NONE ((uint32_t)0x00000000)
168 #define HAL_COMP_ERROR_TIMEOUT ((uint32_t)0x00000001)
169 #define HAL_COMP_ERROR_INVALID_PARAM ((uint32_t)0x00000002)
176 #define COMP_INPUT_SRC_IO0 LL_COMP_INPUT_SRC_IO0
177 #define COMP_INPUT_SRC_IO1 LL_COMP_INPUT_SRC_IO1
178 #define COMP_INPUT_SRC_IO2 LL_COMP_INPUT_SRC_IO2
179 #define COMP_INPUT_SRC_IO3 LL_COMP_INPUT_SRC_IO3
180 #define COMP_INPUT_SRC_IO4 LL_COMP_INPUT_SRC_IO4
181 #define COMP_INPUT_SRC_IO5 LL_COMP_INPUT_SRC_IO5
182 #define COMP_INPUT_SRC_IO6 LL_COMP_INPUT_SRC_IO6
183 #define COMP_INPUT_SRC_IO7 LL_COMP_INPUT_SRC_IO7
184 #define COMP_INPUT_SRC_VBAT LL_COMP_INPUT_SRC_VBAT
185 #define COMP_INPUT_SRC_VREF LL_COMP_INPUT_SRC_VREF
191 #define COMP_REF_SRC_IO0 LL_COMP_REF_SRC_IO0
192 #define COMP_REF_SRC_IO1 LL_COMP_REF_SRC_IO1
193 #define COMP_REF_SRC_IO2 LL_COMP_REF_SRC_IO2
194 #define COMP_REF_SRC_IO3 LL_COMP_REF_SRC_IO3
195 #define COMP_REF_SRC_IO4 LL_COMP_REF_SRC_IO4
196 #define COMP_REF_SRC_IO5 LL_COMP_REF_SRC_IO5
197 #define COMP_REF_SRC_IO6 LL_COMP_REF_SRC_IO6
198 #define COMP_REF_SRC_IO7 LL_COMP_REF_SRC_IO7
199 #define COMP_REF_SRC_VBAT LL_COMP_REF_SRC_VBAT
200 #define COMP_REF_SRC_VREF LL_COMP_REF_SRC_VREF
206 #define COMP_HYST_POSITIVE LL_COMP_HYST_POSITIVE
207 #define COMP_HYST_NEGATIVE LL_COMP_HYST_NEGATIVE
213 #define COMP_WAKEUP_EDGE_BOTH LL_COMP_WAKEUP_EDGE_BOTH
214 #define COMP_WAKEUP_EDGE_FALLING LL_COMP_WAKEUP_EDGE_FALLING
215 #define COMP_WAKEUP_EDGE_RISING LL_COMP_WAKEUP_EDGE_RISING
221 #define COMP_RES_DEGENERATION_POSITIVE LL_COMP_RES_DEGENERATION_POSITIVE
222 #define COMP_RES_DEGENERATION_NEGATIVE LL_COMP_RES_DEGENERATION_NEGATIVE
228 #define COMP_DEFAULT_CONFIG LL_COMP_DEFAULT_CONFIG
241 #define IS_COMP_INPUT(__INPUT__) (((__INPUT__) == COMP_INPUT_SRC_IO0) || \
242 ((__INPUT__) == COMP_INPUT_SRC_IO1) || \
243 ((__INPUT__) == COMP_INPUT_SRC_IO2) || \
244 ((__INPUT__) == COMP_INPUT_SRC_IO3) || \
245 ((__INPUT__) == COMP_INPUT_SRC_IO4) || \
246 ((__INPUT__) == COMP_INPUT_SRC_IO5) || \
247 ((__INPUT__) == COMP_INPUT_SRC_IO6) || \
248 ((__INPUT__) == COMP_INPUT_SRC_IO7) || \
249 ((__INPUT__) == COMP_INPUT_SRC_VBAT)|| \
250 ((__INPUT__) == COMP_INPUT_SRC_VREF))
257 #define IS_COMP_REF(__INPUT__) (((__INPUT__) == COMP_REF_SRC_IO0) || \
258 ((__INPUT__) == COMP_REF_SRC_IO1) || \
259 ((__INPUT__) == COMP_REF_SRC_IO2) || \
260 ((__INPUT__) == COMP_REF_SRC_IO3) || \
261 ((__INPUT__) == COMP_REF_SRC_IO4) || \
262 ((__INPUT__) == COMP_REF_SRC_IO5) || \
263 ((__INPUT__) == COMP_REF_SRC_IO6) || \
264 ((__INPUT__) == COMP_REF_SRC_IO7) || \
265 ((__INPUT__) == COMP_REF_SRC_VBAT) || \
266 ((__INPUT__) == COMP_REF_SRC_VREF))
273 #define IS_COMP_HYST_POS(__INPUT__) ((__INPUT__) == COMP_HYST_POSITIVE)
280 #define IS_COMP_HYST_NEG(__INPUT__) ((__INPUT__) == COMP_HYST_NEGATIVE )
287 #define IS_COMP_RES_DEGENERATION_POS(__INPUT__) ((__INPUT__) == COMP_RES_DEGENERATION_POSITIVE)
294 #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.
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(* 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.
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.
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_trigger_callback(comp_handle_t *p_comp)
comparator callback.
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.
void(* comp_trigger_callback)(comp_handle_t *p_comp)
This file contains HAL common definitions, enumeration, macros and structures definitions.
Header file containing functions prototypes of COMP LL library.
hal_status_t hal_comp_start(comp_handle_t *p_comp)
Start the comparator.
__IO hal_comp_state_t state