Struct atsamd_hal::sercom::v2::spi::Config [−][src]
pub struct Config<P, M = Master, Z = DefaultSize> where
P: ValidPads,
M: OpMode,
Z: Size, { /* fields omitted */ }
Expand description
A configurable SPI peripheral in its disabled state
See the module-level documentation for more details on declaring
and instantiating Pads
types.
Implementations
Create a new Config
in the default configuration
This function will enable the corresponding APB clock, reset the
Sercom
peripheral, and return a Config
in the default
configuration. The default OpMode
is Master
, while the default
Size
is an
EightBit
CharSize
for SAMD11 and SAMD21 chips or a
Length
of U1
for SAMx5x chips. Note that Config
takes ownership of both the
PAC Sercom
struct as well as the Pads
.
Users must configure GCLK manually. The freq
parameter represents the
GCLK frequency for this Sercom
instance.
Obtain a reference to the PAC SERCOM
struct
Directly accessing the SERCOM
could break the invariants of the
type-level tracking in this module, so it is unsafe.
Change the CharSize
using the builder pattern
Get the SPI mode (clock polarity & phase)
Set the SPI mode (clock polarity & phase)
Set the SPI mode (clock polarity & phase) using the builder pattern
Get the bit order of transmission (MSB/LSB first)
This only affects the order of bits within each byte. Bytes are always transferred in little endian order from the 32-bit DATA register.
Set the bit order of transmission (MSB/LSB first) using the builder pattern
This only affects the order of bits within each byte. Bytes are always transferred in little endian order from the 32-bit DATA register.
Set the bit order of transmission (MSB/LSB first) using the builder pattern
This only affects the order of bits within each byte. Bytes are always transferred in little endian order from the 32-bit DATA register.
Get the baud rate
The returned baud rate may not exactly match what was set.
Set the baud rate
This function will calculate the best BAUD register setting based on the stored GCLK frequency and desired baud rate. The maximum baud rate is half the GCLK frequency. The minimum baud rate is the GCLK frequency / 512. Values outside this range will saturate at the extremes.
Set the baud rate using the builder API
This function will calculate the best BAUD register setting based on the stored GCLK frequency and desired baud rate. The maximum baud rate is half the GCLK frequency. The minimum baud rate is the GCLK frequency / 512. Values outside this range will saturate at the extremes.
Read the enabled state of the immediate buffer overflow notification
If set to true, an Error::Overflow
will be issued as soon as an
overflow occurs. Otherwise, it will not be issued until its place within
the data stream.
Enable or disable the immediate buffer overflow notification
If set to true, an Error::Overflow
will be issued as soon as an
overflow occurs. Otherwise, it will not be issued until its place within
the data stream.
Enable or disable the immediate buffer overflow notification using the builder API
If set to true, an Error::Overflow
will be issued as soon as an
overflow occurs. Otherwise, it will not be issued until its place within
the data stream.
Read the enable state of run in standby mode
Enable or disable run in standby mode
Enable or disable run in standby mode using the builder API
Enable the SPI peripheral
SPI transactions are not possible until the peripheral is enabled.
This function is limited to ValidConfig
s.
Trait Implementations
Get a shared reference to the underlying Config
struct
This can be used to call the various get_*
functions on Config
Performs the conversion.