Struct I2cMaster

Source
pub struct I2cMaster<PIO1, PIO2, I2C, PINS>
where PIO1: PinId, PIO2: PinId, I2C: I2c, PINS: I2cPins<PIO1, PIO2, I2C>,
{ /* private fields */ }
Expand description

I2C peripheral operating in master mode

Implementations§

Source§

impl<PIO1, PIO2, I2C, PINS> I2cMaster<PIO1, PIO2, I2C, PINS>
where PIO1: PinId, PIO2: PinId, I2C: I2c, PINS: I2cPins<PIO1, PIO2, I2C>,

Source

pub fn new<Speed: Into<Hertz>>(i2c: I2C, pins: PINS, speed: Speed) -> Self

Weird crashes happen when running system at 150Mhz PLL. Suggested use: 100khz or 400khz

Source

pub fn release(self) -> (I2C, PINS)

Trait Implementations§

Source§

impl<PIO1, PIO2, I2C, PINS> Read for I2cMaster<PIO1, PIO2, I2C, PINS>
where PIO1: PinId, PIO2: PinId, I2C: I2c, PINS: I2cPins<PIO1, PIO2, I2C>,

Source§

type Error = Error

Error type
Source§

fn read(&mut self, addr: u8, buffer: &mut [u8]) -> Result<()>

Reads enough bytes from slave with address to fill buffer Read more
Source§

impl<PIO1, PIO2, I2C, PINS> Write for I2cMaster<PIO1, PIO2, I2C, PINS>
where PIO1: PinId, PIO2: PinId, I2C: I2c, PINS: I2cPins<PIO1, PIO2, I2C>,

Source§

type Error = Error

Error type
Source§

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

Writes bytes to slave with address address Read more
Source§

impl<PIO1, PIO2, I2C, PINS> WriteRead for I2cMaster<PIO1, PIO2, I2C, PINS>
where PIO1: PinId, PIO2: PinId, I2C: I2c, PINS: I2cPins<PIO1, PIO2, I2C>,

Source§

type Error = Error

Error type
Source§

fn write_read( &mut self, addr: u8, bytes: &[u8], buffer: &mut [u8], ) -> Result<()>

Writes bytes to slave with address address and then reads enough bytes to fill buffer in a single transaction Read more

Auto Trait Implementations§

§

impl<PIO1, PIO2, I2C, PINS> Freeze for I2cMaster<PIO1, PIO2, I2C, PINS>
where I2C: Freeze, PINS: Freeze,

§

impl<PIO1, PIO2, I2C, PINS> RefUnwindSafe for I2cMaster<PIO1, PIO2, I2C, PINS>
where I2C: RefUnwindSafe, PINS: RefUnwindSafe, PIO1: RefUnwindSafe, PIO2: RefUnwindSafe,

§

impl<PIO1, PIO2, I2C, PINS> Send for I2cMaster<PIO1, PIO2, I2C, PINS>
where I2C: Send, PINS: Send, PIO1: Send, PIO2: Send,

§

impl<PIO1, PIO2, I2C, PINS> Sync for I2cMaster<PIO1, PIO2, I2C, PINS>
where I2C: Sync, PINS: Sync, PIO1: Sync, PIO2: Sync,

§

impl<PIO1, PIO2, I2C, PINS> Unpin for I2cMaster<PIO1, PIO2, I2C, PINS>
where I2C: Unpin, PINS: Unpin, PIO1: Unpin, PIO2: Unpin,

§

impl<PIO1, PIO2, I2C, PINS> UnwindSafe for I2cMaster<PIO1, PIO2, I2C, PINS>
where I2C: UnwindSafe, PINS: UnwindSafe, PIO1: UnwindSafe, PIO2: UnwindSafe,

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> Same for T

Source§

type Output = T

Should always be Self
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.