Struct spidev::SpidevOptions [−][src]
pub struct SpidevOptions {
pub bits_per_word: Option<u8>,
pub max_speed_hz: Option<u32>,
pub lsb_first: Option<bool>,
pub spi_mode: Option<SpiModeFlags>,
}Options that control defaults for communication on a device
Individual settings may be overridden via parameters that
are specified as part of any individual SpiTransfer when
using transfer or transfer_multiple.
Options that are not configured with one of the builder
functions will not be modified in the kernel when
configure is called.
Fields
bits_per_word: Option<u8>
max_speed_hz: Option<u32>
lsb_first: Option<bool>
spi_mode: Option<SpiModeFlags>
Methods
impl SpidevOptions[src]
impl SpidevOptionspub fn new() -> SpidevOptions[src]
pub fn new() -> SpidevOptionsCreate a new, empty set of options
pub fn bits_per_word(&mut self, bits_per_word: u8) -> &mut Self[src]
pub fn bits_per_word(&mut self, bits_per_word: u8) -> &mut SelfThe number of bits in each SPI transfer word
The value zero signifies eight bits.
pub fn max_speed_hz(&mut self, max_speed_hz: u32) -> &mut Self[src]
pub fn max_speed_hz(&mut self, max_speed_hz: u32) -> &mut SelfThe maximum SPI transfer speed, in Hz
The controller can't necessarily assign that specific clock speed.
pub fn lsb_first(&mut self, lsb_first: bool) -> &mut Self[src]
pub fn lsb_first(&mut self, lsb_first: bool) -> &mut SelfThe bit justification used to transfer SPI words
Zero indicates MSB-first; other values indicate the less common LSB-first encoding. In both cases the specified value is right-justified in each word, so that unused (TX) or undefined (RX) bits are in the MSBs.
pub fn mode(&mut self, mode: SpiModeFlags) -> &mut Self[src]
pub fn mode(&mut self, mode: SpiModeFlags) -> &mut SelfSet the SPI Transfer Mode
Use the constants SPI_MODE_0..SPI_MODE_3; or if you prefer you can combine SPI_CPOL (clock polarity, idle high iff this is set) or SPI_CPHA (clock phase, sample on trailing edge iff this is set) flags.
Note that this API will always prefer to use SPI_IOC_WR_MODE rathern than the 32-bit one to target the greatest number of kernels. SPI_IOC_WR_MODE32 is only present in 3.15+ kernels. SPI_IOC_WR_MODE32 will be used iff bits higher than those in 8bits are provided (e.g. Dual/Quad Tx/Rx).
pub fn build(&self) -> Self[src]
pub fn build(&self) -> SelfFinalize and build the SpidevOptions
Trait Implementations
impl Clone for SpidevOptions[src]
impl Clone for SpidevOptionsfn clone(&self) -> SpidevOptions[src]
fn clone(&self) -> SpidevOptionsReturns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)Performs copy-assignment from source. Read more
Auto Trait Implementations
impl Send for SpidevOptions
impl Send for SpidevOptionsimpl Sync for SpidevOptions
impl Sync for SpidevOptions