opentitanlib::transport::ftdi::spi

Struct Spi

Source
pub struct Spi<T> { /* private fields */ }

Implementations§

Source§

impl<T: GpioPin> Spi<T>

Source

pub fn open( ftdi_interfaces: &Rc<HashMap<Interface, FtHal<Device>>>, cs: T, ) -> Result<Self>

Trait Implementations§

Source§

impl<T: GpioPin> Target for Spi<T>

Source§

fn supports_tpm_poll(&self) -> Result<bool>

Indicates whether Transfer::TpmPoll is supported.

Source§

fn get_transfer_mode(&self) -> Result<TransferMode>

Gets the current SPI transfer mode.
Source§

fn set_transfer_mode(&self, mode: TransferMode) -> Result<()>

Sets the current SPI transfer mode.
Source§

fn get_bits_per_word(&self) -> Result<u32>

Gets the current number of bits per word.
Source§

fn set_bits_per_word(&self, bits_per_word: u32) -> Result<()>

Sets the current number of bits per word.
Source§

fn get_max_speed(&self) -> Result<u32>

Gets the maximum allowed speed of the SPI bus.
Source§

fn set_max_speed(&self, frequency: u32) -> Result<()>

Sets the maximum allowed speed of the SPI bus.
Source§

fn supports_bidirectional_transfer(&self) -> Result<bool>

Indicates whether Transfer::Both() is supported.
Source§

fn set_pins( &self, _serial_clock: Option<&Rc<dyn GpioPin>>, _host_out_device_in: Option<&Rc<dyn GpioPin>>, _host_in_device_out: Option<&Rc<dyn GpioPin>>, _chip_select: Option<&Rc<dyn GpioPin>>, _gsc_ready: Option<&Rc<dyn GpioPin>>, ) -> Result<()>

Sets which pins should be used for SPI communication. None value means use the same pin as previously, or the implementation default if never before specified. This call is not supported by most backend transports, and ones that do support it may still have restrictions on which set of pins can be used in which roles.
Source§

fn get_max_transfer_count(&self) -> Result<usize>

Returns the maximum number of transfers allowed in a single transaction.
Source§

fn get_max_transfer_sizes(&self) -> Result<MaxSizes>

Maximum Read and Write data size for run_transaction().
Source§

fn run_transaction(&self, transaction: &mut [Transfer<'_, '_>]) -> Result<()>

Runs a SPI transaction composed from the slice of Transfer objects. Will assert the CS for the duration of the entire transactions.
Source§

fn assert_cs(self: Rc<Self>) -> Result<AssertChipSelect>

Assert the CS signal. Uses reference counting, will be deasserted when each and every returned AssertChipSelect object have gone out of scope.
Source§

fn set_voltage(&self, _voltage: Voltage) -> Result<()>

Source§

fn get_flashrom_programmer(&self) -> Result<String>

Returns "raiden_debug_spi:serial=XXX" or similar string usable for passing via -p argument to flashrom, in order for it to connect to this SPI port instance.
Source§

fn get_eeprom_max_transfer_sizes(&self) -> Result<MaxSizes>

Maximum payload size of Read and Write elements for run_eeprom_transactions().
Source§

fn run_eeprom_transactions( &self, transactions: &mut [Transaction<'_, '_>], ) -> Result<()>

Runs a number of EEPROM/FLASH protocol SPI transactions. Will assert and deassert CS for each transaction.

Auto Trait Implementations§

§

impl<T> Freeze for Spi<T>
where T: Freeze,

§

impl<T> !RefUnwindSafe for Spi<T>

§

impl<T> !Send for Spi<T>

§

impl<T> !Sync for Spi<T>

§

impl<T> Unpin for Spi<T>
where T: Unpin,

§

impl<T> !UnwindSafe for Spi<T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V