Skip to content

Commit

Permalink
- Added GPIO pins 21-27 to esp32h2
Browse files Browse the repository at this point in the history
- fixed GPIO handler array size for esp32c2
  • Loading branch information
bitmagier committed Dec 16, 2024
1 parent 506dc9b commit 8dd4cfb
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/.vscode
/.idea
/.espressif
/.embuild
/target
Expand Down
40 changes: 32 additions & 8 deletions src/gpio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2080,10 +2080,10 @@ mod chip {

#[allow(clippy::type_complexity)]
#[cfg(feature = "alloc")]
pub(crate) static mut PIN_ISR_HANDLER: [Option<Box<dyn FnMut() + Send + 'static>>; 20] =
[PIN_ISR_INIT; 20];
pub(crate) static mut PIN_ISR_HANDLER: [Option<Box<dyn FnMut() + Send + 'static>>; 21] =
[PIN_ISR_INIT; 21];

pub(crate) static PIN_NOTIF: [HalIsrNotification; 20] = [PIN_NOTIF_INIT; 20];
pub(crate) static PIN_NOTIF: [HalIsrNotification; 21] = [PIN_NOTIF_INIT; 21];

// NOTE: Gpio12 - Gpio17 are used by SPI0/SPI1 for external PSRAM/SPI Flash and
// are not recommended for other uses
Expand Down Expand Up @@ -2184,13 +2184,16 @@ mod chip {

#[allow(clippy::type_complexity)]
#[cfg(feature = "alloc")]
pub(crate) static mut PIN_ISR_HANDLER: [Option<Box<dyn FnMut() + Send + 'static>>; 20] =
[PIN_ISR_INIT; 20];
pub(crate) static mut PIN_ISR_HANDLER: [Option<Box<dyn FnMut() + Send + 'static>>; 28] =
[PIN_ISR_INIT; 28];

pub(crate) static PIN_NOTIF: [HalIsrNotification; 20] = [PIN_NOTIF_INIT; 20];
pub(crate) static PIN_NOTIF: [HalIsrNotification; 28] = [PIN_NOTIF_INIT; 28];

// NOTE: Gpio12 - Gpio17 are used by SPI0/SPI1 for external PSRAM/SPI Flash and
// are not recommended for other uses
// NOTE: Following pins have special meaning and are not recommended for other uses. But one may use them with care.
// - Gpio12 - Gpio17 are used by SPI0/SPI1 for external PSRAM/SPI Flash
// - Gpio21 seems not to be exposed physically
// - Gpio23 + Gpio24 are used by serial debug interface
// - Gpio26 + Gpio27 are used by USB debug interface
pin!(Gpio0:0, IO, NORTC:0, NOADC:0, NODAC:0, NOTOUCH:0);
pin!(Gpio1:1, IO, NORTC:0, ADC1:0, NODAC:0, NOTOUCH:0);
pin!(Gpio2:2, IO, NORTC:0, ADC1:1, NODAC:0, NOTOUCH:0);
Expand All @@ -2212,6 +2215,13 @@ mod chip {
pin!(Gpio18:18, IO, NORTC:0, NOADC:0, NODAC:0, NOTOUCH:0);
pin!(Gpio19:19, IO, NORTC:0, NOADC:0, NODAC:0, NOTOUCH:0);
pin!(Gpio20:20, IO, NORTC:0, NOADC:0, NODAC:0, NOTOUCH:0);
pin!(Gpio21:21, IO, NORTC:0, NOADC:0, NODAC:0, NOTOUCH:0);
pin!(Gpio22:22, IO, NORTC:0, NOADC:0, NODAC:0, NOTOUCH:0);
pin!(Gpio23:23, IO, NORTC:0, NOADC:0, NODAC:0, NOTOUCH:0);
pin!(Gpio24:24, IO, NORTC:0, NOADC:0, NODAC:0, NOTOUCH:0);
pin!(Gpio25:25, IO, NORTC:0, NOADC:0, NODAC:0, NOTOUCH:0);
pin!(Gpio26:26, IO, NORTC:0, NOADC:0, NODAC:0, NOTOUCH:0);
pin!(Gpio27:27, IO, NORTC:0, NOADC:0, NODAC:0, NOTOUCH:0);

pub struct Pins {
pub gpio0: Gpio0,
Expand All @@ -2235,6 +2245,13 @@ mod chip {
pub gpio18: Gpio18,
pub gpio19: Gpio19,
pub gpio20: Gpio20,
pub gpio21: Gpio21,
pub gpio22: Gpio22,
pub gpio23: Gpio23,
pub gpio24: Gpio24,
pub gpio25: Gpio25,
pub gpio26: Gpio26,
pub gpio27: Gpio27,
}

impl Pins {
Expand Down Expand Up @@ -2265,6 +2282,13 @@ mod chip {
gpio18: Gpio18::new(),
gpio19: Gpio19::new(),
gpio20: Gpio20::new(),
gpio21: Gpio21::new(),
gpio22: Gpio22::new(),
gpio23: Gpio23::new(),
gpio24: Gpio24::new(),
gpio25: Gpio25::new(),
gpio26: Gpio26::new(),
gpio27: Gpio27::new(),
}
}
}
Expand Down

0 comments on commit 8dd4cfb

Please sign in to comment.