Add .gitignore file and refactor llcc68 component

- Added a comprehensive .gitignore file to exclude unnecessary files and directories for various platforms and tools.
- Removed the llcc68.cpp source file as part of the refactoring process.
- Updated llcc68.hpp to replace the `init_exti` function declaration with inline interrupt configuration logic.
- Changed `EXTI_PIN` to `EXTI_PINS` for clarity and consistency.
- Refactored the handling of CAD parameters and improved type safety by using `enum class` for `CAD_EXIT_MODE` and `CAD_SYMB`.
This commit is contained in:
2025-05-15 11:20:50 +08:00
parent 162dbad6e1
commit b99d063bd8
6 changed files with 1163 additions and 148 deletions

1054
.gitignore vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,5 @@
idf_component_register(
SRCS
src/llcc68.cpp
src/hal_spi.cpp
INCLUDE_DIRS
inc/

View File

@ -121,8 +121,6 @@ namespace details {
extern uint32_t __tcxo_delay__;
}
void init_exti();
constexpr auto delay_ms = app::utils::delay_ms;
/*!
@ -174,7 +172,7 @@ write_register(const uint16_t addr, std::span<const uint8_t> data) {
return spi::write_register(addr, data);
}
Result<Unit, error_t> inline write_buffer(std::span<const uint8_t> data, const uint8_t offset = 0x00) {
Result<Unit, error_t> inline write_buffer(std::span<const uint8_t> data, const uint8_t offset = DEFAULT_TX_BUFFER_ADDRESS) {
return spi::write_buffer(offset, data);
}
@ -447,8 +445,7 @@ set_dio2_as_rf_switch(const bool en) {
* \brief set packet type and do the calibration
*/
inline Result<Unit, error_t> config_packet_type(const parameters_t &params) {
auto res = set_buffer_base_address();
APP_RADIO_RETURN_ERR(res);
Result<Unit, error_t> res;
constexpr auto mod = RADIOLIB_SX126X_PACKET_TYPE_LORA;
uint8_t data[7];
data[0] = mod;
@ -584,13 +581,21 @@ inline Result<Unit, error_t> rx(const uint32_t timeout = RADIOLIB_SX126X_RX_TIME
return spi::write_stream(RADIOLIB_SX126X_CMD_SET_RX, data);
}
enum CAD_EXIT_MODE : uint8_t {
enum class CAD_EXIT_MODE : uint8_t {
CAD_ONLY = 0x00,
CAD_RX = 0x01,
};
enum class CAD_SYMB : uint8_t {
CAD_ON_1_SYMB = 0x00,
CAD_ON_2_SYMB = 0x01,
CAD_ON_4_SYMB = 0x02,
CAD_ON_8_SYMB = 0x03,
CAD_ON_16_SYMB = 0x04,
};
struct cad_params_t {
uint8_t symbol_num;
CAD_SYMB symbol_num;
uint8_t det_peak;
uint8_t det_min;
CAD_EXIT_MODE exit_mode;
@ -603,42 +608,30 @@ struct cad_params_t {
uint32_t timeout;
};
/**
* \brief Calculate default CAD parameters for a given spreading factor
* \param sf Spreading factor
* \param params CAD parameters
* \note will mutate `params.symbol_num`, `params.det_peak`, and `params.det_min`
* \return true if the sf is valid and the parameters are set, false otherwise
*/
inline bool calculate_default_cad_params(const uint8_t sf, cad_params_t &params) {
// Parameters `cadDetPeak` and `cadDetMin` define the sensitivity of the LoRa
// modem when trying to correlate to actual LoRa preamble symbols. These
// two settings depend on the LoRa spreading factor and Bandwidth, but
// also depend on the number of symbols used to validate or not the detection.
//
// Choosing the right value is not easy and the values selected must be
// carefully tested to ensure a good detection at sensitivity level, and
// also to limit the number of false detections. Application note AN1200.48
// provides guidance for the selection of these parameters.
constexpr std::tuple<uint8_t, uint8_t> sf_det_peak_map[6] = {
{7, 22},
{8, 22},
{9, 24},
{10, 25},
{11, 26},
{12, 30}};
// default CAD parameters are shown in Semtech AN1200.48, page 41.
const std::tuple<uint8_t, uint8_t> det_peak_map[6] = {{7, 22}, {8, 22}, {9, 24}, {10, 25}, {11, 26}, {12, 30}};
std::optional<uint8_t> det_peak;
for (const auto &[r_sf, r_det_peak] : det_peak_map) {
// Parameters `cadDetPeak` and `cadDetMin` define the sensitivity of the LoRa
// modem when trying to correlate to actual LoRa preamble symbols. These
// two settings depend on the LoRa spreading factor and Bandwidth, but
// also depend on the number of symbols used to validate or not the detection.
//
// Choosing the right value is not easy and the values selected must be
// carefully tested to ensure a good detection at sensitivity level, and
// also to limit the number of false detections. Application note AN1200.48
// provides guidance for the selection of these parameters.
constexpr inline std::optional<uint8_t> get_det_peak(const uint8_t sf) {
for (const auto &[r_sf, r_det_peak] : sf_det_peak_map) {
if (r_sf == sf) {
det_peak = r_det_peak;
break;
return r_det_peak;
}
}
if (not det_peak) {
return false;
}
// CAD parameters aren't available for SF-6. Just to be safe.
params.symbol_num = RADIOLIB_SX126X_CAD_ON_2_SYMB;
params.det_peak = det_peak.value();
params.det_min = RADIOLIB_SX126X_CAD_PARAM_DET_MIN;
return true;
return std::nullopt;
}
/**
@ -647,10 +640,10 @@ inline bool calculate_default_cad_params(const uint8_t sf, cad_params_t &params)
inline Result<Unit, error_t>
set_cad_params(const cad_params_t &params) {
uint8_t data[7];
data[0] = params.symbol_num;
data[0] = static_cast<uint8_t>(params.symbol_num);
data[1] = params.det_peak;
data[2] = params.det_min;
data[3] = params.exit_mode;
data[3] = static_cast<uint8_t>(params.exit_mode);
data[4] = static_cast<uint8_t>((params.timeout >> 16) & 0xFF);
data[5] = static_cast<uint8_t>((params.timeout >> 8) & 0xFF);
data[6] = static_cast<uint8_t>(params.timeout & 0xFF);
@ -950,7 +943,8 @@ struct read_result_t {
* \brief user should call this function after reading data (since it will override the internal buffer)
*/
static Result<Unit, error_t> post_procedure() {
auto res = set_buffer_base_address();
Result<Unit, error_t> res;
res = set_buffer_base_address();
APP_RADIO_RETURN_ERR(res);
res = clear_irq_status();
APP_RADIO_RETURN_ERR(res);
@ -991,8 +985,10 @@ read_data_internal() {
* is incremented starting from the previous position.
*/
const auto [sz, ptr] = std::move(*tuple_);
ESP_LOGD(TAG, "sz=%d, ptr=0x%02x", sz, ptr);
auto res = hal::spi::read_buffer(ptr - sz, sz);
// the rx pointer would become 0x80 at first, so we need to adapt that behavior
const auto r_ptr = ptr - sz < DEFAULT_RX_BUFFER_ADDRESS ? ptr : ptr - sz;
auto res = hal::spi::read_buffer(r_ptr, sz);
APP_RADIO_RETURN_ERR(res);
return read_result_t{irq, *res};
}
@ -1024,22 +1020,10 @@ inline Result<Unit, error_t>
kick_inf_rx() {
Result<Unit, error_t> res;
res = standby();
// res = set_packet_type(PacketType::LORA);
// APP_RADIO_RETURN_ERR_CTX(res, "failed to set packet type");
res = set_frequency(DEFAULT_FREQUENCY, false);
APP_RADIO_RETURN_ERR_CTX(res, "failed to set frequency");
APP_RADIO_RETURN_ERR_CTX(res, "failed to standby");
res = set_buffer_base_address();
APP_RADIO_RETURN_ERR_CTX(res, "failed to set buffer base address");
res = set_modulation_params(DEFAULT_SF, DEFAULT_BW, DEFAULT_CR, DEFAULT_LDR_OPTIMIZE);
APP_RADIO_RETURN_ERR_CTX(res, "failed to set modulation params");
res = set_packet_params(DEFAULT_PREAMBLE_LEN, 0xff, DEFAULT_CRC_TYPE, DEFAULT_HEADER_TYPE);
APP_RADIO_RETURN_ERR_CTX(res, "failed to set packet params");
constexpr auto irq_mask = RADIOLIB_SX126X_IRQ_RX_DEFAULT;
constexpr auto irq_params = irq_params_t{
irq_mask,
@ -1047,6 +1031,7 @@ kick_inf_rx() {
DIO2_PIN == NC_PIN ? RADIOLIB_SX126X_IRQ_NONE : irq_mask,
DIO3_PIN == NC_PIN ? RADIOLIB_SX126X_IRQ_NONE : irq_mask,
};
res = set_dio_irq_params(irq_params);
APP_RADIO_RETURN_ERR_CTX(res, "failed to set dio irq params");
res = clear_irq_status();
@ -1148,7 +1133,7 @@ async_transmit(const uint8_t *data, const size_t len,
};
res = set_dio_irq_params(irq_params);
APP_RADIO_RETURN_ERR_CTX(res, "failed to set dio irq params");
clear_irq_status();
clear_irq_status(irq_mask);
APP_RADIO_RETURN_ERR_CTX(res, "failed to clear irq status");
res = tx();
@ -1172,11 +1157,30 @@ async_transmit(const std::span<const uint8_t> data,
}
static constexpr auto init_pins = [] {
static constexpr auto init_pins = [](void (*isr)(void *), void *arg) {
if (RST_PIN != GPIO_NUM_NC) {
gpio::set_mode(RST_PIN, gpio::Mode::OUTPUT);
}
init_exti();
uint64_t pin_bit_mask = 0;
for (const auto pin : EXTI_PINS) {
pin_bit_mask |= (1ULL << pin);
}
gpio_config_t io_conf = {
.pin_bit_mask = pin_bit_mask,
.mode = GPIO_MODE_INPUT,
.pull_up_en = GPIO_PULLUP_DISABLE,
.pull_down_en = GPIO_PULLDOWN_DISABLE,
.intr_type = GPIO_INTR_POSEDGE,
};
// 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_IRAM);
for (const auto pin : EXTI_PINS) {
if (pin == NC_PIN) {
continue;
}
gpio_isr_handler_add(pin, isr, arg);
}
};
static constexpr auto begin = [](const parameters_t &params) -> Result<Unit, error_t> {

View File

@ -145,68 +145,68 @@ constexpr uint16_t RADIOLIB_SX126X_REG_PATCH_MEMORY_BASE = 0x8000;
// SX126X SPI command variables
// RADIOLIB_SX126X_CMD_SET_SLEEP MSB LSB DESCRIPTION
#define RADIOLIB_SX126X_SLEEP_START_COLD 0b00000000 // 2 2 sleep mode: cold start, configuration is lost (default)
#define RADIOLIB_SX126X_SLEEP_START_WARM 0b00000100 // 2 2 warm start, configuration is retained
#define RADIOLIB_SX126X_SLEEP_RTC_OFF 0b00000000 // 0 0 wake on RTC timeout: disabled
#define RADIOLIB_SX126X_SLEEP_RTC_ON 0b00000001 // 0 0 enabled
constexpr uint8_t RADIOLIB_SX126X_SLEEP_START_COLD = 0b00000000; // 2 2 sleep mode: cold start, configuration is lost (default)
constexpr uint8_t RADIOLIB_SX126X_SLEEP_START_WARM = 0b00000100; // 2 2 warm start, configuration is retained
constexpr uint8_t RADIOLIB_SX126X_SLEEP_RTC_OFF = 0b00000000; // 0 0 wake on RTC timeout: disabled
constexpr uint8_t RADIOLIB_SX126X_SLEEP_RTC_ON = 0b00000001; // 0 0 enabled
// RADIOLIB_SX126X_CMD_SET_STANDBY
#define RADIOLIB_SX126X_STANDBY_RC 0x00 // 7 0 standby mode: 13 MHz RC oscillator
#define RADIOLIB_SX126X_STANDBY_XOSC 0x01 // 7 0 32 MHz crystal oscillator
constexpr uint8_t RADIOLIB_SX126X_STANDBY_RC = 0x00; // 7 0 standby mode: 13 MHz RC oscillator
constexpr uint8_t RADIOLIB_SX126X_STANDBY_XOSC = 0x01; // 7 0 32 MHz crystal oscillator
// RADIOLIB_SX126X_CMD_SET_RX
#define RADIOLIB_SX126X_RX_TIMEOUT_NONE 0x000000 // 23 0 Rx timeout duration: no timeout (Rx single mode)
#define RADIOLIB_SX126X_RX_TIMEOUT_INF 0xFFFFFF // 23 0 infinite (Rx continuous mode)
constexpr uint32_t RADIOLIB_SX126X_RX_TIMEOUT_NONE = 0x000000; // 23 0 Rx timeout duration: no timeout (Rx single mode)
constexpr uint32_t RADIOLIB_SX126X_RX_TIMEOUT_INF = 0xFFFFFF; // 23 0 infinite (Rx continuous mode)
// RADIOLIB_SX126X_CMD_SET_TX
#define RADIOLIB_SX126X_TX_TIMEOUT_NONE 0x000000 // 23 0 Tx timeout duration: no timeout (Tx single mode)
constexpr uint32_t RADIOLIB_SX126X_TX_TIMEOUT_NONE = 0x000000; // 23 0 Tx timeout duration: no timeout (Tx single mode)
// RADIOLIB_SX126X_CMD_STOP_TIMER_ON_PREAMBLE
#define RADIOLIB_SX126X_STOP_ON_PREAMBLE_OFF 0x00 // 7 0 stop timer on: sync word or header (default)
#define RADIOLIB_SX126X_STOP_ON_PREAMBLE_ON 0x01 // 7 0 preamble detection
constexpr uint8_t RADIOLIB_SX126X_STOP_ON_PREAMBLE_OFF = 0x00; // 7 0 stop timer on: sync word or header (default)
constexpr uint8_t RADIOLIB_SX126X_STOP_ON_PREAMBLE_ON = 0x01; // 7 0 preamble detection
// RADIOLIB_SX126X_CMD_SET_REGULATOR_MODE
#define RADIOLIB_SX126X_REGULATOR_LDO 0x00 // 7 0 set regulator mode: LDO (default)
#define RADIOLIB_SX126X_REGULATOR_DC_DC 0x01 // 7 0 DC-DC
constexpr uint8_t RADIOLIB_SX126X_REGULATOR_LDO = 0x00; // 7 0 set regulator mode: LDO (default)
constexpr uint8_t RADIOLIB_SX126X_REGULATOR_DC_DC = 0x01; // 7 0 DC-DC
// RADIOLIB_SX126X_CMD_CALIBRATE
#define RADIOLIB_SX126X_CALIBRATE_IMAGE_OFF 0b00000000 // 6 6 image calibration: disabled
#define RADIOLIB_SX126X_CALIBRATE_IMAGE_ON 0b01000000 // 6 6 enabled
#define RADIOLIB_SX126X_CALIBRATE_ADC_BULK_P_OFF 0b00000000 // 5 5 ADC bulk P calibration: disabled
#define RADIOLIB_SX126X_CALIBRATE_ADC_BULK_P_ON 0b00100000 // 5 5 enabled
#define RADIOLIB_SX126X_CALIBRATE_ADC_BULK_N_OFF 0b00000000 // 4 4 ADC bulk N calibration: disabled
#define RADIOLIB_SX126X_CALIBRATE_ADC_BULK_N_ON 0b00010000 // 4 4 enabled
#define RADIOLIB_SX126X_CALIBRATE_ADC_PULSE_OFF 0b00000000 // 3 3 ADC pulse calibration: disabled
#define RADIOLIB_SX126X_CALIBRATE_ADC_PULSE_ON 0b00001000 // 3 3 enabled
#define RADIOLIB_SX126X_CALIBRATE_PLL_OFF 0b00000000 // 2 2 PLL calibration: disabled
#define RADIOLIB_SX126X_CALIBRATE_PLL_ON 0b00000100 // 2 2 enabled
#define RADIOLIB_SX126X_CALIBRATE_RC13M_OFF 0b00000000 // 1 1 13 MHz RC osc. calibration: disabled
#define RADIOLIB_SX126X_CALIBRATE_RC13M_ON 0b00000010 // 1 1 enabled
#define RADIOLIB_SX126X_CALIBRATE_RC64K_OFF 0b00000000 // 0 0 64 kHz RC osc. calibration: disabled
#define RADIOLIB_SX126X_CALIBRATE_RC64K_ON 0b00000001 // 0 0 enabled
#define RADIOLIB_SX126X_CALIBRATE_ALL 0b01111111 // 6 0 calibrate all blocks
constexpr uint8_t RADIOLIB_SX126X_CALIBRATE_IMAGE_OFF = 0b00000000; // 6 6 image calibration: disabled
constexpr uint8_t RADIOLIB_SX126X_CALIBRATE_IMAGE_ON = 0b01000000; // 6 6 enabled
constexpr uint8_t RADIOLIB_SX126X_CALIBRATE_ADC_BULK_P_OFF = 0b00000000; // 5 5 ADC bulk P calibration: disabled
constexpr uint8_t RADIOLIB_SX126X_CALIBRATE_ADC_BULK_P_ON = 0b00100000; // 5 5 enabled
constexpr uint8_t RADIOLIB_SX126X_CALIBRATE_ADC_BULK_N_OFF = 0b00000000; // 4 4 ADC bulk N calibration: disabled
constexpr uint8_t RADIOLIB_SX126X_CALIBRATE_ADC_BULK_N_ON = 0b00010000; // 4 4 enabled
constexpr uint8_t RADIOLIB_SX126X_CALIBRATE_ADC_PULSE_OFF = 0b00000000; // 3 3 ADC pulse calibration: disabled
constexpr uint8_t RADIOLIB_SX126X_CALIBRATE_ADC_PULSE_ON = 0b00001000; // 3 3 enabled
constexpr uint8_t RADIOLIB_SX126X_CALIBRATE_PLL_OFF = 0b00000000; // 2 2 PLL calibration: disabled
constexpr uint8_t RADIOLIB_SX126X_CALIBRATE_PLL_ON = 0b00000100; // 2 2 enabled
constexpr uint8_t RADIOLIB_SX126X_CALIBRATE_RC13M_OFF = 0b00000000; // 1 1 13 MHz RC osc. calibration: disabled
constexpr uint8_t RADIOLIB_SX126X_CALIBRATE_RC13M_ON = 0b00000010; // 1 1 enabled
constexpr uint8_t RADIOLIB_SX126X_CALIBRATE_RC64K_OFF = 0b00000000; // 0 0 64 kHz RC osc. calibration: disabled
constexpr uint8_t RADIOLIB_SX126X_CALIBRATE_RC64K_ON = 0b00000001; // 0 0 enabled
constexpr uint8_t RADIOLIB_SX126X_CALIBRATE_ALL = 0b01111111; // 6 0 calibrate all blocks
// RADIOLIB_SX126X_CMD_CALIBRATE_IMAGE
#define RADIOLIB_SX126X_CAL_IMG_430_MHZ_1 0x6B
#define RADIOLIB_SX126X_CAL_IMG_430_MHZ_2 0x6F
#define RADIOLIB_SX126X_CAL_IMG_470_MHZ_1 0x75
#define RADIOLIB_SX126X_CAL_IMG_470_MHZ_2 0x81
#define RADIOLIB_SX126X_CAL_IMG_779_MHZ_1 0xC1
#define RADIOLIB_SX126X_CAL_IMG_779_MHZ_2 0xC5
#define RADIOLIB_SX126X_CAL_IMG_863_MHZ_1 0xD7
#define RADIOLIB_SX126X_CAL_IMG_863_MHZ_2 0xDB
#define RADIOLIB_SX126X_CAL_IMG_902_MHZ_1 0xE1
#define RADIOLIB_SX126X_CAL_IMG_902_MHZ_2 0xE9
constexpr uint8_t RADIOLIB_SX126X_CAL_IMG_430_MHZ_1 = 0x6B;
constexpr uint8_t RADIOLIB_SX126X_CAL_IMG_430_MHZ_2 = 0x6F;
constexpr uint8_t RADIOLIB_SX126X_CAL_IMG_470_MHZ_1 = 0x75;
constexpr uint8_t RADIOLIB_SX126X_CAL_IMG_470_MHZ_2 = 0x81;
constexpr uint8_t RADIOLIB_SX126X_CAL_IMG_779_MHZ_1 = 0xC1;
constexpr uint8_t RADIOLIB_SX126X_CAL_IMG_779_MHZ_2 = 0xC5;
constexpr uint8_t RADIOLIB_SX126X_CAL_IMG_863_MHZ_1 = 0xD7;
constexpr uint8_t RADIOLIB_SX126X_CAL_IMG_863_MHZ_2 = 0xDB;
constexpr uint8_t RADIOLIB_SX126X_CAL_IMG_902_MHZ_1 = 0xE1;
constexpr uint8_t RADIOLIB_SX126X_CAL_IMG_902_MHZ_2 = 0xE9;
// RADIOLIB_SX126X_CMD_SET_PA_CONFIG
#define RADIOLIB_SX126X_PA_CONFIG_HP_MAX 0x07
#define RADIOLIB_SX126X_PA_CONFIG_PA_LUT 0x01
#define RADIOLIB_SX126X_PA_CONFIG_SX1262_8 0x00
constexpr uint8_t RADIOLIB_SX126X_PA_CONFIG_HP_MAX = 0x07;
constexpr uint8_t RADIOLIB_SX126X_PA_CONFIG_PA_LUT = 0x01;
constexpr uint8_t RADIOLIB_SX126X_PA_CONFIG_SX1262_8 = 0x00;
// RADIOLIB_SX126X_CMD_SET_RX_TX_FALLBACK_MODE
#define RADIOLIB_SX126X_RX_TX_FALLBACK_MODE_FS 0x40 // 7 0 after Rx/Tx go to: FS mode
#define RADIOLIB_SX126X_RX_TX_FALLBACK_MODE_STDBY_XOSC 0x30 // 7 0 standby with crystal oscillator
#define RADIOLIB_SX126X_RX_TX_FALLBACK_MODE_STDBY_RC 0x20 // 7 0 standby with RC oscillator (default)
constexpr uint8_t RADIOLIB_SX126X_RX_TX_FALLBACK_MODE_FS = 0x40; // 7 0 after Rx/Tx go to: FS mode
constexpr uint8_t RADIOLIB_SX126X_RX_TX_FALLBACK_MODE_STDBY_XOSC = 0x30; // 7 0 standby with crystal oscillator
constexpr uint8_t RADIOLIB_SX126X_RX_TX_FALLBACK_MODE_STDBY_RC = 0x20; // 7 0 standby with RC oscillator (default)
// RADIOLIB_SX126X_CMD_SET_DIO_IRQ_PARAMS
#define RADIOLIB_SX126X_IRQ_LR_FHSS_HOP 0b0100000000000000 // 14 14 PA ramped up during LR-FHSS hop

View File

@ -28,7 +28,7 @@ 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};
constexpr gpio_num_t EXTI_PINS[] = {DIO1_PIN};
}
#endif /* B0CD865F_D860_44B7_B289_4F512C770D2B */

View File

@ -1,42 +0,0 @@
//
// Created by Kurosu Chan on 2024/1/17.
//
#include "llcc68.hpp"
#include "driver/gpio.h"
#include "app_const_llcc68.hpp"
constexpr auto ESP_INTR_FLAG_DEFAULT = 0;
namespace app::driver::llcc68 {
namespace details {
uint32_t __tcxo_delay__;
transmit_state_t __tx_state__;
// TODO: use freeRTOS queue to handle received data
bool __dio_flag__ = false;
}
void init_exti() {
constexpr auto isr = [](void *param) {
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 = pin_bit_mask,
.mode = GPIO_MODE_INPUT,
.pull_up_en = GPIO_PULLUP_DISABLE,
.pull_down_en = GPIO_PULLDOWN_DISABLE,
.intr_type = GPIO_INTR_POSEDGE,
};
// 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);
for (const auto pin : EXTI_PIN) {
gpio_isr_handler_add(pin, isr, nullptr);
}
}
}