diff options
| author | Dario Nieuwenhuis <[email protected]> | 2022-01-14 22:43:40 +0100 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2022-01-19 17:59:55 +0100 |
| commit | c949519714268afaf9b26d0ff4a7bc3c207b27d2 (patch) | |
| tree | 7513036217439a02360417aac52c3631a0672407 /tests | |
| parent | 98f24bf819a527997ed983d686c4ab933468439d (diff) | |
stm32/usart: expose all functionality as inherent methods.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/stm32/src/bin/usart.rs | 5 | ||||
| -rw-r--r-- | tests/stm32/src/bin/usart_dma.rs | 1 | ||||
| -rwxr-xr-x | tests/stm32/teleprobe.sh | 12 |
3 files changed, 14 insertions, 4 deletions
diff --git a/tests/stm32/src/bin/usart.rs b/tests/stm32/src/bin/usart.rs index f887b084a..44ee730e4 100644 --- a/tests/stm32/src/bin/usart.rs +++ b/tests/stm32/src/bin/usart.rs | |||
| @@ -9,7 +9,6 @@ use embassy::executor::Spawner; | |||
| 9 | use embassy_stm32::dma::NoDma; | 9 | use embassy_stm32::dma::NoDma; |
| 10 | use embassy_stm32::usart::{Config, Uart}; | 10 | use embassy_stm32::usart::{Config, Uart}; |
| 11 | use embassy_stm32::Peripherals; | 11 | use embassy_stm32::Peripherals; |
| 12 | use embedded_hal::blocking::serial::Write; | ||
| 13 | use example_common::*; | 12 | use example_common::*; |
| 14 | 13 | ||
| 15 | #[embassy::main(config = "config()")] | 14 | #[embassy::main(config = "config()")] |
| @@ -42,10 +41,10 @@ async fn main(_spawner: Spawner, p: Peripherals) { | |||
| 42 | // This is because we aren't sending+receiving at the same time. | 41 | // This is because we aren't sending+receiving at the same time. |
| 43 | 42 | ||
| 44 | let data = [0xC0, 0xDE]; | 43 | let data = [0xC0, 0xDE]; |
| 45 | usart.bwrite_all(&data).unwrap(); | 44 | usart.blocking_write(&data).unwrap(); |
| 46 | 45 | ||
| 47 | let mut buf = [0; 2]; | 46 | let mut buf = [0; 2]; |
| 48 | usart.read_blocking(&mut buf).unwrap(); | 47 | usart.blocking_read(&mut buf).unwrap(); |
| 49 | assert_eq!(buf, data); | 48 | assert_eq!(buf, data); |
| 50 | 49 | ||
| 51 | info!("Test OK"); | 50 | info!("Test OK"); |
diff --git a/tests/stm32/src/bin/usart_dma.rs b/tests/stm32/src/bin/usart_dma.rs index 96c6a6640..37faaf376 100644 --- a/tests/stm32/src/bin/usart_dma.rs +++ b/tests/stm32/src/bin/usart_dma.rs | |||
| @@ -8,7 +8,6 @@ use defmt::assert_eq; | |||
| 8 | use embassy::executor::Spawner; | 8 | use embassy::executor::Spawner; |
| 9 | use embassy_stm32::usart::{Config, Uart}; | 9 | use embassy_stm32::usart::{Config, Uart}; |
| 10 | use embassy_stm32::Peripherals; | 10 | use embassy_stm32::Peripherals; |
| 11 | use embassy_traits::uart::{Read, Write}; | ||
| 12 | use example_common::*; | 11 | use example_common::*; |
| 13 | 12 | ||
| 14 | #[embassy::main(config = "config()")] | 13 | #[embassy::main(config = "config()")] |
diff --git a/tests/stm32/teleprobe.sh b/tests/stm32/teleprobe.sh new file mode 100755 index 000000000..6eec6ca93 --- /dev/null +++ b/tests/stm32/teleprobe.sh | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | echo Running target=$1 elf=$2 | ||
| 2 | STATUSCODE=$( | ||
| 3 | curl \ | ||
| 4 | -sS \ | ||
| 5 | --output /dev/stderr \ | ||
| 6 | --write-out "%{http_code}" \ | ||
| 7 | -H "Authorization: Bearer $TELEPROBE_TOKEN" \ | ||
| 8 | https://teleprobe.embassy.dev/targets/$1/run --data-binary @$2 | ||
| 9 | ) | ||
| 10 | echo | ||
| 11 | echo HTTP Status code: $STATUSCODE | ||
| 12 | test "$STATUSCODE" -eq 200 | ||
