diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/mspm0/Cargo.toml | 2 | ||||
| -rw-r--r-- | tests/nrf/Cargo.toml | 2 | ||||
| -rw-r--r-- | tests/riscv32/Cargo.toml | 2 | ||||
| -rw-r--r-- | tests/rp/Cargo.toml | 2 | ||||
| -rw-r--r-- | tests/rp/src/bin/gpio.rs | 34 | ||||
| -rw-r--r-- | tests/stm32/Cargo.toml | 12 | ||||
| -rw-r--r-- | tests/stm32/src/bin/cryp.rs | 2 | ||||
| -rw-r--r-- | tests/stm32/src/bin/eeprom.rs | 30 | ||||
| -rw-r--r-- | tests/stm32/src/bin/sdmmc.rs | 4 |
9 files changed, 82 insertions, 8 deletions
diff --git a/tests/mspm0/Cargo.toml b/tests/mspm0/Cargo.toml index 1c6f7d1cd..5d34ece7e 100644 --- a/tests/mspm0/Cargo.toml +++ b/tests/mspm0/Cargo.toml | |||
| @@ -11,7 +11,7 @@ mspm0g3519 = [ "embassy-mspm0/mspm0g3519pz" ] | |||
| 11 | [dependencies] | 11 | [dependencies] |
| 12 | teleprobe-meta = "1.1" | 12 | teleprobe-meta = "1.1" |
| 13 | 13 | ||
| 14 | embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = [ "defmt" ] } | 14 | embassy-sync = { version = "0.7.0", path = "../../embassy-sync", features = [ "defmt" ] } |
| 15 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = [ "arch-cortex-m", "executor-thread", "defmt" ] } | 15 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = [ "arch-cortex-m", "executor-thread", "defmt" ] } |
| 16 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = [ "defmt" ] } | 16 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = [ "defmt" ] } |
| 17 | embassy-mspm0 = { version = "0.1.0", path = "../../embassy-mspm0", features = [ "rt", "defmt", "unstable-pac", "time-driver-any" ] } | 17 | embassy-mspm0 = { version = "0.1.0", path = "../../embassy-mspm0", features = [ "rt", "defmt", "unstable-pac", "time-driver-any" ] } |
diff --git a/tests/nrf/Cargo.toml b/tests/nrf/Cargo.toml index 32087940e..30c4223b7 100644 --- a/tests/nrf/Cargo.toml +++ b/tests/nrf/Cargo.toml | |||
| @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0" | |||
| 8 | teleprobe-meta = "1" | 8 | teleprobe-meta = "1" |
| 9 | 9 | ||
| 10 | embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } | 10 | embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } |
| 11 | embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt", ] } | 11 | embassy-sync = { version = "0.7.0", path = "../../embassy-sync", features = ["defmt", ] } |
| 12 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt"] } | 12 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt"] } |
| 13 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime"] } | 13 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime"] } |
| 14 | embassy-nrf = { version = "0.3.1", path = "../../embassy-nrf", features = ["defmt", "time-driver-rtc1", "gpiote", "unstable-pac"] } | 14 | embassy-nrf = { version = "0.3.1", path = "../../embassy-nrf", features = ["defmt", "time-driver-rtc1", "gpiote", "unstable-pac"] } |
diff --git a/tests/riscv32/Cargo.toml b/tests/riscv32/Cargo.toml index 446326d8a..c5f6a1194 100644 --- a/tests/riscv32/Cargo.toml +++ b/tests/riscv32/Cargo.toml | |||
| @@ -6,7 +6,7 @@ license = "MIT OR Apache-2.0" | |||
| 6 | 6 | ||
| 7 | [dependencies] | 7 | [dependencies] |
| 8 | critical-section = { version = "1.1.1", features = ["restore-state-bool"] } | 8 | critical-section = { version = "1.1.1", features = ["restore-state-bool"] } |
| 9 | embassy-sync = { version = "0.6.2", path = "../../embassy-sync" } | 9 | embassy-sync = { version = "0.7.0", path = "../../embassy-sync" } |
| 10 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["arch-riscv32", "executor-thread"] } | 10 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["arch-riscv32", "executor-thread"] } |
| 11 | embassy-time = { version = "0.4.0", path = "../../embassy-time" } | 11 | embassy-time = { version = "0.4.0", path = "../../embassy-time" } |
| 12 | embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } | 12 | embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } |
diff --git a/tests/rp/Cargo.toml b/tests/rp/Cargo.toml index 2c2ed73cc..2be37f525 100644 --- a/tests/rp/Cargo.toml +++ b/tests/rp/Cargo.toml | |||
| @@ -12,7 +12,7 @@ rp235xb = ["embassy-rp/rp235xb"] | |||
| 12 | [dependencies] | 12 | [dependencies] |
| 13 | teleprobe-meta = "1.1" | 13 | teleprobe-meta = "1.1" |
| 14 | 14 | ||
| 15 | embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] } | 15 | embassy-sync = { version = "0.7.0", path = "../../embassy-sync", features = ["defmt"] } |
| 16 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt"] } | 16 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt"] } |
| 17 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", ] } | 17 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", ] } |
| 18 | embassy-rp = { version = "0.4.0", path = "../../embassy-rp", features = [ "defmt", "unstable-pac", "time-driver", "critical-section-impl", "intrinsics", "rom-v2-intrinsics", "run-from-ram"] } | 18 | embassy-rp = { version = "0.4.0", path = "../../embassy-rp", features = [ "defmt", "unstable-pac", "time-driver", "critical-section-impl", "intrinsics", "rom-v2-intrinsics", "run-from-ram"] } |
diff --git a/tests/rp/src/bin/gpio.rs b/tests/rp/src/bin/gpio.rs index 614b6317a..8bd0df8d8 100644 --- a/tests/rp/src/bin/gpio.rs +++ b/tests/rp/src/bin/gpio.rs | |||
| @@ -67,6 +67,40 @@ async fn main(_spawner: Spawner) { | |||
| 67 | } | 67 | } |
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | // Test input inversion | ||
| 71 | { | ||
| 72 | let mut b = Input::new(b.reborrow(), Pull::None); | ||
| 73 | b.set_inversion(true); | ||
| 74 | // no pull, the status is undefined | ||
| 75 | |||
| 76 | let mut a = Output::new(a.reborrow(), Level::Low); | ||
| 77 | delay(); | ||
| 78 | assert!(b.is_high()); | ||
| 79 | a.set_high(); | ||
| 80 | delay(); | ||
| 81 | assert!(b.is_low()); | ||
| 82 | |||
| 83 | b.set_inversion(false); | ||
| 84 | a.set_inversion(true); | ||
| 85 | |||
| 86 | a.set_low(); | ||
| 87 | delay(); | ||
| 88 | assert!(b.is_high()); | ||
| 89 | |||
| 90 | a.set_high(); | ||
| 91 | delay(); | ||
| 92 | assert!(b.is_low()); | ||
| 93 | |||
| 94 | b.set_inversion(true); | ||
| 95 | a.set_high(); | ||
| 96 | delay(); | ||
| 97 | assert!(b.is_high()); | ||
| 98 | |||
| 99 | a.set_high(); | ||
| 100 | delay(); | ||
| 101 | assert!(b.is_high()); | ||
| 102 | } | ||
| 103 | |||
| 70 | // Test input no pull | 104 | // Test input no pull |
| 71 | { | 105 | { |
| 72 | let b = Input::new(b.reborrow(), Pull::None); | 106 | let b = Input::new(b.reborrow(), Pull::None); |
diff --git a/tests/stm32/Cargo.toml b/tests/stm32/Cargo.toml index 6036a5a97..8d10f6593 100644 --- a/tests/stm32/Cargo.toml +++ b/tests/stm32/Cargo.toml | |||
| @@ -19,8 +19,8 @@ stm32h563zi = ["embassy-stm32/stm32h563zi", "spi-v345", "chrono", "eth", "rng", | |||
| 19 | stm32h753zi = ["embassy-stm32/stm32h753zi", "spi-v345", "chrono", "not-gpdma", "eth", "rng", "fdcan", "hash", "cryp"] | 19 | stm32h753zi = ["embassy-stm32/stm32h753zi", "spi-v345", "chrono", "not-gpdma", "eth", "rng", "fdcan", "hash", "cryp"] |
| 20 | stm32h755zi = ["embassy-stm32/stm32h755zi-cm7", "spi-v345", "chrono", "not-gpdma", "eth", "dac", "rng", "fdcan", "hash", "cryp"] | 20 | stm32h755zi = ["embassy-stm32/stm32h755zi-cm7", "spi-v345", "chrono", "not-gpdma", "eth", "dac", "rng", "fdcan", "hash", "cryp"] |
| 21 | stm32h7a3zi = ["embassy-stm32/stm32h7a3zi", "spi-v345", "not-gpdma", "rng", "fdcan"] | 21 | stm32h7a3zi = ["embassy-stm32/stm32h7a3zi", "spi-v345", "not-gpdma", "rng", "fdcan"] |
| 22 | stm32l073rz = ["embassy-stm32/stm32l073rz", "cm0", "not-gpdma", "rng"] | 22 | stm32l073rz = ["embassy-stm32/stm32l073rz", "cm0", "not-gpdma", "rng", "eeprom"] |
| 23 | stm32l152re = ["embassy-stm32/stm32l152re", "spi-v1", "chrono", "not-gpdma"] | 23 | stm32l152re = ["embassy-stm32/stm32l152re", "spi-v1", "chrono", "not-gpdma", "eeprom"] |
| 24 | stm32l496zg = ["embassy-stm32/stm32l496zg", "not-gpdma", "rng"] | 24 | stm32l496zg = ["embassy-stm32/stm32l496zg", "not-gpdma", "rng"] |
| 25 | stm32l4a6zg = ["embassy-stm32/stm32l4a6zg", "chrono", "not-gpdma", "rng", "hash"] | 25 | stm32l4a6zg = ["embassy-stm32/stm32l4a6zg", "chrono", "not-gpdma", "rng", "hash"] |
| 26 | stm32l4r5zi = ["embassy-stm32/stm32l4r5zi", "chrono", "not-gpdma", "rng", "dual-bank"] | 26 | stm32l4r5zi = ["embassy-stm32/stm32l4r5zi", "chrono", "not-gpdma", "rng", "dual-bank"] |
| @@ -55,13 +55,14 @@ ucpd = [] | |||
| 55 | cordic = ["dep:num-traits"] | 55 | cordic = ["dep:num-traits"] |
| 56 | dual-bank = ["embassy-stm32/dual-bank"] | 56 | dual-bank = ["embassy-stm32/dual-bank"] |
| 57 | single-bank = ["embassy-stm32/single-bank"] | 57 | single-bank = ["embassy-stm32/single-bank"] |
| 58 | eeprom = [] | ||
| 58 | 59 | ||
| 59 | cm0 = ["portable-atomic/unsafe-assume-single-core"] | 60 | cm0 = ["portable-atomic/unsafe-assume-single-core"] |
| 60 | 61 | ||
| 61 | [dependencies] | 62 | [dependencies] |
| 62 | teleprobe-meta = "1" | 63 | teleprobe-meta = "1" |
| 63 | 64 | ||
| 64 | embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] } | 65 | embassy-sync = { version = "0.7.0", path = "../../embassy-sync", features = ["defmt"] } |
| 65 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt"] } | 66 | embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt"] } |
| 66 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "tick-hz-131_072", "defmt-timestamp-uptime"] } | 67 | embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "tick-hz-131_072", "defmt-timestamp-uptime"] } |
| 67 | embassy-stm32 = { version = "0.2.0", path = "../../embassy-stm32", features = [ "defmt", "unstable-pac", "memory-x", "time-driver-any"] } | 68 | embassy-stm32 = { version = "0.2.0", path = "../../embassy-stm32", features = [ "defmt", "unstable-pac", "memory-x", "time-driver-any"] } |
| @@ -120,6 +121,11 @@ path = "src/bin/dac_l1.rs" | |||
| 120 | required-features = [ "stm32l152re",] | 121 | required-features = [ "stm32l152re",] |
| 121 | 122 | ||
| 122 | [[bin]] | 123 | [[bin]] |
| 124 | name = "eeprom" | ||
| 125 | path = "src/bin/eeprom.rs" | ||
| 126 | required-features = [ "eeprom",] | ||
| 127 | |||
| 128 | [[bin]] | ||
| 123 | name = "eth" | 129 | name = "eth" |
| 124 | path = "src/bin/eth.rs" | 130 | path = "src/bin/eth.rs" |
| 125 | required-features = [ "eth",] | 131 | required-features = [ "eth",] |
diff --git a/tests/stm32/src/bin/cryp.rs b/tests/stm32/src/bin/cryp.rs index 028775ac8..f54c99cc3 100644 --- a/tests/stm32/src/bin/cryp.rs +++ b/tests/stm32/src/bin/cryp.rs | |||
| @@ -72,7 +72,7 @@ async fn main(_spawner: Spawner) { | |||
| 72 | defmt::assert!(encrypt_tag == payload_vec[ciphertext.len()..ciphertext.len() + encrypt_tag.len()]); | 72 | defmt::assert!(encrypt_tag == payload_vec[ciphertext.len()..ciphertext.len() + encrypt_tag.len()]); |
| 73 | 73 | ||
| 74 | // Decrypt in software using AES-GCM 128-bit | 74 | // Decrypt in software using AES-GCM 128-bit |
| 75 | let _ = cipher.decrypt_in_place(&iv.into(), &aad, &mut payload_vec); | 75 | cipher.decrypt_in_place(&iv.into(), &aad, &mut payload_vec).unwrap(); |
| 76 | 76 | ||
| 77 | info!("Test OK"); | 77 | info!("Test OK"); |
| 78 | cortex_m::asm::bkpt(); | 78 | cortex_m::asm::bkpt(); |
diff --git a/tests/stm32/src/bin/eeprom.rs b/tests/stm32/src/bin/eeprom.rs new file mode 100644 index 000000000..61d249fd7 --- /dev/null +++ b/tests/stm32/src/bin/eeprom.rs | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | #![no_std] | ||
| 2 | #![no_main] | ||
| 3 | |||
| 4 | // required-features: eeprom | ||
| 5 | |||
| 6 | #[path = "../common.rs"] | ||
| 7 | mod common; | ||
| 8 | |||
| 9 | use common::*; | ||
| 10 | use defmt::assert_eq; | ||
| 11 | use embassy_executor::Spawner; | ||
| 12 | use embassy_stm32::flash::Flash; | ||
| 13 | use {defmt_rtt as _, panic_probe as _}; | ||
| 14 | |||
| 15 | #[embassy_executor::main] | ||
| 16 | async fn main(_spawner: Spawner) { | ||
| 17 | // Initialize the board and obtain a Peripherals instance | ||
| 18 | let p: embassy_stm32::Peripherals = init(); | ||
| 19 | |||
| 20 | let mut f = Flash::new_blocking(p.FLASH); | ||
| 21 | const ADDR: u32 = 0x0; | ||
| 22 | |||
| 23 | unwrap!(f.eeprom_write_slice(ADDR, &[1, 2, 3, 4, 5, 6, 7, 8])); | ||
| 24 | let mut buf = [0u8; 8]; | ||
| 25 | unwrap!(f.eeprom_read_slice(ADDR, &mut buf)); | ||
| 26 | assert_eq!(&buf[..], &[1, 2, 3, 4, 5, 6, 7, 8]); | ||
| 27 | |||
| 28 | info!("Test OK"); | ||
| 29 | cortex_m::asm::bkpt(); | ||
| 30 | } | ||
diff --git a/tests/stm32/src/bin/sdmmc.rs b/tests/stm32/src/bin/sdmmc.rs index 34a53a725..9f9c526e1 100644 --- a/tests/stm32/src/bin/sdmmc.rs +++ b/tests/stm32/src/bin/sdmmc.rs | |||
| @@ -95,6 +95,9 @@ async fn main(_spawner: Spawner) { | |||
| 95 | 95 | ||
| 96 | drop(s); | 96 | drop(s); |
| 97 | 97 | ||
| 98 | // FIXME: this hangs on Rust 1.86 and higher. | ||
| 99 | // I haven't been able to figure out why. | ||
| 100 | /* | ||
| 98 | // ======== Try 1bit. ============== | 101 | // ======== Try 1bit. ============== |
| 99 | info!("initializing in 1-bit mode..."); | 102 | info!("initializing in 1-bit mode..."); |
| 100 | let mut s = Sdmmc::new_1bit( | 103 | let mut s = Sdmmc::new_1bit( |
| @@ -151,6 +154,7 @@ async fn main(_spawner: Spawner) { | |||
| 151 | assert_eq!(&blocks, &patterns); | 154 | assert_eq!(&blocks, &patterns); |
| 152 | 155 | ||
| 153 | drop(s); | 156 | drop(s); |
| 157 | */ | ||
| 154 | 158 | ||
| 155 | info!("Test OK"); | 159 | info!("Test OK"); |
| 156 | cortex_m::asm::bkpt(); | 160 | cortex_m::asm::bkpt(); |
