diff options
| author | Dario Nieuwenhuis <[email protected]> | 2023-02-10 23:35:44 +0100 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2023-02-10 23:35:44 +0100 |
| commit | 76642b3a3cddaa226dcd741d5f9f8e9d01c2f3ac (patch) | |
| tree | 7614b029295c3d650069c7e21b2af8304e7eb3fd /examples/nrf52840/src | |
| parent | a509af4bc00ae6945e568b268731e854e8ae3994 (diff) | |
fix h7 examples
Diffstat (limited to 'examples/nrf52840/src')
| -rw-r--r-- | examples/nrf52840/src/bin/usb_ethernet.rs | 23 |
1 files changed, 23 insertions, 0 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 | ||
