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>,
}Expand description
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>Implementations
Create a new, empty set of options
The number of bits in each SPI transfer word
The value zero signifies eight bits.
The maximum SPI transfer speed, in Hz
The controller can’t necessarily assign that specific clock speed.
The 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.
Set 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).
Trait Implementations
Returns the “default value” for a type. Read more
This method tests for self and other values to be equal, and is used
by ==. Read more
This method tests for !=.
Auto Trait Implementations
impl RefUnwindSafe for SpidevOptions
impl Send for SpidevOptions
impl Sync for SpidevOptions
impl Unpin for SpidevOptions
impl UnwindSafe for SpidevOptions
Blanket Implementations
Mutably borrows from an owned value. Read more