Struct I2c

Source
pub struct I2c { /* private fields */ }
Expand description

NuttX I2C Bus

Implementations§

Source§

impl I2c

NuttX Implementation of I2C Bus

Source

pub fn new(path: &str, frequency: u32) -> Result<Self, i32>

Create an I2C Bus from a Device Path (e.g. “/dev/i2c0”)

Trait Implementations§

Source§

impl Drop for I2c

NuttX Implementation of I2C Bus

Source§

fn drop(&mut self)

Close the I2C Bus

Source§

impl Read for I2c

NuttX Implementation of I2C Read

Source§

type Error = i32

Error Type

Source§

fn read(&mut self, _addr: u8, _buf: &mut [u8]) -> Result<(), Self::Error>

TODO: Read buf from I2C Port

Source§

impl Write for I2c

NuttX Implementation of I2C Write

Source§

type Error = i32

Error Type

Source§

fn write(&mut self, addr: u8, buf: &[u8]) -> Result<(), Self::Error>

Write buf to I2C Port. We assume this is a Write I2C Register operation, with Register ID at buf[0]. TODO: Handle other kinds of I2C operations

Source§

impl WriteRead for I2c

NuttX Implementation of I2C WriteRead

Source§

type Error = i32

Error Type

Source§

fn write_read( &mut self, addr: u8, wbuf: &[u8], rbuf: &mut [u8], ) -> Result<(), Self::Error>

Write wbuf to I2C Port and read rbuf from I2C Port. We assume this is a Read I2C Register operation, with Register ID at wbuf[0]. TODO: Handle other kinds of I2C operations

Auto Trait Implementations§

§

impl Freeze for I2c

§

impl RefUnwindSafe for I2c

§

impl Send for I2c

§

impl Sync for I2c

§

impl Unpin for I2c

§

impl UnwindSafe for I2c

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> 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<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<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

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

Source§

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.