forked from M-Labs/kirdy
main: Add demo fns to use on-board flash
This commit is contained in:
parent
d190b8b192
commit
42cd55645c
26
src/main.rs
26
src/main.rs
|
@ -37,7 +37,31 @@ fn main() -> ! {
|
|||
let core_perif = CorePeripherals::take().unwrap();
|
||||
let perif = Peripherals::take().unwrap();
|
||||
|
||||
let (mut wd, _flash_store, mut laser, mut thermostat,) = bootup(core_perif, perif);
|
||||
let (mut wd, mut flash_store, mut laser, mut thermostat,) = bootup(core_perif, perif);
|
||||
|
||||
let key = "test";
|
||||
info!("Read the Flash Content Stored");
|
||||
match flash_store.read(key).unwrap() {
|
||||
Some(val) => {info!("Flash Valued Read: {:?}", val)}
|
||||
_ => {info!("Key does not match")}
|
||||
}
|
||||
|
||||
info!("Erasing Flash");
|
||||
flash_store.erase().unwrap();
|
||||
match flash_store.read(key).unwrap() {
|
||||
Some(val) => {info!("Flash Valued Read: {:?}", val)}
|
||||
_ => {info!("Key does not match")}
|
||||
}
|
||||
|
||||
info!("Writing Flash");
|
||||
let buf = [1, 2, 3, 4];
|
||||
flash_store.write(key, &buf).unwrap();
|
||||
|
||||
info!("Reading Flash");
|
||||
match flash_store.read(key).unwrap() {
|
||||
Some(val) => {info!("Val: {:?}", val)}
|
||||
_ => {info!("Key does not match")}
|
||||
};
|
||||
|
||||
// https://github.com/iliekturtles/uom/blob/master/examples/si.rs
|
||||
let volt_fmt = ElectricPotential::format_args(volt, Abbreviation);
|
||||
|
|
Loading…
Reference in New Issue