Add remaining GPIO pins for ESP32-S2/S3 ULP (#1695)

Co-authored-by: Dominic Fischer <git@dominicfischer.me>
This commit is contained in:
Dominic Fischer 2024-06-19 16:17:48 +01:00 committed by GitHub
parent 2c03266061
commit bb806d35e0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 2 deletions

View File

@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add the `ulp-riscv-hal` package (#840)
- Add LP_UART basic driver (#1113)
- Added basic `LP-I2C` driver for C6 (#1185)
- Add remaining GPIO pins for ESP32-S2/S3 (#1695)
### Changed

View File

@ -7,6 +7,11 @@ type LpIo = crate::pac::LP_IO;
#[cfg(any(feature = "esp32s2", feature = "esp32s3"))]
type LpIo = crate::pac::RTC_IO;
#[cfg(feature = "esp32c6")]
const MAX_GPIO_PIN: u8 = 7;
#[cfg(any(feature = "esp32s2", feature = "esp32s3"))]
const MAX_GPIO_PIN: u8 = 21;
#[non_exhaustive]
pub struct Input<const PIN: u8> {}
@ -40,7 +45,7 @@ impl<const PIN: u8> Output<PIN> {
// Used by the `entry` procmacro:
#[doc(hidden)]
pub unsafe fn conjure_output<const PIN: u8>() -> Option<Output<PIN>> {
if PIN > 7 {
if PIN > MAX_GPIO_PIN {
None
} else {
Some(Output {})
@ -50,7 +55,7 @@ pub unsafe fn conjure_output<const PIN: u8>() -> Option<Output<PIN>> {
// Used by the `entry` procmacro:
#[doc(hidden)]
pub unsafe fn conjure_input<const PIN: u8>() -> Option<Input<PIN>> {
if PIN > 7 {
if PIN > MAX_GPIO_PIN {
None
} else {
Some(Input {})