#[non_exhaustive]pub struct Config {
pub frequency: Generic<u32>,
pub mode: Mode,
}
Expand description
Configuration struct for Spi
providing all
communication-related / parameters.
The default configruation can be obtain by:
let config = Config::default();
Spi
defaults to spi::MODE_0
and a frequency of 1 MHz
.
let config = Config::default();
Create a configuration by using default
in combination with the
builder methods. The following snippet shows creating a configuration
for 19,200 Baud, 8N1 by deriving it from the default value:
let config = Config::default().baudrate(19_200.Bd());
assert!(config.baudrate == 19_200.Bd());
assert!(config.parity == Parity::None);
assert!(config.stopbits == StopBits::STOP1);
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.frequency: Generic<u32>
Operating frequency of the SPI peripheral.
mode: Mode
Operation Mode as defined by the [embedded-hal
]
Implementations§
Trait Implementations§
impl Copy for Config
impl Eq for Config
impl StructuralPartialEq for Config
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more