Skip to main content

Module lp_io

Module lp_io 

Source
Available on crate feature unstable only.
Expand description

Low Power IO (LP_IO)

§Overview

The hardware provides GPIO pins with low-power capabilities and analog functions. These pins are controlled by the LP IO peripheral, which some devices call RTC IO.

§Configuration

Low-power pins bypass the regular IO MUX and GPIO matrix so they can be used by the ULP/LP core and low-power peripherals. They can remain operational during deep sleep and can be used as wake-up sources.

§Handing a pin to the low-power core

LowPowerInput, LowPowerOutput, and LowPowerOutputOpenDrain are opaque tokens that represent a pad owned by the low-power domain. Obtain them by consuming a Input or Output driver with Input::into_lp, Output::into_lp, or Output::into_open_drain_lp. The conversion muxes the pad into the low-power domain; afterwards the HP core can no longer drive it.

The PIN parameter of the tokens is the low-power pin number, which is how low-power core firmware refers to the pin. The conversions verify at runtime that the pad they are given is that pin, and hand the driver back when it is not.

The tokens can also be created straight from a pin with LowPowerInput::new, LowPowerOutput::new, and LowPowerOutputOpenDrain::new, which check the pin number at compile time but leave the pad’s configuration up to the token.

§Examples

§Hand a pin to the LP core

use esp_hal::gpio::{Level, Output, OutputConfig};
let pin = Output::new(peripherals.GPIO1, Level::Low, OutputConfig::default());
let lp_pin = pin.into_lp::<1>().unwrap();

Structs§

LowPowerInput
A GPIO input pin configured for low-power operation.
LowPowerOutput
A GPIO output pin configured for low-power operation.
LowPowerOutputOpenDrain
A GPIO open-drain output pin configured for low-power operation.