Example fixes.

This commit is contained in:
Dario Nieuwenhuis
2023-03-01 01:32:42 +01:00
parent 711ce10145
commit 6dbb631f1e
6 changed files with 11 additions and 56 deletions

View File

@ -46,31 +46,8 @@ async fn net_task(stack: &'static Stack<Device<'static, MTU>>) -> ! {
stack.run().await
}
#[inline(never)]
pub fn test_function() -> (usize, u32, [u32; 2]) {
let mut array = [3; 2];
let mut index = 0;
let mut result = 0;
for x in [1, 2] {
if x == 1 {
array[1] = 99;
} else {
index = if x == 2 { 1 } else { 0 };
// grabs value from array[0], not array[1]
result = array[index];
}
}
(index, result, array)
}
#[embassy_executor::main]
async fn main(spawner: Spawner) {
info!("{:?}", test_function());
let p = embassy_nrf::init(Default::default());
let clock: pac::CLOCK = unsafe { mem::transmute(()) };