Skip to content

[7/N] Obtain LP tokens from GPIO drivers - #6009

Open
bugadani wants to merge 1 commit into
esp-rs:mainfrom
bugadani:lpio-drivers
Open

[7/N] Obtain LP tokens from GPIO drivers#6009
bugadani wants to merge 1 commit into
esp-rs:mainfrom
bugadani:lpio-drivers

Conversation

@bugadani

@bugadani bugadani commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

This approach commits us to fallible methods for LP_IO-specific functionality in the main GPIO drivers. If we do this, we'll also add fallible .configure_deep_sleep_wakeup() functions in the future.

These functions consume the driver instead of reborrowing. Either could work, but it depends whether it is actually safe to have non-static LowPower* types. Currently, I don't believe it is - we hand a pin to the LP core, then it has full unscoped control over it - which means the lifetime on those types is a bug.

Alternatives:

  • Typed wrappers - lp_io::Input<'d, LP_PIN_N> etc. This is a huge amount of code to maintain in parallel with the main GPIO driver. This could let us control these pins via the LP IOMUX, where it exists, but that actually has a reduced feature set so I'm not sure HP core firmware wants that.
  • Optional type erase, have GpioDriver<'d, M = ()> or GpioDriver<'d, LowPowerPin<N>> - if it's semver-legal to introduce. I think this would be confusing UX.

Changelog

esp-hal

  • Added: into_lp* functions to gpio::{Input, Output, Flex} drivers.
  • Removed: LowPowerInput, LowPowerOutput and LowPowerOutputOpenDrain are no longer available on chips without a supported LP core.

@bugadani
bugadani force-pushed the lpio-drivers branch 2 times, most recently from d08fcb1 to a0d8bfa Compare July 31, 2026 14:29
@bugadani bugadani changed the title Obtain LP tokens from GPIO drivers [7/N] Obtain LP tokens from GPIO drivers Jul 31, 2026
@github-actions github-actions Bot added the merge-conflict Merge conflict detected. Automatically added/removed by CI. label Jul 31, 2026
@github-actions

Copy link
Copy Markdown

New commits in main have made this PR unmergeable. Please resolve the conflicts.

@github-actions github-actions Bot added merge-conflict Merge conflict detected. Automatically added/removed by CI. and removed merge-conflict Merge conflict detected. Automatically added/removed by CI. labels Aug 3, 2026
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

New commits in main have made this PR unmergeable. Please resolve the conflicts.

@bugadani
bugadani marked this pull request as ready for review August 4, 2026 07:55
@bugadani
bugadani requested a review from playfulFence as a code owner August 4, 2026 07:55
@github-actions github-actions Bot removed the merge-conflict Merge conflict detected. Automatically added/removed by CI. label Aug 4, 2026
@bugadani
bugadani force-pushed the lpio-drivers branch 4 times, most recently from 064c544 to a3d816b Compare August 4, 2026 08:21
phantom: PhantomData<&'d mut ()>,
}
/// Tokens to hand out a pin to a low-power CPU.
// FIXME: tokens should be 'static to be handed out.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants