added eeprom to tests
This commit is contained in:
parent
e4a6d7aedd
commit
c88bc97231
@ -19,8 +19,8 @@ stm32h563zi = ["embassy-stm32/stm32h563zi", "spi-v345", "chrono", "eth", "rng",
|
|||||||
stm32h753zi = ["embassy-stm32/stm32h753zi", "spi-v345", "chrono", "not-gpdma", "eth", "rng", "fdcan", "hash", "cryp"]
|
stm32h753zi = ["embassy-stm32/stm32h753zi", "spi-v345", "chrono", "not-gpdma", "eth", "rng", "fdcan", "hash", "cryp"]
|
||||||
stm32h755zi = ["embassy-stm32/stm32h755zi-cm7", "spi-v345", "chrono", "not-gpdma", "eth", "dac", "rng", "fdcan", "hash", "cryp"]
|
stm32h755zi = ["embassy-stm32/stm32h755zi-cm7", "spi-v345", "chrono", "not-gpdma", "eth", "dac", "rng", "fdcan", "hash", "cryp"]
|
||||||
stm32h7a3zi = ["embassy-stm32/stm32h7a3zi", "spi-v345", "not-gpdma", "rng", "fdcan"]
|
stm32h7a3zi = ["embassy-stm32/stm32h7a3zi", "spi-v345", "not-gpdma", "rng", "fdcan"]
|
||||||
stm32l073rz = ["embassy-stm32/stm32l073rz", "cm0", "not-gpdma", "rng"]
|
stm32l073rz = ["embassy-stm32/stm32l073rz", "cm0", "not-gpdma", "rng", "eeprom"]
|
||||||
stm32l152re = ["embassy-stm32/stm32l152re", "spi-v1", "chrono", "not-gpdma"]
|
stm32l152re = ["embassy-stm32/stm32l152re", "spi-v1", "chrono", "not-gpdma", "eeprom"]
|
||||||
stm32l496zg = ["embassy-stm32/stm32l496zg", "not-gpdma", "rng"]
|
stm32l496zg = ["embassy-stm32/stm32l496zg", "not-gpdma", "rng"]
|
||||||
stm32l4a6zg = ["embassy-stm32/stm32l4a6zg", "chrono", "not-gpdma", "rng", "hash"]
|
stm32l4a6zg = ["embassy-stm32/stm32l4a6zg", "chrono", "not-gpdma", "rng", "hash"]
|
||||||
stm32l4r5zi = ["embassy-stm32/stm32l4r5zi", "chrono", "not-gpdma", "rng", "dual-bank"]
|
stm32l4r5zi = ["embassy-stm32/stm32l4r5zi", "chrono", "not-gpdma", "rng", "dual-bank"]
|
||||||
@ -55,6 +55,7 @@ ucpd = []
|
|||||||
cordic = ["dep:num-traits"]
|
cordic = ["dep:num-traits"]
|
||||||
dual-bank = ["embassy-stm32/dual-bank"]
|
dual-bank = ["embassy-stm32/dual-bank"]
|
||||||
single-bank = ["embassy-stm32/single-bank"]
|
single-bank = ["embassy-stm32/single-bank"]
|
||||||
|
eeprom = []
|
||||||
|
|
||||||
cm0 = ["portable-atomic/unsafe-assume-single-core"]
|
cm0 = ["portable-atomic/unsafe-assume-single-core"]
|
||||||
|
|
||||||
@ -119,6 +120,11 @@ name = "dac_l1"
|
|||||||
path = "src/bin/dac_l1.rs"
|
path = "src/bin/dac_l1.rs"
|
||||||
required-features = [ "stm32l152re",]
|
required-features = [ "stm32l152re",]
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "eeprom"
|
||||||
|
path = "src/bin/eeprom.rs"
|
||||||
|
required-features = [ "eeprom",]
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "eth"
|
name = "eth"
|
||||||
path = "src/bin/eth.rs"
|
path = "src/bin/eth.rs"
|
||||||
|
|||||||
30
tests/stm32/src/bin/eeprom.rs
Normal file
30
tests/stm32/src/bin/eeprom.rs
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
#![no_std]
|
||||||
|
#![no_main]
|
||||||
|
|
||||||
|
// required-features: eeprom
|
||||||
|
|
||||||
|
#[path = "../common.rs"]
|
||||||
|
mod common;
|
||||||
|
|
||||||
|
use common::*;
|
||||||
|
use defmt::assert_eq;
|
||||||
|
use embassy_executor::Spawner;
|
||||||
|
use embassy_stm32::flash::Flash;
|
||||||
|
use {defmt_rtt as _, panic_probe as _};
|
||||||
|
|
||||||
|
#[embassy_executor::main]
|
||||||
|
async fn main(_spawner: Spawner) {
|
||||||
|
// Initialize the board and obtain a Peripherals instance
|
||||||
|
let p: embassy_stm32::Peripherals = init();
|
||||||
|
|
||||||
|
let mut f = Flash::new_blocking(p.FLASH);
|
||||||
|
const ADDR: u32 = 0x0;
|
||||||
|
|
||||||
|
unwrap!(f.eeprom_write_slice(ADDR, &[1, 2, 3, 4, 5, 6, 7, 8]));
|
||||||
|
let mut buf = [0u8; 8];
|
||||||
|
unwrap!(f.eeprom_read_slice(ADDR, &mut buf));
|
||||||
|
assert_eq!(&buf[..], &[1, 2, 3, 4, 5, 6, 7, 8]);
|
||||||
|
|
||||||
|
info!("Test OK");
|
||||||
|
cortex_m::asm::bkpt();
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user