gr533x_hal_comp.h
Go to the documentation of this file.
1 /**
2 ****************************************************************************************
3 *
4 * @file gr533x_hal_comp.h
5 * @author BLE Driver Team
6 * @brief Header file containing functions prototypes of COMP HAL library.
7 *
8 ****************************************************************************************
9 * @attention
10 #####Copyright (c) 2019 GOODIX
11 All rights reserved.
12
13 Redistribution and use in source and binary forms, with or without
14 modification, are permitted provided that the following conditions are met:
15 * Redistributions of source code must retain the above copyright
16 notice, this list of conditions and the following disclaimer.
17 * Redistributions in binary form must reproduce the above copyright
18 notice, this list of conditions and the following disclaimer in the
19 documentation and/or other materials provided with the distribution.
20 * Neither the name of GOODIX nor the names of its contributors may be used
21 to endorse or promote products derived from this software without
22 specific prior written permission.
23
24 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
28 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 POSSIBILITY OF SUCH DAMAGE.
35 ****************************************************************************************
36 */
37
38 /** @addtogroup PERIPHERAL Peripheral Driver
39 * @{
40 */
41
42 /** @addtogroup HAL_DRIVER HAL Driver
43 * @{
44 */
45
46 /** @defgroup HAL_COMP COMP
47 * @brief COMP HAL module driver.
48 * @{
49 */
50
51 /* Define to prevent recursive inclusion -------------------------------------*/
52 #ifndef __GR533x_HAL_COMP_H__
53 #define __GR533x_HAL_COMP_H__
54
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58
59 /* Includes ------------------------------------------------------------------*/
60 #include "gr533x_ll_comp.h"
61 #include "gr533x_hal_def.h"
62
63 /* Exported types ------------------------------------------------------------*/
64 /** @addtogroup HAL_COMP_ENUMERATIONS Enumerations
65 * @{
66 */
67
68 /** @defgroup HAL_COMP_state HAL COMP state
69 * @{
70 */
71
72 /**
73 * @brief HAL COMP State Enumerations definition
74 */
75 typedef enum
76 {
77 HAL_COMP_STATE_RESET = 0x00, /**< Peripheral not initialized */
78 HAL_COMP_STATE_READY = 0x01, /**< Peripheral initialized and ready for use */
79 HAL_COMP_STATE_BUSY = 0x02, /**< An internal process is ongoing */
80 HAL_COMP_STATE_ERROR = 0x04 /**< Peripheral in error */
81 } hal_comp_state_t;
82
83 /** @} */
84
85 /** @} */
86
87 /** @addtogroup HAL_COMP_STRUCTURES Structures
88 * @{
89 */
90
91 /** @defgroup COMP_Configuration COMP Configuration
92 * @{
93 */
94
95 /**
96 * @brief COMP init structure definition
97 */
98 typedef ll_comp_init_t comp_init_t;
99 /** @} */
100
101 /** @defgroup COMP_handle COMP handle
102 * @{
103 */
104
105 /**
106 * @brief COMP handle Structure definition
107 */
108 typedef struct _comp_handle
109 {
110 comp_init_t init; /**< COMP configuration parameters */
111
112 __IO hal_lock_t lock; /**< Locking object */
113
114 __IO hal_comp_state_t state; /**< COMP communication state */
115
116 __IO uint32_t error_code; /**< COMP error code */
117
118 uint32_t retention[1]; /**< COMP important register information. */
119
120 } comp_handle_t;
121 /** @} */
122
123 /** @} */
124
125 /** @addtogroup HAL_COMP_CALLBACK_STRUCTURES Callback Structures
126 * @{
127 */
128
129 /** @defgroup COMP_Callback COMP Callback
130 * @{
131 */
132
133 /**
134 * @brief HAL COMP Callback function definition
135 */
136 typedef struct _hal_comp_callback
137 {
138 void (*comp_msp_init)(comp_handle_t *p_comp); /**< COMP init MSP callback */
139 void (*comp_msp_deinit)(comp_handle_t *p_comp); /**< COMP de-init MSP callback */
140 void (*comp_rising_trigger_callback)(comp_handle_t *p_comp); /**< COMP rising trigger callback */
141 void (*comp_falling_trigger_callback)(comp_handle_t *p_comp); /**< COMP falling trigger callback */
142 } hal_comp_callback_t;
143
144 /** @} */
145
146 /** @} */
147
148
149 /**
150 * @defgroup HAL_COMP_MACRO Defines
151 * @{
152 */
153
154 /* Exported constants --------------------------------------------------------*/
155 /** @defgroup COMP_Exported_Constants COMP Exported Constants
156 * @{
157 */
158
159 /** @defgroup COMP_Error_Code COMP Error Code
160 * @{
161 */
162 #define HAL_COMP_ERROR_NONE ((uint32_t)0x00000000) /**< No error */
163 #define HAL_COMP_ERROR_TIMEOUT ((uint32_t)0x00000001) /**< Timeout error */
164 #define HAL_COMP_ERROR_INVALID_PARAM ((uint32_t)0x00000002) /**< Invalid parameters error */
165 /** @} */
166
167
168 /** @defgroup COMP_INPUT_SOURCE COMP Input Channel Select
169 * @{
170 */
171 #define COMP_INPUT_SRC_IO0 LL_COMP_INPUT_SRC_IO0 /**< Set MSIO_0 as inputs for the comparator */
172 #define COMP_INPUT_SRC_IO1 LL_COMP_INPUT_SRC_IO1 /**< Set MSIO_1 as inputs for the comparator */
173 #define COMP_INPUT_SRC_IO2 LL_COMP_INPUT_SRC_IO2 /**< Set MSIO_2 as inputs for the comparator */
174 #define COMP_INPUT_SRC_IO3 LL_COMP_INPUT_SRC_IO3 /**< Set MSIO_3 as inputs for the comparator */
175 #define COMP_INPUT_SRC_IO4 LL_COMP_INPUT_SRC_IO4 /**< Set MSIO_4 as inputs for the comparator */
176 #define COMP_INPUT_SRC_IO5 LL_COMP_INPUT_SRC_IO5 /**< Set MSIO_5 as inputs for the comparator */
177 #define COMP_INPUT_SRC_IO6 LL_COMP_INPUT_SRC_IO6 /**< Set MSIO_6 as inputs for the comparator */
178 #define COMP_INPUT_SRC_IO7 LL_COMP_INPUT_SRC_IO7 /**< Set MSIO_7 as inputs for the comparator */
179 #define COMP_INPUT_SRC_VBAT LL_COMP_INPUT_SRC_VBAT /**< Set VBATT as inputs for the comparator */
180 #define COMP_INPUT_SRC_VREF LL_COMP_INPUT_SRC_VREF /**< Set VREF as inputs for the comparator */
181 /** @} */
182
183 /** @defgroup COMP_REFERENCE_SOURCE COMP Reference Source Select
184 * @{
185 */
186 #define COMP_REF_SRC_IO0 LL_COMP_REF_SRC_IO0 /**< Set MSIO_0 as references for the comparator */
187 #define COMP_REF_SRC_IO1 LL_COMP_REF_SRC_IO1 /**< Set MSIO_1 as references for the comparator */
188 #define COMP_REF_SRC_IO2 LL_COMP_REF_SRC_IO2 /**< Set MSIO_2 as references for the comparator */
189 #define COMP_REF_SRC_IO3 LL_COMP_REF_SRC_IO3 /**< Set MSIO_3 as references for the comparator */
190 #define COMP_REF_SRC_IO4 LL_COMP_REF_SRC_IO4 /**< Set MSIO_4 as references for the comparator */
191 #define COMP_REF_SRC_IO5 LL_COMP_REF_SRC_IO5 /**< Set MSIO_5 as references for the comparator */
192 #define COMP_REF_SRC_IO6 LL_COMP_REF_SRC_IO6 /**< Set MSIO_6 as references for the comparator */
193 #define COMP_REF_SRC_IO7 LL_COMP_REF_SRC_IO7 /**< Set MSIO_7 as references for the comparator */
194 #define COMP_REF_SRC_VBAT LL_COMP_REF_SRC_VBAT /**< Set VBATT as references for the comparator */
195 #define COMP_REF_SRC_VREF LL_COMP_REF_SRC_VREF /**< Set VREF as references for the comparator */
196 /** @} */
197
198 /** @defgroup COMP_HYSTERESIS COMP Hysteresis Select
199 * @{
200 */
201 #define COMP_HYST_POSITIVE LL_COMP_HYST_POSITIVE /**< Set positive side of hysteresis for the comparator */
202 #define COMP_HYST_NEGATIVE LL_COMP_HYST_NEGATIVE /**< Set negative side of hysteresis for the comparator */
203 /** @} */
204
205 /** @defgroup COMP_WAKEUP_EDGE Select
206 * @{
207 */
208 #define COMP_WAKEUP_EDGE_BOTH LL_COMP_WAKEUP_EDGE_BOTH /**< Select both rising and falling edges for the comparator */
209 #define COMP_WAKEUP_EDGE_FALLING LL_COMP_WAKEUP_EDGE_FALLING /**< Select only falling edges for the comparator */
210 #define COMP_WAKEUP_EDGE_RISING LL_COMP_WAKEUP_EDGE_RISING /**< Select only rising edges for the comparator */
211 /** @} */
212
213 /** @defgroup COMP_RES_DEGENERATION COMP Reset Degeneration Select
214 * @{
215 */
216 #define COMP_RES_DEGENERATION_POSITIVE LL_COMP_RES_DEGENERATION_POSITIVE /**< Set positive side of calibration for the comparator */
217 #define COMP_RES_DEGENERATION_NEGATIVE LL_COMP_RES_DEGENERATION_NEGATIVE /**< Set negative side of calibration for the comparator */
218 /** @} */
219
220 /**
221 * @brief Default configuartion for initializing structure
222 */
223 #define COMP_DEFAULT_CONFIG LL_COMP_DEFAULT_CONFIG
224 /** @} */
225
226 /* Private macros ------------------------------------------------------------*/
227 /** @addtogroup COMP_Private_Macros COMP Private Macros
228 * @{
229 */
230
231 /**
232 * @brief Check if COMP input source is valid.
233 * @param __INPUT__ COMP input source.
234 * @retval SET (__INPUT__ is valid) or RESET (__INPUT__ is invalid)
235 */
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))
246 /**
247 * @brief Check if COMP reference source is valid.
248 * @param __INPUT__ COMP reference source.
249 * @retval SET (__INPUT__ is valid) or RESET (__INPUT__ is invalid)
250 */
251
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))
262
263 /**
264 * @brief Check if COMP reference source is valid.
265 * @param __INPUT__ COMP hysteresis.
266 * @retval SET (__INPUT__ is valid) or RESET (__INPUT__ is invalid)
267 */
268 #define IS_COMP_HYST_POS(__INPUT__) ((__INPUT__) == COMP_HYST_POSITIVE)
269
270
271 /**
272 * @brief Check if COMP reference source is invalid.
273 * @param __INPUT__ COMP hysteresis.
274 */
275 #define IS_COMP_HYST_NEG(__INPUT__) ((__INPUT__) == COMP_HYST_NEGATIVE )
276
277 /**
278 * @brief Check if COMP reference source is valid.
279 * @param __INPUT__ COMP res degeneration.
280 * @retval SET (__INPUT__ is valid) or RESET (__INPUT__ is invalid)
281 */
282 #define IS_COMP_RES_DEGENERATION_POS(__INPUT__) ((__INPUT__) == COMP_RES_DEGENERATION_POSITIVE)
283
284
285 /**
286 * @brief Check if COMP reference source is invalid.
287 * @param __INPUT__ COMP res degeneration.
288 */
289 #define IS_COMP_RES_DEGENERATION_NEG(__INPUT__) ((__INPUT__) == COMP_RES_DEGENERATION_NEGATIVE )
290 /** @} */
291
292 /** @} */
293
294 /* Exported functions --------------------------------------------------------*/
295 /** @addtogroup HAL_COMP_DRIVER_FUNCTIONS Functions
296 * @{
297 */
298
299 /** @addtogroup COMP_Exported_Functions_Group1 Initialization and de-initialization functions
300 * @brief Initialization and Configuration functions
301 * @{
302 */
303
304 /**
305 ****************************************************************************************
306 * @brief Initialize the COMP according to the specified parameters
307 * in the comp_init_t and initialize the associated handle.
308 *
309 * @param[in] p_comp: Pointer to a COMP handle which contains the configuration information for
310 * the specified COMP module.
311 *
312 * @retval ::HAL_OK: Operation is OK.
313 * @retval ::HAL_ERROR: Parameter error or operation not supported.
314 * @retval ::HAL_BUSY: Driver is busy.
315 * @retval ::HAL_TIMEOUT: Timeout occurred.
316 ****************************************************************************************
317 */
318 hal_status_t hal_comp_init(comp_handle_t *p_comp);
319
320 /**
321 ****************************************************************************************
322 * @brief De-initialize the COMP peripheral.
323 *
324 * @param[in] p_comp: Pointer to a COMP handle which contains the configuration information for
325 * the specified COMP module.
326 *
327 * @retval ::HAL_OK: Operation is OK.
328 * @retval ::HAL_ERROR: Parameter error or operation not supported.
329 * @retval ::HAL_BUSY: Driver is busy.
330 * @retval ::HAL_TIMEOUT: Timeout occurred.
331 ****************************************************************************************
332 */
333 hal_status_t hal_comp_deinit(comp_handle_t *p_comp);
334
335 /**
336 ****************************************************************************************
337 * @brief Initialize the COMP MSP.
338 *
339 * @note This function should not be modified. When the callback is needed,
340 * the hal_comp_msp_deinit can be implemented in the user file.
341 *
342 * @param[in] p_comp: Pointer to a COMP handle which contains the configuration information for
343 * the specified COMP module.
344 ****************************************************************************************
345 */
346 void hal_comp_msp_init(comp_handle_t *p_comp);
347
348 /**
349 ****************************************************************************************
350 * @brief De-initialize the COMP MSP.
351 *
352 * @note This function should not be modified. When the callback is needed,
353 * the hal_comp_msp_deinit can be implemented in the user file.
354 *
355 * @param[in] p_comp: Pointer to a COMP handle which contains the configuration information for
356 * the specified COMP module.
357 ****************************************************************************************
358 */
359 void hal_comp_msp_deinit(comp_handle_t *p_comp);
360
361 /** @} */
362
363 /** @addtogroup COMP_Exported_Functions_Group2 IO operation functions
364 * @brief COMP polling and DMA conversion management functions.
365 * @{
366 */
367
368 /**
369 ****************************************************************************************
370 * @brief Start the comparator.
371 *
372 * @param[in] p_comp: Pointer to a COMP handle which contains the configuration information for
373 * the specified COMP module.
374 *
375 * @retval ::HAL_OK: Operation is OK.
376 * @retval ::HAL_ERROR: Parameter error or operation not supported.
377 * @retval ::HAL_BUSY: Driver is busy.
378 * @retval ::HAL_TIMEOUT: Timeout occurred.
379 ****************************************************************************************
380 */
381 hal_status_t hal_comp_start(comp_handle_t *p_comp);
382
383 /**
384 ****************************************************************************************
385 * @brief Stop the comparator.
386 *
387 * @param[in] p_comp: Pointer to a COMP handle which contains the configuration information for
388 * the specified COMP module.
389 *
390 * @retval ::HAL_OK: Operation is OK.
391 * @retval ::HAL_ERROR: Parameter error or operation not supported.
392 * @retval ::HAL_BUSY: Driver is busy.
393 * @retval ::HAL_TIMEOUT: Timeout occurred.
394 ****************************************************************************************
395 */
396 hal_status_t hal_comp_stop(comp_handle_t *p_comp);
397
398 /** @} */
399
400 /** @addtogroup COMP_IRQ_Handler_and_Callbacks IRQ Handler and Callbacks
401 * @brief IRQ Handler and Callbacks functions
402 * @{
403 */
404
405 /**
406 ****************************************************************************************
407 * @brief Handle COMP interrupt request.
408 * @param[in] p_comp: Pointer to a COMP handle which contains the configuration information
409 * for the specified COMP module.
410 ****************************************************************************************
411 */
412 void hal_comp_irq_handler(comp_handle_t *p_comp);
413
414 /**
415 ****************************************************************************************
416 * @brief comparator rising callback.
417 *
418 * @note This function should not be modified. When the callback is needed,
419 * the hal_comp_rising_trigger_callback can be implemented in the user file.
420 *
421 * @param[in] p_comp: Pointer to a COMP handle which contains the configuration information for
422 * the specified COMP module.
423 ****************************************************************************************
424 */
425 void hal_comp_rising_trigger_callback(comp_handle_t *p_comp);
426
427 /**
428 ****************************************************************************************
429 * @brief comparator rising callback.
430 *
431 * @note This function should not be modified. When the callback is needed,
432 * the hal_comp_falling_trigger_callback can be implemented in the user file.
433 *
434 * @param[in] p_comp: Pointer to a COMP handle which contains the configuration information for
435 * the specified COMP module.
436 ****************************************************************************************
437 */
438 void hal_comp_falling_trigger_callback(comp_handle_t *p_comp);
439
440 /** @} */
441
442 /** @defgroup COMP_Exported_Functions_Group3 Peripheral State and Errors functions
443 * @brief COMP control functions
444 *
445 @verbatim
446 ===============================================================================
447 ##### Peripheral State and Errors functions #####
448 ===============================================================================
449 [..]
450 This subsection provides a set of functions allowing to control the COMP.
451 (+) hal_comp_get_state() API can be helpful to check in run-time the state of the COMP peripheral.
452 (+) hal_comp_get_error() check in run-time Errors occurring during communication.
453 @endverbatim
454 * @{
455 */
456
457 /**
458 ****************************************************************************************
459 * @brief Return the COMP handle state.
460 *
461 * @param[in] p_comp: Pointer to a COMP handle which contains the configuration information for
462 * the specified COMP module.
463 *
464 * @retval ::HAL_COMP_STATE_RESET: Peripheral not initialized.
465 * @retval ::HAL_COMP_STATE_READY: Peripheral initialized and ready for use.
466 * @retval ::HAL_COMP_STATE_BUSY: An internal process is ongoing.
467 * @retval ::HAL_COMP_STATE_ERROR: Peripheral in error.
468 ****************************************************************************************
469 */
470 hal_comp_state_t hal_comp_get_state(comp_handle_t *p_comp);
471
472 /**
473 ****************************************************************************************
474 * @brief Return the COMP error code.
475 *
476 * @param[in] p_comp: Pointer to a COMP handle which contains the configuration information for
477 * the specified COMP module.
478 *
479 * @return COMP error code in bitmap format
480 ****************************************************************************************
481 */
482 uint32_t hal_comp_get_error(comp_handle_t *p_comp);
483
484 /**
485 ****************************************************************************************
486 * @brief Suspend some registers related to COMP configuration before sleep.
487 * @param[in] p_comp: Pointer to a COMP handle which contains the configuration
488 * information for the specified COMP module.
489 * @retval ::HAL_OK: Operation is OK.
490 * @retval ::HAL_ERROR: Parameter error or operation not supported.
491 * @retval ::HAL_BUSY: Driver is busy.
492 * @retval ::HAL_TIMEOUT: Timeout occurred.
493 ****************************************************************************************
494 */
495 hal_status_t hal_comp_suspend_reg(comp_handle_t *p_comp);
496
497 /**
498 ****************************************************************************************
499 * @brief Restore some registers related to COMP configuration after sleep.
500 * This function must be used in conjunction with the hal_comp_suspend_reg().
501 * @param[in] p_comp: Pointer to a COMP handle which contains the configuration
502 * information for the specified COMP module.
503 * @retval ::HAL_OK: Operation is OK.
504 * @retval ::HAL_ERROR: Parameter error or operation not supported.
505 * @retval ::HAL_BUSY: Driver is busy.
506 * @retval ::HAL_TIMEOUT: Timeout occurred.
507 ****************************************************************************************
508 */
509 hal_status_t hal_comp_resume_reg(comp_handle_t *p_comp);
510
511 /** @} */
512
513 /** @} */
514
515
516
517 #ifdef __cplusplus
518 }
519 #endif
520
521 #endif /* __GR533x_HAL_COMP_H__ */
522
523 /** @} */
524
525 /** @} */
526
527 /** @} */
hal_comp_irq_handler
void hal_comp_irq_handler(comp_handle_t *p_comp)
Handle COMP interrupt request.
HAL_COMP_STATE_ERROR
@ HAL_COMP_STATE_ERROR
Definition: gr533x_hal_comp.h:80
_comp_handle::retention
uint32_t retention[1]
Definition: gr533x_hal_comp.h:118
hal_lock_t
hal_lock_t
HAL Lock structures definition.
Definition: gr533x_hal_def.h:81
hal_comp_rising_trigger_callback
void hal_comp_rising_trigger_callback(comp_handle_t *p_comp)
comparator rising callback.
hal_comp_init
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
HAL COMP Callback function definition.
Definition: gr533x_hal_comp.h:137
hal_comp_get_error
uint32_t hal_comp_get_error(comp_handle_t *p_comp)
Return the COMP error code.
hal_comp_resume_reg
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_t
HAL COMP State Enumerations definition.
Definition: gr533x_hal_comp.h:76
hal_comp_falling_trigger_callback
void hal_comp_falling_trigger_callback(comp_handle_t *p_comp)
comparator rising callback.
_comp_handle::error_code
__IO uint32_t error_code
Definition: gr533x_hal_comp.h:116
_hal_comp_callback::comp_msp_deinit
void(* comp_msp_deinit)(comp_handle_t *p_comp)
Definition: gr533x_hal_comp.h:139
hal_comp_get_state
hal_comp_state_t hal_comp_get_state(comp_handle_t *p_comp)
Return the COMP handle state.
_comp_handle
COMP handle Structure definition.
Definition: gr533x_hal_comp.h:109
_hal_comp_callback::comp_falling_trigger_callback
void(* comp_falling_trigger_callback)(comp_handle_t *p_comp)
Definition: gr533x_hal_comp.h:141
comp_init_t
ll_comp_init_t comp_init_t
COMP init structure definition.
Definition: gr533x_hal_comp.h:98
comp_handle_t
struct _comp_handle comp_handle_t
COMP handle Structure definition.
HAL_COMP_STATE_RESET
@ HAL_COMP_STATE_RESET
Definition: gr533x_hal_comp.h:77
hal_comp_callback_t
struct _hal_comp_callback hal_comp_callback_t
HAL COMP Callback function definition.
hal_comp_stop
hal_status_t hal_comp_stop(comp_handle_t *p_comp)
Stop the comparator.
HAL_COMP_STATE_READY
@ HAL_COMP_STATE_READY
Definition: gr533x_hal_comp.h:78
_hal_comp_callback::comp_rising_trigger_callback
void(* comp_rising_trigger_callback)(comp_handle_t *p_comp)
Definition: gr533x_hal_comp.h:140
_comp_handle::init
comp_init_t init
Definition: gr533x_hal_comp.h:110
hal_status_t
hal_status_t
HAL Status structures definition.
Definition: gr533x_hal_def.h:70
hal_comp_msp_init
void hal_comp_msp_init(comp_handle_t *p_comp)
Initialize the COMP MSP.
hal_comp_suspend_reg
hal_status_t hal_comp_suspend_reg(comp_handle_t *p_comp)
Suspend some registers related to COMP configuration before sleep.
hal_comp_msp_deinit
void hal_comp_msp_deinit(comp_handle_t *p_comp)
De-initialize the COMP MSP.
_hal_comp_callback::comp_msp_init
void(* comp_msp_init)(comp_handle_t *p_comp)
Definition: gr533x_hal_comp.h:138
hal_comp_deinit
hal_status_t hal_comp_deinit(comp_handle_t *p_comp)
De-initialize the COMP peripheral.
HAL_COMP_STATE_BUSY
@ HAL_COMP_STATE_BUSY
Definition: gr533x_hal_comp.h:79
gr533x_ll_comp.h
Header file containing functions prototypes of COMP LL library.
gr533x_hal_def.h
This file contains HAL common definitions, enumeration, macros and structures definitions.
_comp_handle::lock
__IO hal_lock_t lock
Definition: gr533x_hal_comp.h:112
hal_comp_start
hal_status_t hal_comp_start(comp_handle_t *p_comp)
Start the comparator.
_comp_handle::state
__IO hal_comp_state_t state
Definition: gr533x_hal_comp.h:114