@@ -8,17 +8,21 @@ use stm32f4xx_hal::dma::{DmaFlag, PeripheralToMemory, Stream1};
8
8
use core:: cell:: RefCell ;
9
9
use cortex_m:: interrupt:: Mutex ;
10
10
use cortex_m_rt:: entry;
11
- use stm32f4xx_hal:: pac:: { interrupt, DMA1 } ;
12
- use stm32f4xx_hal:: pac:: Interrupt ;
13
- use stm32f4xx_hal:: { dma:: { StreamsTuple , Transfer } , pac, prelude:: * , serial} ;
14
11
use stm32f4xx_hal:: dma:: config:: DmaConfig ;
15
- use stm32f4xx_hal:: uart:: { Config , Rx , Serial } ;
12
+ use stm32f4xx_hal:: pac:: Interrupt ;
13
+ use stm32f4xx_hal:: pac:: { interrupt, DMA1 } ;
16
14
use stm32f4xx_hal:: uart:: config:: StopBits ;
15
+ use stm32f4xx_hal:: uart:: { Config , Rx , Serial } ;
16
+ use stm32f4xx_hal:: {
17
+ dma:: { StreamsTuple , Transfer } ,
18
+ pac,
19
+ prelude:: * ,
20
+ serial,
21
+ } ;
17
22
18
23
// uart buffer size
19
24
const UART_BUFFER_SIZE : usize = 128 ;
20
25
21
-
22
26
// Simple ring buffer
23
27
pub struct Buffer {
24
28
buffer : [ u8 ; UART_BUFFER_SIZE ] ,
@@ -144,7 +148,7 @@ fn main() -> ! {
144
148
. dma ( serial:: config:: DmaConfig :: Rx ) ,
145
149
& clocks,
146
150
)
147
- . unwrap ( ) ;
151
+ . unwrap ( ) ;
148
152
149
153
// Note! It is better to use memory pools, such as heapless::pool::Pool. But it not work with embedded_dma yet.
150
154
// See CHANGELOG of unreleased main branch and issue https://github.com/japaric/heapless/pull/362 for details.
@@ -179,7 +183,6 @@ fn main() -> ! {
179
183
180
184
cortex_m:: interrupt:: free ( |cs| * G_TRANSFER . borrow ( cs) . borrow_mut ( ) = Some ( rx_transfer) ) ;
181
185
182
-
183
186
// Enable interrupt
184
187
unsafe {
185
188
cortex_m:: peripheral:: NVIC :: unmask ( Interrupt :: USART3 ) ;
0 commit comments