Struct nrf52810_hal::twis::Twis

source ·
pub struct Twis<T>(/* private fields */)
where
    T: Instance;
Expand description

Interface to a TWIS instance.

Implementations§

source§

impl<T> Twis<T>
where T: Instance,

source

pub fn new(twis: T, pins: Pins, address0: u8) -> Twis<T>

source

pub fn set_address1(&self, address1: u8) -> &Twis<T>

Configures secondary I2C address.

source

pub fn set_orc(&self, orc: u8) -> &Twis<T>

Sets the over-read character (character sent on over-read of the transmit buffer).

source

pub fn enable(&self) -> &Twis<T>

Enables the TWIS instance.

source

pub fn disable(&self) -> &Twis<T>

Disables the TWIS instance.

source

pub fn stop(&self) -> &Twis<T>

Stops the TWI transaction and waits until it has stopped.

source

pub fn enable_interrupt(&self, event: TwiEvent) -> &Twis<T>

Enables interrupt for specified command.

source

pub fn disable_interrupt(&self, event: TwiEvent) -> &Twis<T>

Disables interrupt for specified command.

source

pub fn reset_events(&self)

Resets read and write events.

source

pub fn reset_event(&self, event: TwiEvent)

Resets specified event.

source

pub fn address_match(&self) -> u8

Returns matched address for latest command.

source

pub fn is_event_triggered(&self, event: TwiEvent) -> bool

Checks if specified event has been triggered.

source

pub fn is_done(&self) -> bool

Checks if the TWI transaction is done.

source

pub fn amount(&self) -> u32

Returns number of bytes received in last granted transaction.

source

pub fn is_overflow(&self) -> bool

Checks if RX buffer overflow was detected.

source

pub fn is_data_nack(&self) -> bool

Checks if NACK was sent after receiving a data byte.

source

pub fn is_overread(&self) -> bool

Checks if TX buffer over-read was detected and ORC was clocked out.

source

pub fn event_read(&self) -> &Reg<EVENTS_READ_SPEC>

Returns reference to READ event endpoint for PPI.

source

pub fn event_write(&self) -> &Reg<EVENTS_WRITE_SPEC>

Returns reference to WRITE event endpoint for PPI.

source

pub fn event_stopped(&self) -> &Reg<EVENTS_STOPPED_SPEC>

Returns reference to STOPPED event endpoint for PPI.

source

pub fn event_error(&self) -> &Reg<EVENTS_ERROR_SPEC>

Returns reference to ERROR event endpoint for PPI.

source

pub fn event_rx_started(&self) -> &Reg<EVENTS_RXSTARTED_SPEC>

Returns reference to RXSTARTED event endpoint for PPI.

source

pub fn event_tx_started(&self) -> &Reg<EVENTS_TXSTARTED_SPEC>

Returns reference to TXSTARTED event endpoint for PPI.

source

pub fn task_stop(&self) -> &Reg<TASKS_STOP_SPEC>

Returns reference to STOP task endpoint for PPI.

source

pub fn task_suspend(&self) -> &Reg<TASKS_SUSPEND_SPEC>

Returns reference to SUSPEND task endpoint for PPI.

source

pub fn task_resume(&self) -> &Reg<TASKS_RESUME_SPEC>

Returns reference to RESUME task endpoint for PPI.

source

pub fn task_prepare_rx(&self) -> &Reg<TASKS_PREPARERX_SPEC>

Returns reference to PREPARERX task endpoint for PPI.

source

pub fn task_prepare_tx(&self) -> &Reg<TASKS_PREPARETX_SPEC>

Returns reference to PREPARETX task endpoint for PPI.

source

pub fn tx_blocking(&mut self, buffer: &[u8]) -> Result<(), Error>

Write to an I2C controller.

The buffer must reside in RAM and have a length of at most 255 bytes on the nRF52832 and at most 65535 bytes on the nRF52840.

source

pub fn rx_blocking(&mut self, buffer: &mut [u8]) -> Result<(), Error>

Read from an I2C controller.

The buffer must have a length of at most 255 bytes on the nRF52832 and at most 65535 bytes on the nRF52840.

source

pub fn rx<W, B>(self, buffer: B) -> Result<Transfer<T, B>, Error>
where B: WriteBuffer<Word = W> + 'static,

Receives data into the given buffer. Buffer must be located in RAM. Returns a value that represents the in-progress DMA transfer.

source

pub fn tx<W, B>(self, buffer: B) -> Result<Transfer<T, B>, Error>
where B: ReadBuffer<Word = W> + 'static,

Transmits data from the given buffer. Buffer must be located in RAM. Returns a value that represents the in-progress DMA transfer.

source

pub fn free(self) -> (T, Pins)

Return the raw interface to the underlying TWIS peripheral.

Auto Trait Implementations§

§

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

§

impl<T> RefUnwindSafe for Twis<T>
where T: RefUnwindSafe,

§

impl<T> Send for Twis<T>
where T: Send,

§

impl<T> Sync for Twis<T>
where T: Sync,

§

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

§

impl<T> UnwindSafe for Twis<T>
where T: UnwindSafe,

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> Az for T

source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
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<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

source§

fn cast_from(src: Src) -> Dst

Casts the value.
source§

impl<T> CheckedAs for T

source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
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<Src, Dst> LosslessTryInto<Dst> for Src
where Dst: LosslessTryFrom<Src>,

source§

fn lossless_try_into(self) -> Option<Dst>

Performs the conversion.
source§

impl<Src, Dst> LossyInto<Dst> for Src
where Dst: LossyFrom<Src>,

source§

fn lossy_into(self) -> Dst

Performs the conversion.
source§

impl<T> OverflowingAs for T

source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> SaturatingAs for T

source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
source§

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

§

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>,

§

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.
source§

impl<T> UnwrappedAs for T

source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
source§

impl<T> WrappingAs for T

source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.