Skip to content

Commit

Permalink
Rename serial read_all to read_exact
Browse files Browse the repository at this point in the history
This better reflects what that function is doing, namely reading as many
bytes as there is space in the given buffer.
  • Loading branch information
teskje committed Apr 7, 2020
1 parent 1ff03a4 commit 542cc2a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions examples/serial_dma.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ fn main() -> ! {

// start separate DMAs for sending and receiving the data
let sending = tx.write_all(Pin::new(tx_buf), tx_channel);
let receiving = rx.read_all(Pin::new(rx_buf), rx_channel);
let receiving = rx.read_exact(Pin::new(rx_buf), rx_channel);

// block until all data was transmitted and received
let (mut tx_buf, tx_channel, tx) = sending.wait();
Expand All @@ -56,7 +56,7 @@ fn main() -> ! {
tx_buf.copy_from_slice(b"hi again!");

let sending = tx.write_all(tx_buf, tx_channel);
let receiving = rx.read_all(rx_buf, rx_channel);
let receiving = rx.read_exact(rx_buf, rx_channel);

let (tx_buf, ..) = sending.wait();
let (rx_buf, ..) = receiving.wait();
Expand Down
2 changes: 1 addition & 1 deletion src/serial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ macro_rules! hal {
#[cfg(feature = "stm32f303")]
impl Rx<$USARTX> {
/// Fill the buffer with received data using DMA.
pub fn read_all<B, C>(
pub fn read_exact<B, C>(
self,
mut buffer: Pin<B>,
mut channel: C
Expand Down

0 comments on commit 542cc2a

Please sign in to comment.