Struct kea_hal::adc::Analog[][src]

pub struct Analog<Pin> { /* fields omitted */ }
Expand description

Analog type state for a GPIO pin.

This mode “gives” the pin to the ADC hardware peripheral. The ADC Peripheral can take the GPIO pins in any state. The Peripheral will reconfigure the pin to turn off any output drivers, disable input buffers (reading the pin after configuring as analog will return a zero), and disable the pullup. Electrically, an Analog pin that is not currently under conversion is effectively HighImpedence.

Once a pin is released from the ADC, it will return to its previous state. The previous state includes output enabled, input enabled, pullup enabled, and level (for outputs). Note to accomplish this the pin implements the outof_analog method, which is semantically different from the other type states.

For example, crate::gpio::gpioa::PTA0 is configured to be a Output that is set high is converted into the analog mode with the crate::gpio::gpioa::PTA0::into_analog method. Once measurements from that pin are completed it will be returned to an Output that is set high by calling the Analog::outof_analog method.

let pta0 = gpioa.pta0.into_push_pull_output();
pta0.set_high();
let mut pta0 = pta0.into_analog(); // pta0 is hi-Z
let value = adc.read(&mut pta0).unwrap_or(0);
let pta0 = pta0.outof_analog();  // pta0 is push-pull output, set high.

Note: This is a hardware feature that requires effectively no clock cycles to complete. “Manually” reconfiguring the pins to HighImpedence before calling into_analog() is discouraged, but it would not hurt anything.

Implementations

Return Analog state Pin to normal GPIO-state interface.

The Pin will be in the same state that it was when it entered the Analog type state.

Return Analog state Pin to normal GPIO-state interface.

The Pin will be in the same state that it was when it entered the Analog type state.

Return Analog state Pin to normal GPIO-state interface.

The Pin will be in the same state that it was when it entered the Analog type state.

Return Analog state Pin to normal GPIO-state interface.

The Pin will be in the same state that it was when it entered the Analog type state.

Return Analog state Pin to normal GPIO-state interface.

The Pin will be in the same state that it was when it entered the Analog type state.

Return Analog state Pin to normal GPIO-state interface.

The Pin will be in the same state that it was when it entered the Analog type state.

Return Analog state Pin to normal GPIO-state interface.

The Pin will be in the same state that it was when it entered the Analog type state.

Return Analog state Pin to normal GPIO-state interface.

The Pin will be in the same state that it was when it entered the Analog type state.

Return Analog state Pin to normal GPIO-state interface.

The Pin will be in the same state that it was when it entered the Analog type state.

Return Analog state Pin to normal GPIO-state interface.

The Pin will be in the same state that it was when it entered the Analog type state.

Return Analog state Pin to normal GPIO-state interface.

The Pin will be in the same state that it was when it entered the Analog type state.

Return Analog state Pin to normal GPIO-state interface.

The Pin will be in the same state that it was when it entered the Analog type state.

Return Analog state Pin to normal GPIO-state interface.

The Pin will be in the same state that it was when it entered the Analog type state.

Return Analog state Pin to normal GPIO-state interface.

The Pin will be in the same state that it was when it entered the Analog type state.

Return Analog state Pin to normal GPIO-state interface.

The Pin will be in the same state that it was when it entered the Analog type state.

Return Analog state Pin to normal GPIO-state interface.

The Pin will be in the same state that it was when it entered the Analog type state.

Trait Implementations

Channel ID type Read more

Get the specific ID that identifies this channel, for example 0_u8 for the first ADC channel, if Self::ID is u8. Read more

Channel ID type Read more

Get the specific ID that identifies this channel, for example 0_u8 for the first ADC channel, if Self::ID is u8. Read more

Channel ID type Read more

Get the specific ID that identifies this channel, for example 0_u8 for the first ADC channel, if Self::ID is u8. Read more

Channel ID type Read more

Get the specific ID that identifies this channel, for example 0_u8 for the first ADC channel, if Self::ID is u8. Read more

Channel ID type Read more

Get the specific ID that identifies this channel, for example 0_u8 for the first ADC channel, if Self::ID is u8. Read more

Channel ID type Read more

Get the specific ID that identifies this channel, for example 0_u8 for the first ADC channel, if Self::ID is u8. Read more

Channel ID type Read more

Get the specific ID that identifies this channel, for example 0_u8 for the first ADC channel, if Self::ID is u8. Read more

Channel ID type Read more

Get the specific ID that identifies this channel, for example 0_u8 for the first ADC channel, if Self::ID is u8. Read more

Channel ID type Read more

Get the specific ID that identifies this channel, for example 0_u8 for the first ADC channel, if Self::ID is u8. Read more

Channel ID type Read more

Get the specific ID that identifies this channel, for example 0_u8 for the first ADC channel, if Self::ID is u8. Read more

Channel ID type Read more

Get the specific ID that identifies this channel, for example 0_u8 for the first ADC channel, if Self::ID is u8. Read more

Channel ID type Read more

Get the specific ID that identifies this channel, for example 0_u8 for the first ADC channel, if Self::ID is u8. Read more

Channel ID type Read more

Get the specific ID that identifies this channel, for example 0_u8 for the first ADC channel, if Self::ID is u8. Read more

Channel ID type Read more

Get the specific ID that identifies this channel, for example 0_u8 for the first ADC channel, if Self::ID is u8. Read more

Channel ID type Read more

Get the specific ID that identifies this channel, for example 0_u8 for the first ADC channel, if Self::ID is u8. Read more

Channel ID type Read more

Get the specific ID that identifies this channel, for example 0_u8 for the first ADC channel, if Self::ID is u8. Read more

Channel ID type Read more

Get the specific ID that identifies this channel, for example 0_u8 for the first ADC channel, if Self::ID is u8. Read more

Channel ID type Read more

Get the specific ID that identifies this channel, for example 0_u8 for the first ADC channel, if Self::ID is u8. Read more

Channel ID type Read more

Get the specific ID that identifies this channel, for example 0_u8 for the first ADC channel, if Self::ID is u8. Read more

Channel ID type Read more

Get the specific ID that identifies this channel, for example 0_u8 for the first ADC channel, if Self::ID is u8. Read more

Channel ID type Read more

Get the specific ID that identifies this channel, for example 0_u8 for the first ADC channel, if Self::ID is u8. Read more

Channel ID type Read more

Get the specific ID that identifies this channel, for example 0_u8 for the first ADC channel, if Self::ID is u8. Read more

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

Performs the conversion.

Performs the conversion.

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.