Skip to content

Commit

Permalink
Merge pull request #838 from jannic/fix_write
Browse files Browse the repository at this point in the history
Let UART write return some bytes were written
  • Loading branch information
thejpster authored Aug 22, 2024
2 parents 32a29e0 + 7a1a4fd commit 4e2f01c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions rp2040-hal/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ The Minimum-Supported Rust Version (MSRV) for the next release is 1.77
- Support for *binary info*, which is metadata that `picotool` can read from your binary.
- Bump MSRV to 1.77, because *binary info* examples need C-Strings.

### Fixed

- Let UART embedded\_io::Write::write return some bytes were written.

## [0.10.0] - 2024-03-10

### Added
Expand Down
4 changes: 2 additions & 2 deletions rp2040-hal/src/uart/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,8 @@ impl<D: UartDevice, P: ValidUartPinout<D>> embedded_io::ErrorType for Writer<D,

impl<D: UartDevice, P: ValidUartPinout<D>> embedded_io::Write for Writer<D, P> {
fn write(&mut self, buf: &[u8]) -> Result<usize, Self::Error> {
self.write_full_blocking(buf);
Ok(buf.len())
let remaining = nb::block!(write_raw(&self.device, buf)).unwrap(); // Infallible
Ok(buf.len() - remaining.len())
}
fn flush(&mut self) -> Result<(), Self::Error> {
nb::block!(transmit_flushed(&self.device)).unwrap(); // Infallible
Expand Down

0 comments on commit 4e2f01c

Please sign in to comment.