[lightning-ln882h] Fix GPIO interrupt support (#326)

* fix interrupt handling for the ln882h

- all GPIOS can generate interrupts
- added calls to NVIC_SetPriority/NVIC_EnableIRQ/NVIC_DisableIRQ

* fix clang formatting error

* only call NVIC_DisableIRQ if no other gpio is using an interrupt

* fix (again) clang-format errors

* add IRQ capability on all pins

* don't bother with NVIC_DisableIRQ

* use pin->gpio instead of interruptNumber, use macro GPIO_GET_PORT for clarity

* Mark interrupts as supported for the LN882H

---------

Co-authored-by: lamauny <pub.elc@free.fr>
This commit is contained in:
Luca Olivetti
2025-09-19 22:25:03 +02:00
committed by GitHub
parent 9114bc4c49
commit 895b6e89c5
6 changed files with 38 additions and 23 deletions

View File

@@ -11,23 +11,23 @@ PinInfo lt_arduino_pin_info_list[PINS_COUNT] = {
// D0: PA07, SD_D3, I2S0_RX, I2C0_SCL, I2C0_SDA
{PA_7, PIN_I2S | PIN_I2C | PIN_IRQ | PIN_GPIO, PIN_NONE, 0},
// D1: PA12, I2C0_SCL, I2C0_SDA
{PA_12, PIN_I2C | PIN_GPIO, PIN_NONE, 0},
{PA_12, PIN_I2C | PIN_IRQ | PIN_GPIO, PIN_NONE, 0},
// D2: PA03, UART0_RX, I2C0_SCL, I2C0_SDA
{PA_3, PIN_UART | PIN_I2C | PIN_IRQ | PIN_GPIO, PIN_NONE, 0},
// D3: PA10, SD_D0, I2S0_TX, I2C0_SCL, I2C0_SDA
{PA_10, PIN_I2S | PIN_I2C | PIN_GPIO, PIN_NONE, 0},
{PA_10, PIN_I2S | PIN_I2C | PIN_IRQ | PIN_GPIO, PIN_NONE, 0},
// D4: PA02, UART0_TX, I2C0_SCL, I2C0_SDA
{PA_2, PIN_UART | PIN_I2C | PIN_IRQ | PIN_GPIO, PIN_NONE, 0},
// D5: PA00, ADC2, I2C0_SCL, I2C0_SDA
{PA_0, PIN_I2C | PIN_ADC | PIN_IRQ | PIN_GPIO, PIN_NONE, 0},
// D6: PB03, ADC5, I2C0_SCL, I2C0_SDA
{PB_3, PIN_I2C | PIN_ADC | PIN_GPIO, PIN_NONE, 0},
{PB_3, PIN_I2C | PIN_ADC | PIN_IRQ | PIN_GPIO, PIN_NONE, 0},
// D7: PA11, SD_D1, I2C0_SCL, I2C0_SDA
{PA_11, PIN_I2C | PIN_GPIO, PIN_NONE, 0},
{PA_11, PIN_I2C | PIN_IRQ | PIN_GPIO, PIN_NONE, 0},
// D8: PA09, BOOT1, SD_CLK, I2S0_SCLK, I2C0_SCL, I2C0_SDA
{PA_9, PIN_I2S | PIN_I2C | PIN_GPIO, PIN_NONE, 0},
{PA_9, PIN_I2S | PIN_I2C | PIN_IRQ | PIN_GPIO, PIN_NONE, 0},
// D9: PB08, UART1_RX, I2C0_SCL, I2C0_SDA
{PB_8, PIN_UART | PIN_I2C | PIN_GPIO, PIN_NONE, 0},
{PB_8, PIN_UART | PIN_I2C | PIN_IRQ | PIN_GPIO, PIN_NONE, 0},
// D10: PB09, UART1_TX, I2C0_SCL, I2C0_SDA
{PB_9, PIN_UART | PIN_I2C | PIN_IRQ | PIN_GPIO, PIN_NONE, 0},
// D11: PA05, I2C0_SCL, I2C0_SDA