123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- #ifndef NRFX_LPCOMP_H__
- #define NRFX_LPCOMP_H__
- #include <nrfx.h>
- #include <hal/nrf_lpcomp.h>
- #ifdef __cplusplus
- extern "C" {
- #endif
- typedef void (* nrfx_lpcomp_event_handler_t)(nrf_lpcomp_event_t event);
- typedef struct
- {
- nrf_lpcomp_config_t hal;
- nrf_lpcomp_input_t input;
- uint8_t interrupt_priority;
- } nrfx_lpcomp_config_t;
- #ifdef NRF52_SERIES
- #define NRFX_LPCOMP_DEFAULT_CONFIG \
- { \
- .hal = { (nrf_lpcomp_ref_t)NRFX_LPCOMP_CONFIG_REFERENCE , \
- (nrf_lpcomp_detect_t)NRFX_LPCOMP_CONFIG_DETECTION, \
- (nrf_lpcomp_hysteresis_t)NRFX_LPCOMP_CONFIG_HYST }, \
- .input = (nrf_lpcomp_input_t)NRFX_LPCOMP_CONFIG_INPUT, \
- .interrupt_priority = NRFX_LPCOMP_CONFIG_IRQ_PRIORITY \
- }
- #else
- #define NRFX_LPCOMP_DEFAULT_CONFIG \
- { \
- .hal = { (nrf_lpcomp_ref_t)NRFX_LPCOMP_CONFIG_REFERENCE , \
- (nrf_lpcomp_detect_t)NRFX_LPCOMP_CONFIG_DETECTION }, \
- .input = (nrf_lpcomp_input_t)NRFX_LPCOMP_CONFIG_INPUT, \
- .interrupt_priority = NRFX_LPCOMP_CONFIG_IRQ_PRIORITY \
- }
- #endif
- nrfx_err_t nrfx_lpcomp_init(nrfx_lpcomp_config_t const * p_config,
- nrfx_lpcomp_event_handler_t event_handler);
- void nrfx_lpcomp_uninit(void);
- void nrfx_lpcomp_enable(void);
- void nrfx_lpcomp_disable(void);
- void nrfx_lpcomp_irq_handler(void);
- #ifdef __cplusplus
- }
- #endif
- #endif
|