pub struct Twim<'d, T: Instance> { /* private fields */ }Expand description
TWI driver.
Implementations§
Source§impl<'d, T: Instance> Twim<'d, T>
 
impl<'d, T: Instance> Twim<'d, T>
Sourcepub fn new(
    twim: impl Peripheral<P = T> + 'd,
    _irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd,
    sda: impl Peripheral<P = impl GpioPin> + 'd,
    scl: impl Peripheral<P = impl GpioPin> + 'd,
    config: Config,
) -> Self
 
pub fn new( twim: impl Peripheral<P = T> + 'd, _irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd, sda: impl Peripheral<P = impl GpioPin> + 'd, scl: impl Peripheral<P = impl GpioPin> + 'd, config: Config, ) -> Self
Create a new TWI driver.
Sourcepub fn blocking_transaction(
    &mut self,
    address: u8,
    operations: &mut [Operation<'_>],
) -> Result<(), Error>
 
pub fn blocking_transaction( &mut self, address: u8, operations: &mut [Operation<'_>], ) -> Result<(), Error>
Execute the provided operations on the I2C bus.
Each buffer must have a length of at most 255 bytes on the nRF52832 and at most 65535 bytes on the nRF52840.
Consecutive Operation::Reads are not supported due to hardware
limitations.
An Operation::Write following an Operation::Read must have a
non-empty buffer.
Sourcepub fn blocking_transaction_from_ram(
    &mut self,
    address: u8,
    operations: &mut [Operation<'_>],
) -> Result<(), Error>
 
pub fn blocking_transaction_from_ram( &mut self, address: u8, operations: &mut [Operation<'_>], ) -> Result<(), Error>
Same as blocking_transaction but will fail instead of copying data into RAM. Consult the module level documentation to learn more.
Sourcepub fn blocking_transaction_timeout(
    &mut self,
    address: u8,
    operations: &mut [Operation<'_>],
    timeout: Duration,
) -> Result<(), Error>
 
pub fn blocking_transaction_timeout( &mut self, address: u8, operations: &mut [Operation<'_>], timeout: Duration, ) -> Result<(), Error>
Execute the provided operations on the I2C bus with timeout.
See [blocking_transaction].
Sourcepub fn blocking_transaction_from_ram_timeout(
    &mut self,
    address: u8,
    operations: &mut [Operation<'_>],
    timeout: Duration,
) -> Result<(), Error>
 
pub fn blocking_transaction_from_ram_timeout( &mut self, address: u8, operations: &mut [Operation<'_>], timeout: Duration, ) -> Result<(), Error>
Same as blocking_transaction_timeout but will fail instead of copying data into RAM. Consult the module level documentation to learn more.
Sourcepub async fn transaction(
    &mut self,
    address: u8,
    operations: &mut [Operation<'_>],
) -> Result<(), Error>
 
pub async fn transaction( &mut self, address: u8, operations: &mut [Operation<'_>], ) -> Result<(), Error>
Execute the provided operations on the I2C bus.
Each buffer must have a length of at most 255 bytes on the nRF52832 and at most 65535 bytes on the nRF52840.
Consecutive Operation::Reads are not supported due to hardware
limitations.
An Operation::Write following an Operation::Read must have a
non-empty buffer.
Sourcepub async fn transaction_from_ram(
    &mut self,
    address: u8,
    operations: &mut [Operation<'_>],
) -> Result<(), Error>
 
pub async fn transaction_from_ram( &mut self, address: u8, operations: &mut [Operation<'_>], ) -> Result<(), Error>
Same as transaction but will fail instead of copying data into RAM. Consult the module level documentation to learn more.
Sourcepub fn blocking_write(
    &mut self,
    address: u8,
    buffer: &[u8],
) -> Result<(), Error>
 
pub fn blocking_write( &mut self, address: u8, buffer: &[u8], ) -> Result<(), Error>
Write to an I2C slave.
The buffer must have a length of at most 255 bytes on the nRF52832 and at most 65535 bytes on the nRF52840.
Sourcepub fn blocking_write_from_ram(
    &mut self,
    address: u8,
    buffer: &[u8],
) -> Result<(), Error>
 
pub fn blocking_write_from_ram( &mut self, address: u8, buffer: &[u8], ) -> Result<(), Error>
Same as blocking_write but will fail instead of copying data into RAM. Consult the module level documentation to learn more.
Sourcepub fn blocking_read(
    &mut self,
    address: u8,
    buffer: &mut [u8],
) -> Result<(), Error>
 
pub fn blocking_read( &mut self, address: u8, buffer: &mut [u8], ) -> Result<(), Error>
Read from an I2C slave.
The buffer must have a length of at most 255 bytes on the nRF52832 and at most 65535 bytes on the nRF52840.
Sourcepub fn blocking_write_read(
    &mut self,
    address: u8,
    wr_buffer: &[u8],
    rd_buffer: &mut [u8],
) -> Result<(), Error>
 
pub fn blocking_write_read( &mut self, address: u8, wr_buffer: &[u8], rd_buffer: &mut [u8], ) -> Result<(), Error>
Write data to an I2C slave, then read data from the slave without triggering a stop condition between the two.
The buffers must have a length of at most 255 bytes on the nRF52832 and at most 65535 bytes on the nRF52840.
Sourcepub fn blocking_write_read_from_ram(
    &mut self,
    address: u8,
    wr_buffer: &[u8],
    rd_buffer: &mut [u8],
) -> Result<(), Error>
 
pub fn blocking_write_read_from_ram( &mut self, address: u8, wr_buffer: &[u8], rd_buffer: &mut [u8], ) -> Result<(), Error>
Same as blocking_write_read but will fail instead of copying data into RAM. Consult the module level documentation to learn more.
Sourcepub fn blocking_write_timeout(
    &mut self,
    address: u8,
    buffer: &[u8],
    timeout: Duration,
) -> Result<(), Error>
 
pub fn blocking_write_timeout( &mut self, address: u8, buffer: &[u8], timeout: Duration, ) -> Result<(), Error>
Write to an I2C slave with timeout.
See [blocking_write].
Sourcepub fn blocking_write_from_ram_timeout(
    &mut self,
    address: u8,
    buffer: &[u8],
    timeout: Duration,
) -> Result<(), Error>
 
pub fn blocking_write_from_ram_timeout( &mut self, address: u8, buffer: &[u8], timeout: Duration, ) -> Result<(), Error>
Same as blocking_write but will fail instead of copying data into RAM. Consult the module level documentation to learn more.
Sourcepub fn blocking_read_timeout(
    &mut self,
    address: u8,
    buffer: &mut [u8],
    timeout: Duration,
) -> Result<(), Error>
 
pub fn blocking_read_timeout( &mut self, address: u8, buffer: &mut [u8], timeout: Duration, ) -> Result<(), Error>
Read from an I2C slave.
The buffer must have a length of at most 255 bytes on the nRF52832 and at most 65535 bytes on the nRF52840.
Sourcepub fn blocking_write_read_timeout(
    &mut self,
    address: u8,
    wr_buffer: &[u8],
    rd_buffer: &mut [u8],
    timeout: Duration,
) -> Result<(), Error>
 
pub fn blocking_write_read_timeout( &mut self, address: u8, wr_buffer: &[u8], rd_buffer: &mut [u8], timeout: Duration, ) -> Result<(), Error>
Write data to an I2C slave, then read data from the slave without triggering a stop condition between the two.
The buffers must have a length of at most 255 bytes on the nRF52832 and at most 65535 bytes on the nRF52840.
Sourcepub fn blocking_write_read_from_ram_timeout(
    &mut self,
    address: u8,
    wr_buffer: &[u8],
    rd_buffer: &mut [u8],
    timeout: Duration,
) -> Result<(), Error>
 
pub fn blocking_write_read_from_ram_timeout( &mut self, address: u8, wr_buffer: &[u8], rd_buffer: &mut [u8], timeout: Duration, ) -> Result<(), Error>
Same as blocking_write_read but will fail instead of copying data into RAM. Consult the module level documentation to learn more.
Sourcepub async fn read(
    &mut self,
    address: u8,
    buffer: &mut [u8],
) -> Result<(), Error>
 
pub async fn read( &mut self, address: u8, buffer: &mut [u8], ) -> Result<(), Error>
Read from an I2C slave.
The buffer must have a length of at most 255 bytes on the nRF52832 and at most 65535 bytes on the nRF52840.
Sourcepub async fn write(&mut self, address: u8, buffer: &[u8]) -> Result<(), Error>
 
pub async fn write(&mut self, address: u8, buffer: &[u8]) -> Result<(), Error>
Write to an I2C slave.
The buffer must have a length of at most 255 bytes on the nRF52832 and at most 65535 bytes on the nRF52840.
Sourcepub async fn write_from_ram(
    &mut self,
    address: u8,
    buffer: &[u8],
) -> Result<(), Error>
 
pub async fn write_from_ram( &mut self, address: u8, buffer: &[u8], ) -> Result<(), Error>
Same as write but will fail instead of copying data into RAM. Consult the module level documentation to learn more.
Sourcepub async fn write_read(
    &mut self,
    address: u8,
    wr_buffer: &[u8],
    rd_buffer: &mut [u8],
) -> Result<(), Error>
 
pub async fn write_read( &mut self, address: u8, wr_buffer: &[u8], rd_buffer: &mut [u8], ) -> Result<(), Error>
Write data to an I2C slave, then read data from the slave without triggering a stop condition between the two.
The buffers must have a length of at most 255 bytes on the nRF52832 and at most 65535 bytes on the nRF52840.
Sourcepub async fn write_read_from_ram(
    &mut self,
    address: u8,
    wr_buffer: &[u8],
    rd_buffer: &mut [u8],
) -> Result<(), Error>
 
pub async fn write_read_from_ram( &mut self, address: u8, wr_buffer: &[u8], rd_buffer: &mut [u8], ) -> Result<(), Error>
Same as write_read but will fail instead of copying data into RAM. Consult the module level documentation to learn more.
Trait Implementations§
Source§impl<'d, T: Instance> I2c for Twim<'d, T>
 
impl<'d, T: Instance> I2c for Twim<'d, T>
Source§fn transaction(
    &mut self,
    address: u8,
    operations: &mut [Operation<'_>],
) -> Result<(), Self::Error>
 
fn transaction( &mut self, address: u8, operations: &mut [Operation<'_>], ) -> Result<(), Self::Error>
Source§impl<'d, T: Instance> I2c for Twim<'d, T>
 
impl<'d, T: Instance> I2c for Twim<'d, T>
Source§async fn transaction(
    &mut self,
    address: u8,
    operations: &mut [Operation<'_>],
) -> Result<(), Self::Error>
 
async fn transaction( &mut self, address: u8, operations: &mut [Operation<'_>], ) -> Result<(), Self::Error>
Source§impl<'d, T: Instance> SetConfig for Twim<'d, T>
 
impl<'d, T: Instance> SetConfig for Twim<'d, T>
Source§type ConfigError = ()
 
type ConfigError = ()
set_config fails.