Some API documentation fixes in traits
This commit is contained in:
parent
ad2f469407
commit
e1545066e5
@ -21,7 +21,7 @@
|
||||
//! For demonstration purposes the address mode parameter has been omitted in this example.
|
||||
//!
|
||||
//! ```
|
||||
//! # use embedded_hal::blocking::i2c::WriteRead;
|
||||
//! # use embassy_traits::i2c::I2c;
|
||||
//! const ADDR: u8 = 0x15;
|
||||
//! # const TEMP_REGISTER: u8 = 0x1;
|
||||
//! pub struct TemperatureSensorDriver<I2C> {
|
||||
@ -30,7 +30,7 @@
|
||||
//!
|
||||
//! impl<I2C, E> TemperatureSensorDriver<I2C>
|
||||
//! where
|
||||
//! I2C: WriteRead<Error = E>,
|
||||
//! I2C: I2c<Error = E>,
|
||||
//! {
|
||||
//! pub fn read_temperature(&mut self) -> Result<u8, E> {
|
||||
//! let mut temp = [0];
|
||||
@ -45,7 +45,7 @@
|
||||
//! ### Device driver compatible only with 10-bit addresses
|
||||
//!
|
||||
//! ```
|
||||
//! # use embedded_hal::blocking::i2c::{TenBitAddress, WriteRead};
|
||||
//! # use embassy_traits::i2c::{TenBitAddress, I2c};
|
||||
//! const ADDR: u16 = 0x158;
|
||||
//! # const TEMP_REGISTER: u8 = 0x1;
|
||||
//! pub struct TemperatureSensorDriver<I2C> {
|
||||
@ -54,7 +54,7 @@
|
||||
//!
|
||||
//! impl<I2C, E> TemperatureSensorDriver<I2C>
|
||||
//! where
|
||||
//! I2C: WriteRead<TenBitAddress, Error = E>,
|
||||
//! I2C: I2c<TenBitAddress, Error = E>,
|
||||
//! {
|
||||
//! pub fn read_temperature(&mut self) -> Result<u8, E> {
|
||||
//! let mut temp = [0];
|
||||
|
@ -46,6 +46,7 @@ pub trait Write<Word>: Spi<Word> {
|
||||
Self: 'a,
|
||||
Word: 'a;
|
||||
|
||||
/// Writes `data` to the peripheral, ignoring all the incoming words.
|
||||
fn write<'a>(&'a mut self, data: &'a [Word]) -> Self::WriteFuture<'a>;
|
||||
}
|
||||
|
||||
@ -55,5 +56,6 @@ pub trait Read<Word>: Write<Word> {
|
||||
Self: 'a,
|
||||
Word: 'a;
|
||||
|
||||
/// Reads words into `data` from the peripheral.
|
||||
fn read<'a>(&'a mut self, data: &'a mut [Word]) -> Self::ReadFuture<'a>;
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ pub trait Read {
|
||||
where
|
||||
Self: 'a;
|
||||
|
||||
/// Receive into the buffer until the buffer is full.
|
||||
fn read<'a>(&'a mut self, buf: &'a mut [u8]) -> Self::ReadFuture<'a>;
|
||||
}
|
||||
|
||||
@ -30,5 +31,6 @@ pub trait Write {
|
||||
where
|
||||
Self: 'a;
|
||||
|
||||
/// Write all bytes in `buf`.
|
||||
fn write<'a>(&'a mut self, buf: &'a [u8]) -> Self::WriteFuture<'a>;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user