Add remaining GPIO pins for ESP32-S2/S3 ULP (#1695)
Co-authored-by: Dominic Fischer <git@dominicfischer.me>
This commit is contained in:
parent
2c03266061
commit
bb806d35e0
@ -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 the `ulp-riscv-hal` package (#840)
|
||||||
- Add LP_UART basic driver (#1113)
|
- Add LP_UART basic driver (#1113)
|
||||||
- Added basic `LP-I2C` driver for C6 (#1185)
|
- Added basic `LP-I2C` driver for C6 (#1185)
|
||||||
|
- Add remaining GPIO pins for ESP32-S2/S3 (#1695)
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
|||||||
@ -7,6 +7,11 @@ type LpIo = crate::pac::LP_IO;
|
|||||||
#[cfg(any(feature = "esp32s2", feature = "esp32s3"))]
|
#[cfg(any(feature = "esp32s2", feature = "esp32s3"))]
|
||||||
type LpIo = crate::pac::RTC_IO;
|
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]
|
#[non_exhaustive]
|
||||||
pub struct Input<const PIN: u8> {}
|
pub struct Input<const PIN: u8> {}
|
||||||
|
|
||||||
@ -40,7 +45,7 @@ impl<const PIN: u8> Output<PIN> {
|
|||||||
// Used by the `entry` procmacro:
|
// Used by the `entry` procmacro:
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub unsafe fn conjure_output<const PIN: u8>() -> Option<Output<PIN>> {
|
pub unsafe fn conjure_output<const PIN: u8>() -> Option<Output<PIN>> {
|
||||||
if PIN > 7 {
|
if PIN > MAX_GPIO_PIN {
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
Some(Output {})
|
Some(Output {})
|
||||||
@ -50,7 +55,7 @@ pub unsafe fn conjure_output<const PIN: u8>() -> Option<Output<PIN>> {
|
|||||||
// Used by the `entry` procmacro:
|
// Used by the `entry` procmacro:
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub unsafe fn conjure_input<const PIN: u8>() -> Option<Input<PIN>> {
|
pub unsafe fn conjure_input<const PIN: u8>() -> Option<Input<PIN>> {
|
||||||
if PIN > 7 {
|
if PIN > MAX_GPIO_PIN {
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
Some(Input {})
|
Some(Input {})
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user