File tree Expand file tree Collapse file tree 5 files changed +26
-17
lines changed
Expand file tree Collapse file tree 5 files changed +26
-17
lines changed Original file line number Diff line number Diff line change @@ -179,10 +179,10 @@ impl Timer {
179179
180180 /// Start the timer with the given microsecond duration.
181181 pub fn start ( & mut self , microseconds : u32 ) {
182- self . 0 . cc ( 0 ) . clear_events ( ) ;
182+ self . 0 . stop ( ) ;
183+ self . 0 . clear ( ) ;
183184 self . 0 . cc ( 0 ) . write ( microseconds) ;
184- self . 0 . task_clear ( ) ;
185- self . 0 . task_start ( ) ;
185+ self . 0 . start ( ) ;
186186 }
187187
188188 /// If the timer has finished, resets it and returns true.
Original file line number Diff line number Diff line change @@ -454,11 +454,15 @@ impl<'d> Radio<'d> {
454454 // Check if either receive is done or timeout occured
455455 loop {
456456 match recv. is_done ( ) {
457- Ok ( crc) => break Ok ( crc) ,
458- Err ( err) => match err {
459- nb:: Error :: Other ( crc) => break Err ( Error :: Crc ( crc) ) ,
460- nb:: Error :: WouldBlock => ( ) ,
461- } ,
457+ Ok ( crc) => {
458+ break Ok ( crc) ;
459+ }
460+ Err ( nb:: Error :: Other ( crc) ) => {
461+ break Err ( Error :: Crc ( crc) ) ;
462+ }
463+ Err ( nb:: Error :: WouldBlock ) => {
464+ // do nothing
465+ }
462466 }
463467
464468 if timer. reset_if_finished ( ) {
Original file line number Diff line number Diff line change @@ -151,10 +151,10 @@ impl Timer {
151151
152152 /// Start the timer with the given microsecond duration.
153153 pub fn start ( & mut self , microseconds : u32 ) {
154- self . 0 . cc ( 0 ) . clear_events ( ) ;
154+ self . 0 . stop ( ) ;
155+ self . 0 . clear ( ) ;
155156 self . 0 . cc ( 0 ) . write ( microseconds) ;
156- self . 0 . task_clear ( ) ;
157- self . 0 . task_start ( ) ;
157+ self . 0 . start ( ) ;
158158 }
159159
160160 /// If the timer has finished, resets it and returns true.
Original file line number Diff line number Diff line change @@ -454,11 +454,15 @@ impl<'d> Radio<'d> {
454454 // Check if either receive is done or timeout occured
455455 loop {
456456 match recv. is_done ( ) {
457- Ok ( crc) => break Ok ( crc) ,
458- Err ( err) => match err {
459- nb:: Error :: Other ( crc) => break Err ( Error :: Crc ( crc) ) ,
460- nb:: Error :: WouldBlock => ( ) ,
461- } ,
457+ Ok ( crc) => {
458+ break Ok ( crc) ;
459+ }
460+ Err ( nb:: Error :: Other ( crc) ) => {
461+ break Err ( Error :: Crc ( crc) ) ;
462+ }
463+ Err ( nb:: Error :: WouldBlock ) => {
464+ // do nothing
465+ }
462466 }
463467
464468 if timer. reset_if_finished ( ) {
Original file line number Diff line number Diff line change @@ -9,7 +9,8 @@ description = "Solutions for the nRF52 HAL exercises"
99[dependencies ]
1010cortex-m = {version = " 0.7.7" , features = [" critical-section-single-core" ]}
1111cortex-m-rt = " 0.7.5"
12- dk = { path = " ../boards/dk-solution" , features = [" radio" ] }
12+ dk = { path = " ../boards/dk" , features = [" radio" ] }
13+ # dk = { path = "../boards/dk-solution", features = ["radio"] }
1314heapless = " 0.9"
1415defmt = " 1"
1516defmt-rtt = " 1.1"
You can’t perform that action at this time.
0 commit comments