kernel::hil::i2c

Trait SMBusMaster

Source
pub trait SMBusMaster<'a>: I2CMaster<'a> {
    // Required methods
    fn smbus_write_read(
        &self,
        addr: u8,
        data: &'static mut [u8],
        write_len: usize,
        read_len: usize,
    ) -> Result<(), (Error, &'static mut [u8])>;
    fn smbus_write(
        &self,
        addr: u8,
        data: &'static mut [u8],
        len: usize,
    ) -> Result<(), (Error, &'static mut [u8])>;
    fn smbus_read(
        &self,
        addr: u8,
        buffer: &'static mut [u8],
        len: usize,
    ) -> Result<(), (Error, &'static mut [u8])>;
}
Expand description

Interface for an SMBus Master hardware driver. The device implementing this will also seperately implement I2CMaster.

Required Methods§

Source

fn smbus_write_read( &self, addr: u8, data: &'static mut [u8], write_len: usize, read_len: usize, ) -> Result<(), (Error, &'static mut [u8])>

Write data then read data via the I2C Master device in an SMBus compatible way.

This function will use the I2C master to write data to a device and then read data from the device in a SMBus compatible way. This will be a best effort attempt to match the SMBus specification based on what the hardware can support. This function is expected to make any hardware changes required to support SMBus and then revert those changes to support future I2C.

addr: The address of the device to write to data: The buffer to write the data from and read back to write_len: The length of the write operation read_len: The length of the read operation

Source

fn smbus_write( &self, addr: u8, data: &'static mut [u8], len: usize, ) -> Result<(), (Error, &'static mut [u8])>

Write data via the I2C Master device in an SMBus compatible way.

This function will use the I2C master to write data to a device in a SMBus compatible way. This will be a best effort attempt to match the SMBus specification based on what the hardware can support. This function is expected to make any hardware changes required to support SMBus and then revert those changes to support future I2C.

addr: The address of the device to write to data: The buffer to write the data from len: The length of the operation

Source

fn smbus_read( &self, addr: u8, buffer: &'static mut [u8], len: usize, ) -> Result<(), (Error, &'static mut [u8])>

Read data via the I2C Master device in an SMBus compatible way.

This function will use the I2C master to read data from a device in a SMBus compatible way. This will be a best effort attempt to match the SMBus specification based on what the hardware can support. This function is expected to make any hardware changes required to support SMBus and then revert those changes to support future I2C.

addr: The address of the device to read from buffer: The buffer to store the data to len: The length of the operation

Implementors§