[−][src]Struct pygamer::sercom::SPIMaster0
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> SPIMaster0<MISO, MOSI, SCK>
[src]
pub fn new<F, T>(
clock: &Sercom0CoreClock,
freq: F,
mode: Mode,
sercom: SERCOM0,
mclk: &mut MCLK,
padout: T
) -> SPIMaster0<MISO, MOSI, SCK> where
T: Into<SPIMaster0Padout<MISO, MOSI, SCK>>,
F: Into<Hertz>,
SPIMaster0Padout<MISO, MOSI, SCK>: DipoDopo,
[src]
clock: &Sercom0CoreClock,
freq: F,
mode: Mode,
sercom: SERCOM0,
mclk: &mut MCLK,
padout: T
) -> SPIMaster0<MISO, MOSI, SCK> where
T: Into<SPIMaster0Padout<MISO, MOSI, SCK>>,
F: Into<Hertz>,
SPIMaster0Padout<MISO, MOSI, SCK>: DipoDopo,
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 set_baud<F>(&mut self, freq: F, clock: &Sercom0CoreClock) where
F: Into<Hertz>,
[src]
F: Into<Hertz>,
Set the baud rate
pub fn free(self) -> (SPIMaster0Padout<MISO, MOSI, SCK>, SERCOM0)
[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> CommonSpi for SPIMaster0<MISO, MOSI, SCK>
[src]
pub fn spi(&self) -> &SPIM
[src]
Helper for accessing the spi member of the sercom instance
pub fn spi_mut(&mut self) -> &SPIM
[src]
Helper for accessing the spi member of the sercom instance
pub fn disable(&mut self)
[src]
pub fn enable(&mut self)
[src]
pub fn set_mode(&mut self, mode: Mode)
[src]
pub fn freq<F>(&self, src_clock_freq: Hertz) -> Hertz where
F: Into<Hertz>,
[src]
F: Into<Hertz>,
pub fn calculate_baud<F>(freq: F, src_clock_freq: Hertz) -> u8 where
F: Into<Hertz>,
[src]
F: Into<Hertz>,
impl<MISO, MOSI, SCK> Default<u8> for SPIMaster0<MISO, MOSI, SCK>
[src]
impl<MISO, MOSI, SCK> Default<u8> for SPIMaster0<MISO, MOSI, SCK>
[src]
impl<MISO, MOSI, SCK> Default<u8> for SPIMaster0<MISO, MOSI, SCK>
[src]
impl<MISO, MOSI, SCK> FullDuplex<u8> for SPIMaster0<MISO, MOSI, SCK>
[src]
Auto Trait Implementations
impl<MISO, MOSI, SCK> Send for SPIMaster0<MISO, MOSI, SCK> where
MISO: Send,
MOSI: Send,
SCK: Send,
[src]
MISO: Send,
MOSI: Send,
SCK: Send,
impl<MISO, MOSI, SCK> !Sync for SPIMaster0<MISO, MOSI, SCK>
[src]
impl<MISO, MOSI, SCK> Unpin for SPIMaster0<MISO, MOSI, SCK> where
MISO: Unpin,
MOSI: Unpin,
SCK: Unpin,
[src]
MISO: Unpin,
MOSI: Unpin,
SCK: Unpin,
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,
pub 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
type Output = T
Should always be Self
impl<W, S> Transfer<W> for S where
W: Clone,
S: Default<W>,
[src]
W: Clone,
S: Default<W>,
type Error = <S as FullDuplex<W>>::Error
Error type
pub fn transfer(
&mut self,
words: &'w mut [W]
) -> Result<&'w [W], <S as FullDuplex<W>>::Error>
[src]
&mut self,
words: &'w mut [W]
) -> Result<&'w [W], <S as FullDuplex<W>>::Error>
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.
pub 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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<W, S> Write<W> for S where
W: Clone,
S: Default<W>,
[src]
W: Clone,
S: Default<W>,
type Error = <S as FullDuplex<W>>::Error
Error type
pub fn write(&mut self, words: &[W]) -> Result<(), <S as FullDuplex<W>>::Error>
[src]
impl<W, S> WriteIter<W> for S where
W: Clone,
S: Default<W>,
[src]
W: Clone,
S: Default<W>,
type Error = <S as FullDuplex<W>>::Error
Error type
pub fn write_iter<WI>(
&mut self,
words: WI
) -> Result<(), <S as FullDuplex<W>>::Error> where
WI: IntoIterator<Item = W>,
[src]
&mut self,
words: WI
) -> Result<(), <S as FullDuplex<W>>::Error> where
WI: IntoIterator<Item = W>,