[−][src]Struct imxrt_iomuxc::Config
A configuration capable of compile-time, const
configuration:
use imxrt_iomuxc::{Config, SlewRate, Hysteresis}; const UART_TX_CONFIG: Config = Config::zero() .set_slew_rate(SlewRate::Fast) .set_hysteresis(Hysteresis::Enabled);
Use configure()
to set configurations to pads.
Implementations
impl Config
[src]
pub const fn zero() -> Self
[src]
Create a Config
that will zero any unspecified field
This may not represent any register's reset value. A config that's
created using zero()
will have the effect of writing all fields
to the register. Those that are not set explicitly set are written as zero.
use imxrt_iomuxc::{ Config, configure, SlewRate, Hysteresis, PullUpDown, DriveStrength }; unsafe { // Set a configuration configure( &mut ad_b0_13, Config::zero() .set_slew_rate(SlewRate::Fast) .set_drive_strength(DriveStrength::R0_7) ); assert_eq!( *ad_b0_13.pad(), DriveStrength::R0_7 as u32 | SlewRate::Fast as u32 ); // Completely change that configuration configure( &mut ad_b0_13, Config::zero() .set_hysteresis(Hysteresis::Enabled) .set_pullupdown(PullUpDown::Pullup22k) ); assert_eq!( *ad_b0_13.pad(), Hysteresis::Enabled as u32 | PullUpDown::Pullup22k as u32 ); }
pub const fn modify() -> Self
[src]
Create a Config
that will only modify the specified fields
Any field that is is not specified in the configuration will not be touched.
use imxrt_iomuxc::{Config, configure, SlewRate, DriveStrength, Hysteresis}; unsafe { // Assume a starting value in the register... configure( &mut ad_b0_13, Config::zero() .set_slew_rate(SlewRate::Fast) .set_drive_strength(DriveStrength::R0_7) ); assert_eq!( *ad_b0_13.pad(), DriveStrength::R0_7 as u32 | SlewRate::Fast as u32 ); // Now change the slew rate, and add hysteresis configure( &mut ad_b0_13, Config::modify() .set_slew_rate(SlewRate::Slow) .set_hysteresis(Hysteresis::Enabled) ); assert_eq!( *ad_b0_13.pad(), DriveStrength::R0_7 as u32 | Hysteresis::Enabled as u32 ); }
pub const fn is_zero(&self) -> bool
[src]
Returns true
if this Config
was created using zero()
, meaning that it will
zero any unspecified fields. If false
, this config was created using modify()
,
which will not touch unspecified fields.
use imxrt_iomuxc::Config; assert!(Config::zero().is_zero()); assert!(!Config::modify().is_zero());
pub const fn set_hysteresis(self, hys: Hysteresis) -> Self
[src]
Set the hysteresis bit
pub const fn set_pullupdown(self, pud: PullUpDown) -> Self
[src]
Set the pull-up / pull-down value
pub const fn set_pull_keep_select(self, pke: PullKeepSelect) -> Self
[src]
Set the the pull-up / pull-down or keeper selection bit
pub const fn set_pull_keep(self, pk: PullKeep) -> Self
[src]
Set the flag that enables the keeper or pull-up / pull-down configuration
pub const fn set_open_drain(self, od: OpenDrain) -> Self
[src]
Set the open drain value
pub const fn set_speed(self, speed: Speed) -> Self
[src]
Set the pin speed
pub const fn set_drive_strength(self, dse: DriveStrength) -> Self
[src]
Set the drive strength
pub const fn set_slew_rate(self, sre: SlewRate) -> Self
[src]
Set the slew rate
Trait Implementations
impl Clone for Config
[src]
fn clone(&self) -> Config
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for Config
[src]
impl Debug for Config
[src]
impl Eq for Config
[src]
impl PartialEq<Config> for Config
[src]
impl StructuralEq for Config
[src]
impl StructuralPartialEq for Config
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
[src]
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,