aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2023-02-10 23:35:44 +0100
committerDario Nieuwenhuis <[email protected]>2023-02-10 23:35:44 +0100
commit76642b3a3cddaa226dcd741d5f9f8e9d01c2f3ac (patch)
tree7614b029295c3d650069c7e21b2af8304e7eb3fd
parenta509af4bc00ae6945e568b268731e854e8ae3994 (diff)
fix h7 examples
-rw-r--r--examples/nrf52840/src/bin/usb_ethernet.rs23
-rw-r--r--examples/stm32h7/Cargo.toml2
2 files changed, 24 insertions, 1 deletions
diff --git a/examples/nrf52840/src/bin/usb_ethernet.rs b/examples/nrf52840/src/bin/usb_ethernet.rs
index 979780896..430468adf 100644
--- a/examples/nrf52840/src/bin/usb_ethernet.rs
+++ b/examples/nrf52840/src/bin/usb_ethernet.rs
@@ -46,8 +46,31 @@ async fn net_task(stack: &'static Stack<Device<'static, MTU>>) -> ! {
46 stack.run().await 46 stack.run().await
47} 47}
48 48
49#[inline(never)]
50pub fn test_function() -> (usize, u32, [u32; 2]) {
51 let mut array = [3; 2];
52
53 let mut index = 0;
54 let mut result = 0;
55
56 for x in [1, 2] {
57 if x == 1 {
58 array[1] = 99;
59 } else {
60 index = if x == 2 { 1 } else { 0 };
61
62 // grabs value from array[0], not array[1]
63 result = array[index];
64 }
65 }
66
67 (index, result, array)
68}
69
49#[embassy_executor::main] 70#[embassy_executor::main]
50async fn main(spawner: Spawner) { 71async fn main(spawner: Spawner) {
72 info!("{:?}", test_function());
73
51 let p = embassy_nrf::init(Default::default()); 74 let p = embassy_nrf::init(Default::default());
52 let clock: pac::CLOCK = unsafe { mem::transmute(()) }; 75 let clock: pac::CLOCK = unsafe { mem::transmute(()) };
53 76
diff --git a/examples/stm32h7/Cargo.toml b/examples/stm32h7/Cargo.toml
index bcf976416..a04134789 100644
--- a/examples/stm32h7/Cargo.toml
+++ b/examples/stm32h7/Cargo.toml
@@ -21,7 +21,7 @@ cortex-m-rt = "0.7.0"
21embedded-hal = "0.2.6" 21embedded-hal = "0.2.6"
22embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.9" } 22embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.9" }
23embedded-hal-async = { version = "=0.2.0-alpha.0" } 23embedded-hal-async = { version = "=0.2.0-alpha.0" }
24embedded-nal-async = "0.3.0" 24embedded-nal-async = "0.4.0"
25panic-probe = { version = "0.3", features = ["print-defmt"] } 25panic-probe = { version = "0.3", features = ["print-defmt"] }
26futures = { version = "0.3.17", default-features = false, features = ["async-await"] } 26futures = { version = "0.3.17", default-features = false, features = ["async-await"] }
27heapless = { version = "0.7.5", default-features = false } 27heapless = { version = "0.7.5", default-features = false }