embassy icon indicating copy to clipboard operation
embassy copied to clipboard

rp2040 multicore code style?

Open overheat opened this issue 1 year ago • 1 comments

the first para of spawn_core1 function is _core1: CORE1, but this function does't need it, as there is a _ before core1.

When I only have compute and no peripherals operation on core1, how to put

   let p = embassy_rp::init(Default::default());

into core0 task without

103 |     spawn_core1(p.CORE1, unsafe { &mut CORE1_STACK }, move || {
    |                 ------- value partially moved here

compiler error?

overheat avatar May 25 '23 05:05 overheat

I believe the point of that unused parameter is to prove ownership of the CORE1 peripheral. It prevents you from accidentally running spawn_core1 twice. To use other peripherals in other tasks, you can use the same partial move pattern - but you'll need to pass in each part you want to use as a separate param, rather than the whole p

orukusaki avatar Nov 07 '23 09:11 orukusaki