mirror of
https://github.com/espressif/esp-idf.git
synced 2025-09-01 06:27:29 +00:00
feat(ana_cmpr): supported analog comparator on esp32p4
This commit is contained in:
@@ -11,12 +11,9 @@
|
||||
#include "hal/assert.h"
|
||||
#include "soc/gpio_ext_struct.h"
|
||||
|
||||
#define ANALOG_CMPR_LL_GET_HW() (&ANALOG_CMPR)
|
||||
#define ANALOG_CMPR_LL_GET_HW(unit) (&ANALOG_CMPR)
|
||||
#define ANALOG_CMPR_LL_EVENT_CROSS (1 << 0)
|
||||
|
||||
#define ANALOG_CMPR_LL_POS_CROSS_MASK (1 << 1)
|
||||
#define ANALOG_CMPR_LL_NEG_CROSS_MASK (1 << 2)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -84,6 +81,24 @@ static inline void analog_cmpr_ll_set_cross_type(analog_cmpr_dev_t *hw, uint8_t
|
||||
hw->pad_comp_config.zero_det_mode = type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the interrupt mask by trigger type
|
||||
* @note Only one interrupt on H2
|
||||
*
|
||||
* @param hw Analog comparator register base address
|
||||
* @param type The type of cross interrupt
|
||||
* - 0: disable interrupt
|
||||
* - 1: enable positive cross interrupt (input analog goes from low to high and across the reference voltage)
|
||||
* - 2: enable negative cross interrupt (input analog goes from high to low and across the reference voltage)
|
||||
* - 3: enable any positive or negative cross interrupt
|
||||
* @return interrupt mask
|
||||
*/
|
||||
__attribute__((always_inline))
|
||||
static inline uint32_t analog_cmpr_ll_get_intr_mask_by_type(analog_cmpr_dev_t *hw, uint8_t type)
|
||||
{
|
||||
return ANALOG_CMPR_LL_EVENT_CROSS;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the debounce cycle for the cross detection
|
||||
*
|
||||
|
Reference in New Issue
Block a user