diff options
| author | Mathias <[email protected]> | 2022-10-27 07:12:34 +0200 |
|---|---|---|
| committer | Mathias <[email protected]> | 2022-10-27 07:12:34 +0200 |
| commit | c871fe0848e50c8682b8a8d9fe8da31ca9185592 (patch) | |
| tree | e24f9edc23385080968d4b427aed3eddb4bd2f21 /tests | |
| parent | 3c6c382465131c6f76567f976198b77e327df4b2 (diff) | |
| parent | 61560e740dea1b4c7ca036dafd66c834a1ff92e2 (diff) | |
Rebase on master
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/rp/Cargo.toml | 4 | ||||
| -rw-r--r-- | tests/stm32/Cargo.toml | 2 | ||||
| -rw-r--r-- | tests/stm32/src/bin/usart.rs | 17 | ||||
| -rw-r--r-- | tests/stm32/src/bin/usart_dma.rs | 48 |
4 files changed, 52 insertions, 19 deletions
diff --git a/tests/rp/Cargo.toml b/tests/rp/Cargo.toml index 48c88e85b..069b7fb8c 100644 --- a/tests/rp/Cargo.toml +++ b/tests/rp/Cargo.toml | |||
| @@ -18,10 +18,10 @@ cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] } | |||
| 18 | cortex-m-rt = "0.7.0" | 18 | cortex-m-rt = "0.7.0" |
| 19 | embedded-hal = "0.2.6" | 19 | embedded-hal = "0.2.6" |
| 20 | embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.9" } | 20 | embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.9" } |
| 21 | embedded-hal-async = { version = "=0.1.0-alpha.2" } | 21 | embedded-hal-async = { version = "=0.1.0-alpha.3" } |
| 22 | panic-probe = { version = "0.3.0", features = ["print-defmt"] } | 22 | panic-probe = { version = "0.3.0", features = ["print-defmt"] } |
| 23 | futures = { version = "0.3.17", default-features = false, features = ["async-await"] } | 23 | futures = { version = "0.3.17", default-features = false, features = ["async-await"] } |
| 24 | embedded-io = { version = "0.3.0", features = ["async"] } | 24 | embedded-io = { version = "0.3.1", features = ["async"] } |
| 25 | embedded-storage = { version = "0.3" } | 25 | embedded-storage = { version = "0.3" } |
| 26 | 26 | ||
| 27 | [profile.dev] | 27 | [profile.dev] |
diff --git a/tests/stm32/Cargo.toml b/tests/stm32/Cargo.toml index bebbf557e..602c1fb57 100644 --- a/tests/stm32/Cargo.toml +++ b/tests/stm32/Cargo.toml | |||
| @@ -26,7 +26,7 @@ cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] } | |||
| 26 | cortex-m-rt = "0.7.0" | 26 | cortex-m-rt = "0.7.0" |
| 27 | embedded-hal = "0.2.6" | 27 | embedded-hal = "0.2.6" |
| 28 | embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.9" } | 28 | embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.9" } |
| 29 | embedded-hal-async = { version = "=0.1.0-alpha.2" } | 29 | embedded-hal-async = { version = "=0.1.0-alpha.3" } |
| 30 | panic-probe = { version = "0.3.0", features = ["print-defmt"] } | 30 | panic-probe = { version = "0.3.0", features = ["print-defmt"] } |
| 31 | 31 | ||
| 32 | [profile.dev] | 32 | [profile.dev] |
diff --git a/tests/stm32/src/bin/usart.rs b/tests/stm32/src/bin/usart.rs index 7673bfe6d..af55867f2 100644 --- a/tests/stm32/src/bin/usart.rs +++ b/tests/stm32/src/bin/usart.rs | |||
| @@ -7,6 +7,7 @@ mod example_common; | |||
| 7 | use defmt::assert_eq; | 7 | use defmt::assert_eq; |
| 8 | use embassy_executor::Spawner; | 8 | use embassy_executor::Spawner; |
| 9 | use embassy_stm32::dma::NoDma; | 9 | use embassy_stm32::dma::NoDma; |
| 10 | use embassy_stm32::interrupt; | ||
| 10 | use embassy_stm32::usart::{Config, Uart}; | 11 | use embassy_stm32::usart::{Config, Uart}; |
| 11 | use example_common::*; | 12 | use example_common::*; |
| 12 | 13 | ||
| @@ -18,22 +19,22 @@ async fn main(_spawner: Spawner) { | |||
| 18 | // Arduino pins D0 and D1 | 19 | // Arduino pins D0 and D1 |
| 19 | // They're connected together with a 1K resistor. | 20 | // They're connected together with a 1K resistor. |
| 20 | #[cfg(feature = "stm32f103c8")] | 21 | #[cfg(feature = "stm32f103c8")] |
| 21 | let (tx, rx, usart) = (p.PA9, p.PA10, p.USART1); | 22 | let (tx, rx, usart, irq) = (p.PA9, p.PA10, p.USART1, interrupt::take!(USART1)); |
| 22 | #[cfg(feature = "stm32g491re")] | 23 | #[cfg(feature = "stm32g491re")] |
| 23 | let (tx, rx, usart) = (p.PC4, p.PC5, p.USART1); | 24 | let (tx, rx, usart, irq) = (p.PC4, p.PC5, p.USART1, interrupt::take!(USART1)); |
| 24 | #[cfg(feature = "stm32g071rb")] | 25 | #[cfg(feature = "stm32g071rb")] |
| 25 | let (tx, rx, usart) = (p.PC4, p.PC5, p.USART1); | 26 | let (tx, rx, usart, irq) = (p.PC4, p.PC5, p.USART1, interrupt::take!(USART1)); |
| 26 | #[cfg(feature = "stm32f429zi")] | 27 | #[cfg(feature = "stm32f429zi")] |
| 27 | let (tx, rx, usart) = (p.PG14, p.PG9, p.USART6); | 28 | let (tx, rx, usart, irq) = (p.PG14, p.PG9, p.USART6, interrupt::take!(USART6)); |
| 28 | #[cfg(feature = "stm32wb55rg")] | 29 | #[cfg(feature = "stm32wb55rg")] |
| 29 | let (tx, rx, usart) = (p.PA2, p.PA3, p.LPUART1); | 30 | let (tx, rx, usart, irq) = (p.PA2, p.PA3, p.LPUART1, interrupt::take!(LPUART1)); |
| 30 | #[cfg(feature = "stm32h755zi")] | 31 | #[cfg(feature = "stm32h755zi")] |
| 31 | let (tx, rx, usart) = (p.PB6, p.PB7, p.USART1); | 32 | let (tx, rx, usart, irq) = (p.PB6, p.PB7, p.USART1, interrupt::take!(USART1)); |
| 32 | #[cfg(feature = "stm32u585ai")] | 33 | #[cfg(feature = "stm32u585ai")] |
| 33 | let (tx, rx, usart) = (p.PD8, p.PD9, p.USART3); | 34 | let (tx, rx, usart, irq) = (p.PD8, p.PD9, p.USART3, interrupt::take!(USART3)); |
| 34 | 35 | ||
| 35 | let config = Config::default(); | 36 | let config = Config::default(); |
| 36 | let mut usart = Uart::new(usart, rx, tx, NoDma, NoDma, config); | 37 | let mut usart = Uart::new(usart, rx, tx, irq, NoDma, NoDma, config); |
| 37 | 38 | ||
| 38 | // We can't send too many bytes, they have to fit in the FIFO. | 39 | // We can't send too many bytes, they have to fit in the FIFO. |
| 39 | // This is because we aren't sending+receiving at the same time. | 40 | // This is because we aren't sending+receiving at the same time. |
diff --git a/tests/stm32/src/bin/usart_dma.rs b/tests/stm32/src/bin/usart_dma.rs index e0389446f..d12605a9a 100644 --- a/tests/stm32/src/bin/usart_dma.rs +++ b/tests/stm32/src/bin/usart_dma.rs | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | mod example_common; | 6 | mod example_common; |
| 7 | use defmt::assert_eq; | 7 | use defmt::assert_eq; |
| 8 | use embassy_executor::Spawner; | 8 | use embassy_executor::Spawner; |
| 9 | use embassy_stm32::interrupt; | ||
| 9 | use embassy_stm32::usart::{Config, Uart}; | 10 | use embassy_stm32::usart::{Config, Uart}; |
| 10 | use example_common::*; | 11 | use example_common::*; |
| 11 | 12 | ||
| @@ -17,22 +18,53 @@ async fn main(_spawner: Spawner) { | |||
| 17 | // Arduino pins D0 and D1 | 18 | // Arduino pins D0 and D1 |
| 18 | // They're connected together with a 1K resistor. | 19 | // They're connected together with a 1K resistor. |
| 19 | #[cfg(feature = "stm32f103c8")] | 20 | #[cfg(feature = "stm32f103c8")] |
| 20 | let (tx, rx, usart, tx_dma, rx_dma) = (p.PA9, p.PA10, p.USART1, p.DMA1_CH4, p.DMA1_CH5); | 21 | let (tx, rx, usart, irq, tx_dma, rx_dma) = ( |
| 22 | p.PA9, | ||
| 23 | p.PA10, | ||
| 24 | p.USART1, | ||
| 25 | interrupt::take!(USART1), | ||
| 26 | p.DMA1_CH4, | ||
| 27 | p.DMA1_CH5, | ||
| 28 | ); | ||
| 21 | #[cfg(feature = "stm32g491re")] | 29 | #[cfg(feature = "stm32g491re")] |
| 22 | let (tx, rx, usart, tx_dma, rx_dma) = (p.PC4, p.PC5, p.USART1, p.DMA1_CH1, p.DMA1_CH2); | 30 | let (tx, rx, usart, irq, tx_dma, rx_dma) = |
| 31 | (p.PC4, p.PC5, p.USART1, interrupt::take!(USART1), p.DMA1_CH1, p.DMA1_CH2); | ||
| 23 | #[cfg(feature = "stm32g071rb")] | 32 | #[cfg(feature = "stm32g071rb")] |
| 24 | let (tx, rx, usart, tx_dma, rx_dma) = (p.PC4, p.PC5, p.USART1, p.DMA1_CH1, p.DMA1_CH2); | 33 | let (tx, rx, usart, irq, tx_dma, rx_dma) = |
| 34 | (p.PC4, p.PC5, p.USART1, interrupt::take!(USART1), p.DMA1_CH1, p.DMA1_CH2); | ||
| 25 | #[cfg(feature = "stm32f429zi")] | 35 | #[cfg(feature = "stm32f429zi")] |
| 26 | let (tx, rx, usart, tx_dma, rx_dma) = (p.PG14, p.PG9, p.USART6, p.DMA2_CH6, p.DMA2_CH1); | 36 | let (tx, rx, usart, irq, tx_dma, rx_dma) = ( |
| 37 | p.PG14, | ||
| 38 | p.PG9, | ||
| 39 | p.USART6, | ||
| 40 | interrupt::take!(USART6), | ||
| 41 | p.DMA2_CH6, | ||
| 42 | p.DMA2_CH1, | ||
| 43 | ); | ||
| 27 | #[cfg(feature = "stm32wb55rg")] | 44 | #[cfg(feature = "stm32wb55rg")] |
| 28 | let (tx, rx, usart, tx_dma, rx_dma) = (p.PA2, p.PA3, p.LPUART1, p.DMA1_CH1, p.DMA1_CH2); | 45 | let (tx, rx, usart, irq, tx_dma, rx_dma) = ( |
| 46 | p.PA2, | ||
| 47 | p.PA3, | ||
| 48 | p.LPUART1, | ||
| 49 | interrupt::take!(LPUART1), | ||
| 50 | p.DMA1_CH1, | ||
| 51 | p.DMA1_CH2, | ||
| 52 | ); | ||
| 29 | #[cfg(feature = "stm32h755zi")] | 53 | #[cfg(feature = "stm32h755zi")] |
| 30 | let (tx, rx, usart, tx_dma, rx_dma) = (p.PB6, p.PB7, p.USART1, p.DMA1_CH0, p.DMA1_CH1); | 54 | let (tx, rx, usart, irq, tx_dma, rx_dma) = |
| 55 | (p.PB6, p.PB7, p.USART1, interrupt::take!(USART1), p.DMA1_CH0, p.DMA1_CH1); | ||
| 31 | #[cfg(feature = "stm32u585ai")] | 56 | #[cfg(feature = "stm32u585ai")] |
| 32 | let (tx, rx, usart, tx_dma, rx_dma) = (p.PD8, p.PD9, p.USART3, p.GPDMA1_CH0, p.GPDMA1_CH1); | 57 | let (tx, rx, usart, irq, tx_dma, rx_dma) = ( |
| 58 | p.PD8, | ||
| 59 | p.PD9, | ||
| 60 | p.USART3, | ||
| 61 | interrupt::take!(USART3), | ||
| 62 | p.GPDMA1_CH0, | ||
| 63 | p.GPDMA1_CH1, | ||
| 64 | ); | ||
| 33 | 65 | ||
| 34 | let config = Config::default(); | 66 | let config = Config::default(); |
| 35 | let mut usart = Uart::new(usart, rx, tx, tx_dma, rx_dma, config); | 67 | let mut usart = Uart::new(usart, rx, tx, irq, tx_dma, rx_dma, config); |
| 36 | 68 | ||
| 37 | // We can't send too many bytes, they have to fit in the FIFO. | 69 | // We can't send too many bytes, they have to fit in the FIFO. |
| 38 | // This is because we aren't sending+receiving at the same time. | 70 | // This is because we aren't sending+receiving at the same time. |
