Skip to content

Commit

Permalink
Fix conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
lulf committed Jan 11, 2021
1 parent bed63a9 commit 23775a6
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions nrf-hal-common/src/uarte.rs
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ where
{
_marker: core::marker::PhantomData<T>,
tx_buf: &'a mut [u8],
written: u16,
written: usize,
}

/// Interface for the RX part of a UART instance that can be used independently of the TX part.
Expand Down Expand Up @@ -590,9 +590,8 @@ pub mod serial {
return Err(nb::Error::WouldBlock);
}

let written = self.written as usize;
if written < self.tx_buf.len() {
self.tx_buf[written] = b;
if self.written < self.tx_buf.len() {
self.tx_buf[self.written] = b;
self.written += 1;
Ok(())
} else {
Expand Down Expand Up @@ -664,7 +663,7 @@ pub mod serial {
uarte
.txd
.maxcnt
.write(|w| unsafe { w.maxcnt().bits(self.written) });
.write(|w| unsafe { w.maxcnt().bits(self.written as _) });

// Start UARTE Transmit transaction.
// `1` is a valid value to write to task registers.
Expand Down

0 comments on commit 23775a6

Please sign in to comment.