diff options
| author | xoviat <[email protected]> | 2023-06-19 21:18:46 -0500 |
|---|---|---|
| committer | xoviat <[email protected]> | 2023-06-19 21:18:46 -0500 |
| commit | 0d67ef795e4dfecef90690bce51f2820f77fc4bc (patch) | |
| tree | fa6b8a092652a9d0af9f67576b1b99063c3aa184 /tests/stm32 | |
| parent | 978e7b5e77f86dc82c393442702defa38b516f4b (diff) | |
| parent | 37a1e9f971214c11a614b06b230be27c688fff1d (diff) | |
Merge branch 'main' of https://github.com/embassy-rs/embassy into tl-mbox-2
Diffstat (limited to 'tests/stm32')
| -rw-r--r-- | tests/stm32/src/bin/rtc.rs | 6 | ||||
| -rw-r--r-- | tests/stm32/src/bin/usart_dma.rs | 29 |
2 files changed, 18 insertions, 17 deletions
diff --git a/tests/stm32/src/bin/rtc.rs b/tests/stm32/src/bin/rtc.rs index 32d35c42c..582df5753 100644 --- a/tests/stm32/src/bin/rtc.rs +++ b/tests/stm32/src/bin/rtc.rs | |||
| @@ -24,10 +24,8 @@ async fn main(_spawner: Spawner) { | |||
| 24 | 24 | ||
| 25 | info!("Starting LSI"); | 25 | info!("Starting LSI"); |
| 26 | 26 | ||
| 27 | unsafe { | 27 | pac::RCC.csr().modify(|w| w.set_lsion(true)); |
| 28 | pac::RCC.csr().modify(|w| w.set_lsion(true)); | 28 | while !pac::RCC.csr().read().lsirdy() {} |
| 29 | while !pac::RCC.csr().read().lsirdy() {} | ||
| 30 | } | ||
| 31 | 29 | ||
| 32 | info!("Started LSI"); | 30 | info!("Started LSI"); |
| 33 | 31 | ||
diff --git a/tests/stm32/src/bin/usart_dma.rs b/tests/stm32/src/bin/usart_dma.rs index 50dd2893e..c34d9574b 100644 --- a/tests/stm32/src/bin/usart_dma.rs +++ b/tests/stm32/src/bin/usart_dma.rs | |||
| @@ -69,24 +69,27 @@ async fn main(_spawner: Spawner) { | |||
| 69 | const LEN: usize = 128; | 69 | const LEN: usize = 128; |
| 70 | let mut tx_buf = [0; LEN]; | 70 | let mut tx_buf = [0; LEN]; |
| 71 | let mut rx_buf = [0; LEN]; | 71 | let mut rx_buf = [0; LEN]; |
| 72 | for i in 0..LEN { | ||
| 73 | tx_buf[i] = i as u8; | ||
| 74 | } | ||
| 75 | 72 | ||
| 76 | let (mut tx, mut rx) = usart.split(); | 73 | let (mut tx, mut rx) = usart.split(); |
| 77 | 74 | ||
| 78 | let tx_fut = async { | 75 | for n in 0..42 { |
| 79 | tx.write(&tx_buf).await.unwrap(); | 76 | for i in 0..LEN { |
| 80 | }; | 77 | tx_buf[i] = (i ^ n) as u8; |
| 81 | let rx_fut = async { | 78 | } |
| 82 | rx.read(&mut rx_buf).await.unwrap(); | 79 | |
| 83 | }; | 80 | let tx_fut = async { |
| 81 | tx.write(&tx_buf).await.unwrap(); | ||
| 82 | }; | ||
| 83 | let rx_fut = async { | ||
| 84 | rx.read(&mut rx_buf).await.unwrap(); | ||
| 85 | }; | ||
| 84 | 86 | ||
| 85 | // note: rx needs to be polled first, to workaround this bug: | 87 | // note: rx needs to be polled first, to workaround this bug: |
| 86 | // https://github.com/embassy-rs/embassy/issues/1426 | 88 | // https://github.com/embassy-rs/embassy/issues/1426 |
| 87 | join(rx_fut, tx_fut).await; | 89 | join(rx_fut, tx_fut).await; |
| 88 | 90 | ||
| 89 | assert_eq!(tx_buf, rx_buf); | 91 | assert_eq!(tx_buf, rx_buf); |
| 92 | } | ||
| 90 | 93 | ||
| 91 | info!("Test OK"); | 94 | info!("Test OK"); |
| 92 | cortex_m::asm::bkpt(); | 95 | cortex_m::asm::bkpt(); |
