[][src]Struct trellis_m4::sercom::v2::Pad

pub struct Pad<S, P, M> where
    P: PadNum,
    M: Map<S, P>,
    S: Sercom
{ /* fields omitted */ }

Represents a SERCOM Pad configured to use a particular pin

Each Pad is parameterized by a Sercom, a PadNum, and a third type that implements Map, which is used to determine the corresponding Pin and its configuration.

For the SAMD51 and SAME5x chips, Map is implemented on instances of IoSet . The SAMD11 and SAMD21 do not have any concept of IOSET, so Map is instead implemented directly on the corresponding PinId.

Each Pad takes ownership of the corresponding Pin for the duration of its lifetime. Pads can be converted to and from Pins using the Into and From traits.

Implementations

impl<S, P, M> Pad<S, P, M> where
    P: PadNum,
    M: Map<S, P>,
    S: Sercom
[src]

pub fn new<O>(pin: Pin<<M as Map<S, P>>::Id, O>) -> Pad<S, P, M> where
    O: PinMode,
    Pin<<M as Map<S, P>>::Id, O>: Into<Pin<<M as Map<S, P>>::Id, <M as Map<S, P>>::Mode>>, 
[src]

Create a new SERCOM Pad from a Pin

The specified Map type must map the specified Sercom and PadNum to the given Pin

pub fn free(self) -> Pin<<M as Map<S, P>>::Id, <M as Map<S, P>>::Mode>[src]

Consume the Pad and release the corresponding Pin

pub fn as_any<T>(self) -> T where
    T: AnyPad<Sercom = S, PadNum = P, Map = M>, 
[src]

Convert a Pad to a type that implements AnyPad

Even though there is a one-to-one mapping between Pad<S, P, M> and AnyPad<Sercom = S, PadNum = P, Map = M>, the compiler doesn't know that. This method provides a way to convert from a Pad to an AnyPad. See the AnyPad trait for more details.

Trait Implementations

impl<S, P, M> AnyPad for Pad<S, P, M> where
    P: PadNum,
    M: Map<S, P>,
    S: Sercom
[src]

type Sercom = S

type PadNum = P

type Map = M

impl<S, P, I> From<Pad<S, P, I>> for Pad<S, P, Pin<<I as Map<S, P>>::Id, <I as Map<S, P>>::Mode>> where
    P: PadNum,
    I: PinId + Map<S, P>,
    S: Sercom,
    Pin<<I as Map<S, P>>::Id, <I as Map<S, P>>::Mode>: Map<S, P>,
    <Pin<<I as Map<S, P>>::Id, <I as Map<S, P>>::Mode> as Map<S, P>>::Id == <I as Map<S, P>>::Id,
    <Pin<<I as Map<S, P>>::Id, <I as Map<S, P>>::Mode> as Map<S, P>>::Mode == <I as Map<S, P>>::Mode
[src]

Convert from a v2 Pad to a v1 Pad

The difference here is the Map type. v2 Pads use PinIds for Map, while v1 Pads use configured Pins. This conversion is usually only applicable to thumbv6m chips. The thumbv7em chips usually implement Map on IoSet

impl<S, P, M> From<Pad<S, P, M>> for Pin<<M as Map<S, P>>::Id, <M as Map<S, P>>::Mode> where
    P: PadNum,
    M: Map<S, P>,
    S: Sercom
[src]

pub fn from(
    pad: Pad<S, P, M>
) -> Pin<<M as Map<S, P>>::Id, <M as Map<S, P>>::Mode>
[src]

Convert from a Pad to its corresponding Pin.

This transformation is unique for a given Pad.

impl<S, P, I> From<Pad<S, P, Pin<<I as Map<S, P>>::Id, <I as Map<S, P>>::Mode>>> for Pad<S, P, I> where
    P: PadNum,
    I: PinId + Map<S, P>,
    S: Sercom,
    Pin<<I as Map<S, P>>::Id, <I as Map<S, P>>::Mode>: Map<S, P>,
    <Pin<<I as Map<S, P>>::Id, <I as Map<S, P>>::Mode> as Map<S, P>>::Id == <I as Map<S, P>>::Id,
    <Pin<<I as Map<S, P>>::Id, <I as Map<S, P>>::Mode> as Map<S, P>>::Mode == <I as Map<S, P>>::Mode
[src]

Convert from a v1 Pad to a v2 Pad

The difference here is the Map type. v2 Pads use PinIds for Map, while v1 Pads use configured Pins. This conversion is usually only applicable to thumbv6m chips. The thumbv7em chips usually implement Map on IoSet.

impl<S, P, M, O> From<Pin<<M as Map<S, P>>::Id, O>> for Pad<S, P, M> where
    P: PadNum,
    M: Map<S, P>,
    S: Sercom,
    O: PinMode,
    Pin<<M as Map<S, P>>::Id, O>: Into<Pin<<M as Map<S, P>>::Id, <M as Map<S, P>>::Mode>>, 
[src]

pub fn from(pin: Pin<<M as Map<S, P>>::Id, O>) -> Pad<S, P, M>[src]

Convert from a Pin to its corresponding Pad.

This conversion is not necessarily unique for a given Pin

impl<S, P, I, M> PadPin<Pad<S, P, Pin<<I as Map<S, P>>::Id, <I as Map<S, P>>::Mode>>> for Pin<I, M> where
    P: PadNum,
    M: PinMode,
    I: PinId + Map<S, P>,
    S: Sercom,
    Pin<I, M>: IntoFunction<Pin<<I as Map<S, P>>::Id, <I as Map<S, P>>::Mode>>,
    Pin<<I as Map<S, P>>::Id, <I as Map<S, P>>::Mode>: Map<S, P>,
    <Pin<<I as Map<S, P>>::Id, <I as Map<S, P>>::Mode> as Map<S, P>>::Id == <I as Map<S, P>>::Id,
    <Pin<<I as Map<S, P>>::Id, <I as Map<S, P>>::Mode> as Map<S, P>>::Mode == <I as Map<S, P>>::Mode
[src]

Auto Trait Implementations

impl<S, P, M> Send for Pad<S, P, M> where
    <M as Map<S, P>>::Id: Send,
    <M as Map<S, P>>::Mode: Send
[src]

impl<S, P, M> Sync for Pad<S, P, M> where
    <M as Map<S, P>>::Id: Sync,
    <M as Map<S, P>>::Mode: Sync
[src]

impl<S, P, M> Unpin for Pad<S, P, M> where
    <M as Map<S, P>>::Id: Unpin,
    <M as Map<S, P>>::Mode: Unpin
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<P> OptionalPad for P where
    P: AnyPad
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<P> SomePad for P where
    P: AnyPad
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.