mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-09 04:25:32 +00:00
gpio: support glitch filter
This commit is contained in:
@@ -279,6 +279,14 @@ config SOC_GPIO_PIN_COUNT
|
||||
int
|
||||
default 31
|
||||
|
||||
config SOC_GPIO_SUPPORT_PIN_GLITCH_FILTER
|
||||
bool
|
||||
default y
|
||||
|
||||
config SOC_GPIO_FLEX_GLITCH_FILTER_NUM
|
||||
int
|
||||
default 8
|
||||
|
||||
config SOC_GPIO_SUPPORT_ETM
|
||||
bool
|
||||
default y
|
||||
|
@@ -70,22 +70,22 @@ typedef union {
|
||||
*/
|
||||
typedef union {
|
||||
struct {
|
||||
/** filter_ch0_en : R/W; bitpos: [0]; default: 0;
|
||||
/** filter_chn_en : R/W; bitpos: [0]; default: 0;
|
||||
* Glitch Filter channel enable bit.
|
||||
*/
|
||||
uint32_t filter_ch0_en:1;
|
||||
/** filter_ch0_input_io_num : R/W; bitpos: [6:1]; default: 0;
|
||||
uint32_t filter_chn_en:1;
|
||||
/** filter_chn_input_io_num : R/W; bitpos: [6:1]; default: 0;
|
||||
* Glitch Filter input io number.
|
||||
*/
|
||||
uint32_t filter_ch0_input_io_num:6;
|
||||
/** filter_ch0_window_thres : R/W; bitpos: [12:7]; default: 0;
|
||||
uint32_t filter_chn_input_io_num:6;
|
||||
/** filter_chn_window_thres : R/W; bitpos: [12:7]; default: 0;
|
||||
* Glitch Filter window threshold.
|
||||
*/
|
||||
uint32_t filter_ch0_window_thres:6;
|
||||
/** filter_ch0_window_width : R/W; bitpos: [18:13]; default: 0;
|
||||
uint32_t filter_chn_window_thres:6;
|
||||
/** filter_chn_window_width : R/W; bitpos: [18:13]; default: 0;
|
||||
* Glitch Filter window width.
|
||||
*/
|
||||
uint32_t filter_ch0_window_width:6;
|
||||
uint32_t filter_chn_window_width:6;
|
||||
uint32_t reserved_19:13;
|
||||
};
|
||||
uint32_t val;
|
||||
|
@@ -63,6 +63,11 @@
|
||||
#define MCU_SEL_M (MCU_SEL_V << MCU_SEL_S)
|
||||
#define MCU_SEL_V 0x7
|
||||
#define MCU_SEL_S 12
|
||||
/* Pin filter (Pulse width shorter than 2 clock cycles will be filtered out) */
|
||||
#define FILTER_EN (BIT(15))
|
||||
#define FILTER_EN_M (FILTER_EN_V << FILTER_EN_S)
|
||||
#define FILTER_EN_V 1
|
||||
#define FILTER_EN_S 15
|
||||
|
||||
#define PIN_SLP_INPUT_ENABLE(PIN_NAME) SET_PERI_REG_MASK(PIN_NAME,SLP_IE)
|
||||
#define PIN_SLP_INPUT_DISABLE(PIN_NAME) CLEAR_PERI_REG_MASK(PIN_NAME,SLP_IE)
|
||||
@@ -83,6 +88,8 @@
|
||||
#define PIN_PULLDWN_DIS(PIN_NAME) REG_CLR_BIT(PIN_NAME, FUN_PD)
|
||||
#define PIN_PULLDWN_EN(PIN_NAME) REG_SET_BIT(PIN_NAME, FUN_PD)
|
||||
#define PIN_FUNC_SELECT(PIN_NAME, FUNC) REG_SET_FIELD(PIN_NAME, MCU_SEL, FUNC)
|
||||
#define PIN_FILTER_EN(PIN_NAME) REG_SET_BIT(PIN_NAME, FILTER_EN)
|
||||
#define PIN_FILTER_DIS(PIN_NAME) REG_CLR_BIT(PIN_NAME, FILTER_EN)
|
||||
|
||||
#define IO_MUX_GPIO0_REG PERIPHS_IO_MUX_XTAL_32K_P_U
|
||||
#define IO_MUX_GPIO1_REG PERIPHS_IO_MUX_XTAL_32K_N_U
|
||||
|
@@ -150,8 +150,10 @@
|
||||
|
||||
/*-------------------------- GPIO CAPS ---------------------------------------*/
|
||||
// ESP32-C6 has 1 GPIO peripheral
|
||||
#define SOC_GPIO_PORT (1U)
|
||||
#define SOC_GPIO_PIN_COUNT (31)
|
||||
#define SOC_GPIO_PORT 1U
|
||||
#define SOC_GPIO_PIN_COUNT 31
|
||||
#define SOC_GPIO_SUPPORT_PIN_GLITCH_FILTER 1
|
||||
#define SOC_GPIO_FLEX_GLITCH_FILTER_NUM 8
|
||||
|
||||
// GPIO peripheral has the ETM extension
|
||||
#define SOC_GPIO_SUPPORT_ETM 1
|
||||
|
Reference in New Issue
Block a user