Add interrupt pin configuration for DIO1_PIN in llcc68

This commit is contained in:
2025-05-14 12:34:19 +08:00
parent d24d9d5dda
commit 162dbad6e1
2 changed files with 11 additions and 2 deletions

View File

@ -26,6 +26,9 @@ constexpr auto RST_PIN = NC_PIN;
constexpr auto DIO1_PIN = GPIO_NUM_NC;
constexpr auto DIO2_PIN = NC_PIN;
constexpr auto DIO3_PIN = NC_PIN;
/// @brief the pin numbers that needs to be configured as interrupt
constexpr gpio_num_t EXTI_PIN[] = {DIO1_PIN};
}
#endif /* B0CD865F_D860_44B7_B289_4F512C770D2B */

View File

@ -20,9 +20,13 @@ void init_exti() {
details::__dio_flag__ = true;
};
uint64_t pin_bit_mask = 0;
for (const auto pin : EXTI_PIN) {
pin_bit_mask |= (1ULL << pin);
}
gpio_config_t io_conf = {
.pin_bit_mask = (1ULL << DIO2_PIN),
.pin_bit_mask = pin_bit_mask,
.mode = GPIO_MODE_INPUT,
.pull_up_en = GPIO_PULLUP_DISABLE,
.pull_down_en = GPIO_PULLDOWN_DISABLE,
@ -31,6 +35,8 @@ void init_exti() {
// https://github.com/espressif/esp-idf/blob/v5.3.2/examples/peripherals/gpio/generic_gpio/main/gpio_example_main.c
ESP_ERROR_CHECK(gpio_config(&io_conf));
gpio_install_isr_service(ESP_INTR_FLAG_DEFAULT);
gpio_isr_handler_add(DIO2_PIN, isr, nullptr);
for (const auto pin : EXTI_PIN) {
gpio_isr_handler_add(pin, isr, nullptr);
}
}
}