@@ -202,7 +202,7 @@ where
202202 ///
203203 /// The buffer must have a length of at most 255 bytes.
204204 pub fn read ( & mut self , rx_buffer : & mut [ u8 ] ) -> Result < ( ) , Error > {
205- start_read ( & * self . 0 , rx_buffer, rx_buffer . len ( ) ) ?;
205+ start_read ( & * self . 0 , rx_buffer) ?;
206206
207207 // Wait for transmission to end.
208208 while self . 0 . events_endrx . read ( ) . bits ( ) == 0 { }
@@ -240,7 +240,7 @@ where
240240 I : timer:: Instance ,
241241 {
242242 // Start the read.
243- start_read ( & self . 0 , rx_buffer, rx_buffer . len ( ) ) ?;
243+ start_read ( & self . 0 , rx_buffer) ?;
244244
245245 // Start the timeout timer.
246246 timer. start ( cycles) ;
@@ -363,11 +363,7 @@ fn stop_write(uarte: &uarte0::RegisterBlock) {
363363
364364/// Start a UARTE read transaction by setting the control
365365/// values and triggering a read task.
366- fn start_read (
367- uarte : & uarte0:: RegisterBlock ,
368- rx_buffer : & mut [ u8 ] ,
369- nbytes : usize ,
370- ) -> Result < ( ) , Error > {
366+ fn start_read ( uarte : & uarte0:: RegisterBlock , rx_buffer : & mut [ u8 ] ) -> Result < ( ) , Error > {
371367 if rx_buffer. len ( ) > EASY_DMA_SIZE {
372368 return Err ( Error :: RxBufferTooLong ) ;
373369 }
@@ -396,7 +392,7 @@ fn start_read(
396392 //
397393 // The MAXCNT field is at least 8 bits wide and accepts the full
398394 // range of values.
399- unsafe { w. maxcnt ( ) . bits ( nbytes . min ( rx_buffer. len ( ) ) as _ ) } ) ;
395+ unsafe { w. maxcnt ( ) . bits ( rx_buffer. len ( ) as _ ) } ) ;
400396
401397 // Start UARTE Receive transaction.
402398 uarte. tasks_startrx . write ( |w|
@@ -713,7 +709,7 @@ where
713709 }
714710 Ok ( self . rx_buf [ 0 ] )
715711 } else {
716- start_read ( & uarte, self . rx_buf , 1 ) ?;
712+ start_read ( & uarte, & mut self . rx_buf [ .. 1 ] ) ?;
717713 Err ( nb:: Error :: WouldBlock )
718714 }
719715 }
0 commit comments