[][src]Struct pygamer::sercom::SPIMaster2

pub struct SPIMaster2<MISO, MOSI, SCK> { /* fields omitted */ }

SPIMasterX represents the corresponding SERCOMX instance configured to act in the role of an SPI Master. Objects of this type implement the HAL FullDuplex and blocking SPI traits.

This type is generic over any valid pad mapping where there is a defined "data in pin out data out pin out" implementation.

Implementations

impl<MISO, MOSI, SCK> SPIMaster2<MISO, MOSI, SCK>[src]

pub fn new<F, T>(
    clock: &Sercom2CoreClock,
    freq: F,
    mode: Mode,
    sercom: SERCOM2,
    mclk: &mut MCLK,
    padout: T
) -> SPIMaster2<MISO, MOSI, SCK> where
    F: Into<Hertz>,
    T: Into<SPIMaster2Padout<MISO, MOSI, SCK>>,
    SPIMaster2Padout<MISO, MOSI, SCK>: DipoDopo
[src]

Power on and configure SERCOMX to work as an SPI Master operating with the specified frequency and SPI Mode. The pinout specifies which pins are bound to the MISO, MOSI, SCK functions.

pub fn disable(&mut self)[src]

Disable the SPI

pub fn enable(&mut self)[src]

Enable the SPI

pub fn set_baud<F>(&mut self, freq: F, clock: &Sercom2CoreClock) where
    F: Into<Hertz>, 
[src]

Set the baud rate

pub fn set_mode(&mut self, mode: Mode)[src]

Set the polarity (CPOL) and phase (CPHA) of the SPI

pub fn free(self) -> (SPIMaster2Padout<MISO, MOSI, SCK>, SERCOM2)[src]

Tear down the SPI instance and yield the constituent pins and SERCOM instance. No explicit de-initialization is performed.

Trait Implementations

impl<MISO, MOSI, SCK> Default<u8> for SPIMaster2<MISO, MOSI, SCK>[src]

impl<MISO, MOSI, SCK> Default<u8> for SPIMaster2<MISO, MOSI, SCK>[src]

impl<MISO, MOSI, SCK> Default<u8> for SPIMaster2<MISO, MOSI, SCK>[src]

impl<MISO, MOSI, SCK> FullDuplex<u8> for SPIMaster2<MISO, MOSI, SCK>[src]

type Error = Error

An enumeration of SPI errors

Auto Trait Implementations

impl<MISO, MOSI, SCK> Send for SPIMaster2<MISO, MOSI, SCK> where
    MISO: Send,
    MOSI: Send,
    SCK: Send

impl<MISO, MOSI, SCK> !Sync for SPIMaster2<MISO, MOSI, SCK>

impl<MISO, MOSI, SCK> Unpin for SPIMaster2<MISO, MOSI, SCK> where
    MISO: Unpin,
    MOSI: Unpin,
    SCK: Unpin

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<T> Same<T> for T

type Output = T

Should always be Self

impl<W, S> Transfer<W> for S where
    S: Default<W>,
    W: Clone
[src]

type Error = <S as FullDuplex<W>>::Error

Error type

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.

impl<W, S> Write<W> for S where
    S: Default<W>,
    W: Clone
[src]

type Error = <S as FullDuplex<W>>::Error

Error type

impl<W, S> WriteIter<W> for S where
    S: Default<W>,
    W: Clone
[src]

type Error = <S as FullDuplex<W>>::Error

Error type