Struct esp_idf_hal::gpio::PinDriver

source ·
pub struct PinDriver<'d, T: Pin, MODE> { /* private fields */ }
Expand description

A driver for a GPIO pin.

The driver can set the pin as a disconnected/disabled one, input, or output pin, or both or analog. On some chips (i.e. esp32 and esp32s*), the driver can also set the pin in RTC IO mode. Depending on the current operating mode, different sets of functions are available.

The mode-setting depends on the capabilities of the pin as well, i.e. input-only pins cannot be set into output or input-output mode.

Implementations§

Creates the driver for a pin in disabled state.

Creates the driver for a pin in input state.

Creates the driver for a pin in input-output state.

Creates the driver for a pin in input-output open-drain state.

Creates the driver for a pin in output state.

Creates the driver for a pin in output open-drain state.

Returns the pin number.

Put the pin into disabled mode.

Put the pin into input mode.

Put the pin into input + output mode.

Put the pin into input + output Open Drain mode.

This is commonly used for “open drain” mode. the hardware will drive the line low if you set it to low, and will leave it floating if you set it to high, in which case you can read the input to figure out whether another device is driving the line low.

Put the pin into output mode.

Put the pin into output Open Drain mode.

Is the output pin set as low?

Set the output as low.

Toggle pin output

Safety

Care should be taken not to call STD, libc or FreeRTOS APIs (except for a few allowed ones) in the callback passed to this function, as it is executed in an ISR context.

Trait Implementations§

Executes the destructor for this type. Read more
Error type
Error type
Is the input pin high?
Is the input pin low?
Is the input pin high?
Is the input pin low?
Error type
Drives the pin high Read more
Drives the pin low Read more
Drives the pin high or low depending on the provided value Read more
Drives the pin high Read more
Drives the pin low Read more
Drives the pin high or low depending on the provided value Read more
Is the pin in drive high mode? Read more
Is the pin in drive low mode? Read more
Is the pin in drive high mode? Read more
Is the pin in drive low mode? Read more
Error type
Toggle pin output.
Toggle pin output.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.