feat(ana_cmpr): support analog comparator on esp32h21

This commit is contained in:
morris
2026-03-23 10:28:29 +08:00
parent ed7c90c8aa
commit 9cad94e697
39 changed files with 211 additions and 178 deletions
@@ -7,7 +7,7 @@
#include "hal/ana_cmpr_periph.h"
#include "soc/ana_cmpr_struct.h"
const ana_cmpr_periph_t ana_cmpr_periph[SOC_ANA_CMPR_NUM] = {
const ana_cmpr_periph_t ana_cmpr_periph[1] = {
[0] = {
.src_gpio = ANA_CMPR0_SRC_GPIO,
.ext_ref_gpio = ANA_CMPR0_EXT_REF_GPIO,
@@ -16,7 +16,7 @@ const ana_cmpr_periph_t ana_cmpr_periph[SOC_ANA_CMPR_NUM] = {
},
};
analog_cmpr_dev_t ANALOG_CMPR[SOC_ANA_CMPR_NUM] = {
analog_cmpr_dev_t ANALOG_CMPR[1] = {
[0] = {
.pad_comp_config = &GPIO_EXT.pad_comp_config,
.pad_comp_filter = &GPIO_EXT.pad_comp_filter,
@@ -12,6 +12,12 @@
#include "hal/ana_cmpr_types.h"
#include "soc/ana_cmpr_struct.h"
#define ANALOG_CMPR_LL_GET(_attr) ANALOG_CMPR_LL_ ## _attr
#define ANALOG_CMPR_LL_SUPPORT(_feat) ANALOG_CMPR_LL_SUPPORT_ ## _feat
// Number of Analog Comparator instances
#define ANALOG_CMPR_LL_INST_NUM 1
#define ANALOG_CMPR_LL_GET_HW(unit) (&ANALOG_CMPR[unit])
#define ANALOG_CMPR_LL_EVENT_CROSS (1 << 0)