File tree Expand file tree Collapse file tree 3 files changed +10
-128
lines changed Expand file tree Collapse file tree 3 files changed +10
-128
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ extern crate stm32l4xx_hal as hal;
18
18
// #[macro_use(block)]
19
19
// extern crate nb;
20
20
21
- use crate :: hal:: dma:: { CircReadDma , Half } ;
21
+ use crate :: hal:: dma:: CircReadDma ;
22
22
use crate :: hal:: prelude:: * ;
23
23
use crate :: hal:: serial:: { Config , Serial } ;
24
24
use crate :: rt:: ExceptionFrame ;
@@ -66,23 +66,14 @@ fn main() -> ! {
66
66
67
67
block ! ( tx. write( sent) ) . ok ( ) ;
68
68
69
- let buf = singleton ! ( : [ [ u8 ; 8 ] ; 2 ] = [ [ 0 ; 8 ] ; 2 ] ) . unwrap ( ) ;
69
+ let buf = singleton ! ( : [ u8 ; 8 ] = [ 0 ; 8 ] ) . unwrap ( ) ;
70
70
71
71
let mut circ_buffer = rx. with_dma ( channels. 5 ) . circ_read ( buf) ;
72
72
73
- for _ in 0 .. 2 {
74
- while circ_buffer. readable_half ( ) . unwrap ( ) != Half :: First { }
73
+ let mut rx_buf = [ 0 ; 8 ] ;
74
+ let rx_len = circ_buffer. read ( & mut rx_buf ) . unwrap ( ) ;
75
75
76
- let _first_half = circ_buffer. peek ( |_buf, half| half) . unwrap ( ) ;
77
-
78
- // asm::bkpt();
79
-
80
- while circ_buffer. readable_half ( ) . unwrap ( ) != Half :: Second { }
81
-
82
- // asm::bkpt();
83
-
84
- let _second_half = circ_buffer. peek ( |_buf, half| half) . unwrap ( ) ;
85
- }
76
+ let _received = & rx_buf[ ..rx_len] ;
86
77
87
78
// let received = block!(rx.read()).unwrap();
88
79
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ extern crate stm32l4xx_hal as hal;
18
18
// #[macro_use(block)]
19
19
// extern crate nb;
20
20
21
- use crate :: hal:: dma:: { CircReadDma , Half } ;
21
+ use crate :: hal:: dma:: CircReadDma ;
22
22
use crate :: hal:: prelude:: * ;
23
23
use crate :: hal:: serial:: { Config , Serial } ;
24
24
use crate :: rt:: ExceptionFrame ;
@@ -65,23 +65,14 @@ fn main() -> ! {
65
65
66
66
block ! ( tx. write( sent) ) . ok ( ) ;
67
67
68
- let buf = singleton ! ( : [ [ u8 ; 8 ] ; 2 ] = [ [ 0 ; 8 ] ; 2 ] ) . unwrap ( ) ;
68
+ let buf = singleton ! ( : [ u8 ; 8 ] = [ 0 ; 8 ] ) . unwrap ( ) ;
69
69
70
70
let mut circ_buffer = rx. with_dma ( channels. 6 ) . circ_read ( buf) ;
71
71
72
- for _ in 0 .. 2 {
73
- while circ_buffer. readable_half ( ) . unwrap ( ) != Half :: First { }
72
+ let mut rx_buf = [ 0 ; 8 ] ;
73
+ let rx_len = circ_buffer. read ( & mut rx_buf ) . unwrap ( ) ;
74
74
75
- let _first_half = circ_buffer. peek ( |_buf, half| half) . unwrap ( ) ;
76
-
77
- // asm::bkpt();
78
-
79
- while circ_buffer. readable_half ( ) . unwrap ( ) != Half :: Second { }
80
-
81
- // asm::bkpt();
82
-
83
- let _second_half = circ_buffer. peek ( |_buf, half| half) . unwrap ( ) ;
84
- }
75
+ let _received = & rx_buf[ ..rx_len] ;
85
76
86
77
// let received = block!(rx.read()).unwrap();
87
78
You can’t perform that action at this time.
0 commit comments