pub struct Twis<T>(_)
where
T: Instance;
Expand description
Interface to a TWIS instance.
Implementations
sourceimpl<T> Twis<T> where
T: Instance,
impl<T> Twis<T> where
T: Instance,
pub fn new(twis: T, pins: Pins, address0: u8) -> Twis<T>
sourcepub fn set_address1(&self, address1: u8) -> &Twis<T>
pub fn set_address1(&self, address1: u8) -> &Twis<T>
Configures secondary I2C address.
sourcepub fn set_orc(&self, orc: u8) -> &Twis<T>
pub fn set_orc(&self, orc: u8) -> &Twis<T>
Sets the over-read character (character sent on over-read of the transmit buffer).
sourcepub fn enable_interrupt(&self, event: TwiEvent) -> &Twis<T>
pub fn enable_interrupt(&self, event: TwiEvent) -> &Twis<T>
Enables interrupt for specified command.
sourcepub fn disable_interrupt(&self, event: TwiEvent) -> &Twis<T>
pub fn disable_interrupt(&self, event: TwiEvent) -> &Twis<T>
Disables interrupt for specified command.
sourcepub fn reset_events(&self)
pub fn reset_events(&self)
Resets read and write events.
sourcepub fn reset_event(&self, event: TwiEvent)
pub fn reset_event(&self, event: TwiEvent)
Resets specified event.
sourcepub fn address_match(&self) -> u8
pub fn address_match(&self) -> u8
Returns matched address for latest command.
sourcepub fn is_event_triggered(&self, event: TwiEvent) -> bool
pub fn is_event_triggered(&self, event: TwiEvent) -> bool
Checks if specified event has been triggered.
sourcepub fn is_overflow(&self) -> bool
pub fn is_overflow(&self) -> bool
Checks if RX buffer overflow was detected.
sourcepub fn is_data_nack(&self) -> bool
pub fn is_data_nack(&self) -> bool
Checks if NACK was sent after receiving a data byte.
sourcepub fn is_overread(&self) -> bool
pub fn is_overread(&self) -> bool
Checks if TX buffer over-read was detected and ORC was clocked out.
sourcepub fn event_read(&self) -> &Reg<EVENTS_READ_SPEC>
pub fn event_read(&self) -> &Reg<EVENTS_READ_SPEC>
Returns reference to READ
event endpoint for PPI.
sourcepub fn event_write(&self) -> &Reg<EVENTS_WRITE_SPEC>
pub fn event_write(&self) -> &Reg<EVENTS_WRITE_SPEC>
Returns reference to WRITE
event endpoint for PPI.
sourcepub fn event_stopped(&self) -> &Reg<EVENTS_STOPPED_SPEC>
pub fn event_stopped(&self) -> &Reg<EVENTS_STOPPED_SPEC>
Returns reference to STOPPED
event endpoint for PPI.
sourcepub fn event_error(&self) -> &Reg<EVENTS_ERROR_SPEC>
pub fn event_error(&self) -> &Reg<EVENTS_ERROR_SPEC>
Returns reference to ERROR
event endpoint for PPI.
sourcepub fn event_rx_started(&self) -> &Reg<EVENTS_RXSTARTED_SPEC>
pub fn event_rx_started(&self) -> &Reg<EVENTS_RXSTARTED_SPEC>
Returns reference to RXSTARTED
event endpoint for PPI.
sourcepub fn event_tx_started(&self) -> &Reg<EVENTS_TXSTARTED_SPEC>
pub fn event_tx_started(&self) -> &Reg<EVENTS_TXSTARTED_SPEC>
Returns reference to TXSTARTED
event endpoint for PPI.
sourcepub fn task_stop(&self) -> &Reg<TASKS_STOP_SPEC>
pub fn task_stop(&self) -> &Reg<TASKS_STOP_SPEC>
Returns reference to STOP
task endpoint for PPI.
sourcepub fn task_suspend(&self) -> &Reg<TASKS_SUSPEND_SPEC>
pub fn task_suspend(&self) -> &Reg<TASKS_SUSPEND_SPEC>
Returns reference to SUSPEND
task endpoint for PPI.
sourcepub fn task_resume(&self) -> &Reg<TASKS_RESUME_SPEC>
pub fn task_resume(&self) -> &Reg<TASKS_RESUME_SPEC>
Returns reference to RESUME
task endpoint for PPI.
sourcepub fn task_prepare_rx(&self) -> &Reg<TASKS_PREPARERX_SPEC>
pub fn task_prepare_rx(&self) -> &Reg<TASKS_PREPARERX_SPEC>
Returns reference to PREPARERX
task endpoint for PPI.
sourcepub fn task_prepare_tx(&self) -> &Reg<TASKS_PREPARETX_SPEC>
pub fn task_prepare_tx(&self) -> &Reg<TASKS_PREPARETX_SPEC>
Returns reference to PREPARETX
task endpoint for PPI.
sourcepub fn tx_blocking(&mut self, buffer: &[u8]) -> Result<(), Error>
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.
sourcepub fn rx_blocking(&mut self, buffer: &mut [u8]) -> Result<(), Error>
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.
sourcepub fn rx<W, B>(self, buffer: B) -> Result<Transfer<T, B>, Error> where
B: 'static + WriteBuffer<Word = W>,
pub fn rx<W, B>(self, buffer: B) -> Result<Transfer<T, B>, Error> where
B: 'static + WriteBuffer<Word = W>,
Receives data into the given buffer
. Buffer must be located in RAM.
Returns a value that represents the in-progress DMA transfer.
Auto Trait Implementations
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> CheckedAs for T
impl<T> CheckedAs for T
sourcefn checked_as<Dst>(self) -> Option<Dst> where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst> where
T: CheckedCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> CheckedCastFrom<Src> for Dst where
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dst where
Src: CheckedCast<Dst>,
sourcefn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Casts the value.
sourceimpl<Src, Dst> LosslessTryInto<Dst> for Src where
Dst: LosslessTryFrom<Src>,
impl<Src, Dst> LosslessTryInto<Dst> for Src where
Dst: LosslessTryFrom<Src>,
sourcefn lossless_try_into(self) -> Option<Dst>
fn lossless_try_into(self) -> Option<Dst>
Performs the conversion.
sourceimpl<Src, Dst> LossyInto<Dst> for Src where
Dst: LossyFrom<Src>,
impl<Src, Dst> LossyInto<Dst> for Src where
Dst: LossyFrom<Src>,
sourcefn lossy_into(self) -> Dst
fn lossy_into(self) -> Dst
Performs the conversion.
sourceimpl<T> OverflowingAs for T
impl<T> OverflowingAs for T
sourcefn overflowing_as<Dst>(self) -> (Dst, bool) where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool) where
T: OverflowingCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> OverflowingCastFrom<Src> for Dst where
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dst where
Src: OverflowingCast<Dst>,
sourcefn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
OverflowingCasts the value.
sourceimpl<T> SaturatingAs for T
impl<T> SaturatingAs for T
sourcefn saturating_as<Dst>(self) -> Dst where
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dst where
T: SaturatingCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> SaturatingCastFrom<Src> for Dst where
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dst where
Src: SaturatingCast<Dst>,
sourcefn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Casts the value.
sourceimpl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
sourcefn unwrapped_as<Dst>(self) -> Dst where
T: UnwrappedCast<Dst>,
fn unwrapped_as<Dst>(self) -> Dst where
T: UnwrappedCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> UnwrappedCastFrom<Src> for Dst where
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dst where
Src: UnwrappedCast<Dst>,
sourcefn unwrapped_cast_from(src: Src) -> Dst
fn unwrapped_cast_from(src: Src) -> Dst
UnwrappedCasts the value.
sourceimpl<T> WrappingAs for T
impl<T> WrappingAs for T
sourcefn wrapping_as<Dst>(self) -> Dst where
T: WrappingCast<Dst>,
fn wrapping_as<Dst>(self) -> Dst where
T: WrappingCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> WrappingCastFrom<Src> for Dst where
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dst where
Src: WrappingCast<Dst>,
sourcefn wrapping_cast_from(src: Src) -> Dst
fn wrapping_cast_from(src: Src) -> Dst
WrappingCasts the value.