Struct nrf52832_hal::twis::Twis
source · [−]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.