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

Finalize and build the SpidevOptions

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

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

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.