diff options
| -rw-r--r-- | examples/nrf52840/src/bin/usb_ethernet.rs | 23 | ||||
| -rw-r--r-- | examples/stm32h7/Cargo.toml | 2 |
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)] | ||
| 50 | pub 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] |
| 50 | async fn main(spawner: Spawner) { | 71 | async 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" | |||
| 21 | embedded-hal = "0.2.6" | 21 | embedded-hal = "0.2.6" |
| 22 | embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.9" } | 22 | embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.9" } |
| 23 | embedded-hal-async = { version = "=0.2.0-alpha.0" } | 23 | embedded-hal-async = { version = "=0.2.0-alpha.0" } |
| 24 | embedded-nal-async = "0.3.0" | 24 | embedded-nal-async = "0.4.0" |
| 25 | panic-probe = { version = "0.3", features = ["print-defmt"] } | 25 | panic-probe = { version = "0.3", features = ["print-defmt"] } |
| 26 | futures = { version = "0.3.17", default-features = false, features = ["async-await"] } | 26 | futures = { version = "0.3.17", default-features = false, features = ["async-await"] } |
| 27 | heapless = { version = "0.7.5", default-features = false } | 27 | heapless = { version = "0.7.5", default-features = false } |
