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

Methods

impl SpidevOptions
[src]

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).

Finalize and build the SpidevOptions

Trait Implementations

impl Clone for SpidevOptions
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Auto Trait Implementations

impl Send for SpidevOptions

impl Sync for SpidevOptions