Skip to content

Commit 23775a6

Browse files
committed
Fix conversion
1 parent bed63a9 commit 23775a6

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

nrf-hal-common/src/uarte.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ where
455455
{
456456
_marker: core::marker::PhantomData<T>,
457457
tx_buf: &'a mut [u8],
458-
written: u16,
458+
written: usize,
459459
}
460460

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

593-
let written = self.written as usize;
594-
if written < self.tx_buf.len() {
595-
self.tx_buf[written] = b;
593+
if self.written < self.tx_buf.len() {
594+
self.tx_buf[self.written] = b;
596595
self.written += 1;
597596
Ok(())
598597
} else {
@@ -664,7 +663,7 @@ pub mod serial {
664663
uarte
665664
.txd
666665
.maxcnt
667-
.write(|w| unsafe { w.maxcnt().bits(self.written) });
666+
.write(|w| unsafe { w.maxcnt().bits(self.written as _) });
668667

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

0 commit comments

Comments
 (0)