aboutsummaryrefslogtreecommitdiff
path: root/embassy-traits/src
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-12-19 07:50:33 +0000
committerGitHub <[email protected]>2021-12-19 07:50:33 +0000
commitfcb43caa36bcf2fb62ddd1c334c46bd6bc876a9e (patch)
tree34999dbc3d65d52367c46b0ac75aefc4b035cf5d /embassy-traits/src
parentad2f4694070104f8815563a0008141eec29c06cd (diff)
parente1545066e57fb072a59b1a93bf4c9bcbc3854cc2 (diff)
Merge #550
550: Some API documentation fixes in traits r=Dirbaio a=lulf Co-authored-by: Ulf Lilleengen <[email protected]>
Diffstat (limited to 'embassy-traits/src')
-rw-r--r--embassy-traits/src/i2c.rs8
-rw-r--r--embassy-traits/src/spi.rs2
-rw-r--r--embassy-traits/src/uart.rs2
3 files changed, 8 insertions, 4 deletions
diff --git a/embassy-traits/src/i2c.rs b/embassy-traits/src/i2c.rs
index 0fdf50a12..4e2e8e2f0 100644
--- a/embassy-traits/src/i2c.rs
+++ b/embassy-traits/src/i2c.rs
@@ -21,7 +21,7 @@
21//! For demonstration purposes the address mode parameter has been omitted in this example. 21//! For demonstration purposes the address mode parameter has been omitted in this example.
22//! 22//!
23//! ``` 23//! ```
24//! # use embedded_hal::blocking::i2c::WriteRead; 24//! # use embassy_traits::i2c::I2c;
25//! const ADDR: u8 = 0x15; 25//! const ADDR: u8 = 0x15;
26//! # const TEMP_REGISTER: u8 = 0x1; 26//! # const TEMP_REGISTER: u8 = 0x1;
27//! pub struct TemperatureSensorDriver<I2C> { 27//! pub struct TemperatureSensorDriver<I2C> {
@@ -30,7 +30,7 @@
30//! 30//!
31//! impl<I2C, E> TemperatureSensorDriver<I2C> 31//! impl<I2C, E> TemperatureSensorDriver<I2C>
32//! where 32//! where
33//! I2C: WriteRead<Error = E>, 33//! I2C: I2c<Error = E>,
34//! { 34//! {
35//! pub fn read_temperature(&mut self) -> Result<u8, E> { 35//! pub fn read_temperature(&mut self) -> Result<u8, E> {
36//! let mut temp = [0]; 36//! let mut temp = [0];
@@ -45,7 +45,7 @@
45//! ### Device driver compatible only with 10-bit addresses 45//! ### Device driver compatible only with 10-bit addresses
46//! 46//!
47//! ``` 47//! ```
48//! # use embedded_hal::blocking::i2c::{TenBitAddress, WriteRead}; 48//! # use embassy_traits::i2c::{TenBitAddress, I2c};
49//! const ADDR: u16 = 0x158; 49//! const ADDR: u16 = 0x158;
50//! # const TEMP_REGISTER: u8 = 0x1; 50//! # const TEMP_REGISTER: u8 = 0x1;
51//! pub struct TemperatureSensorDriver<I2C> { 51//! pub struct TemperatureSensorDriver<I2C> {
@@ -54,7 +54,7 @@
54//! 54//!
55//! impl<I2C, E> TemperatureSensorDriver<I2C> 55//! impl<I2C, E> TemperatureSensorDriver<I2C>
56//! where 56//! where
57//! I2C: WriteRead<TenBitAddress, Error = E>, 57//! I2C: I2c<TenBitAddress, Error = E>,
58//! { 58//! {
59//! pub fn read_temperature(&mut self) -> Result<u8, E> { 59//! pub fn read_temperature(&mut self) -> Result<u8, E> {
60//! let mut temp = [0]; 60//! let mut temp = [0];
diff --git a/embassy-traits/src/spi.rs b/embassy-traits/src/spi.rs
index 14f79b059..6beb442ba 100644
--- a/embassy-traits/src/spi.rs
+++ b/embassy-traits/src/spi.rs
@@ -46,6 +46,7 @@ pub trait Write<Word>: Spi<Word> {
46 Self: 'a, 46 Self: 'a,
47 Word: 'a; 47 Word: 'a;
48 48
49 /// Writes `data` to the peripheral, ignoring all the incoming words.
49 fn write<'a>(&'a mut self, data: &'a [Word]) -> Self::WriteFuture<'a>; 50 fn write<'a>(&'a mut self, data: &'a [Word]) -> Self::WriteFuture<'a>;
50} 51}
51 52
@@ -55,5 +56,6 @@ pub trait Read<Word>: Write<Word> {
55 Self: 'a, 56 Self: 'a,
56 Word: 'a; 57 Word: 'a;
57 58
59 /// Reads words into `data` from the peripheral.
58 fn read<'a>(&'a mut self, data: &'a mut [Word]) -> Self::ReadFuture<'a>; 60 fn read<'a>(&'a mut self, data: &'a mut [Word]) -> Self::ReadFuture<'a>;
59} 61}
diff --git a/embassy-traits/src/uart.rs b/embassy-traits/src/uart.rs
index 755aee6d3..4984bc89c 100644
--- a/embassy-traits/src/uart.rs
+++ b/embassy-traits/src/uart.rs
@@ -12,6 +12,7 @@ pub trait Read {
12 where 12 where
13 Self: 'a; 13 Self: 'a;
14 14
15 /// Receive into the buffer until the buffer is full.
15 fn read<'a>(&'a mut self, buf: &'a mut [u8]) -> Self::ReadFuture<'a>; 16 fn read<'a>(&'a mut self, buf: &'a mut [u8]) -> Self::ReadFuture<'a>;
16} 17}
17 18
@@ -30,5 +31,6 @@ pub trait Write {
30 where 31 where
31 Self: 'a; 32 Self: 'a;
32 33
34 /// Write all bytes in `buf`.
33 fn write<'a>(&'a mut self, buf: &'a [u8]) -> Self::WriteFuture<'a>; 35 fn write<'a>(&'a mut self, buf: &'a [u8]) -> Self::WriteFuture<'a>;
34} 36}