Closed
Description
I have the following code:
// #![deny(unsafe_code)]
// #![deny(warnings)]
#![no_main]
#![no_std]
use stm32f1::stm32f103;
use rtfm::app;
#[app(device = stm32f1)]
const APP: () = {
static mut PERIPHERALS: stm32f103::Peripherals = stm32f103::Peripherals::take().unwrap();
#[init(spawn = [task1, task2], resources = [PERIPHERALS])]
fn init(c: config::Context) {
let rcc = c.resources.PERIPHERALS.RCC;
let gpioc = c.resources.PERIPHERALS.GPIOC;
rcc.apb2enr.write(|w| w.iopcen().set_bit());
gpioc.crh.write(|w| unsafe{
w.mode13().bits(0b11);
w.cnf13().bits(0b00)
});
c.spawn.task1().unwrap();
c.spawn.task2().unwrap();
}
#[idle]
fn idle() -> ! {
loop {}
}
#[task(resources = [PERIPHERALS])]
fn task1(c: task1::Context) {
let gpioc = c.resources.PERIPHERALS.GPIOC;
loop {
gpioc.bsrr.write(|w| w.bs13().set_bit());
cortex_m::asm::delay(2000000);
}
}
#[task(resources = [PERIPHERALS])]
fn task2(c: task1::Context) {
let gpioc = c.resources.PERIPHERALS.GPIOC;
loop {
gpioc.brr.write(|w| w.br13().set_bit());
cortex_m::asm::delay(2000000);
}
}
extern "C" {
fn TIM2();
}
};
What i get from compilation is the following error:
`init` must have type signature `[unsafe] fn() [-> init::LateResources]`
I don't know how to fix it, I'm reading the examples that seems to have the same syntax of mine.
For now I don't care about the correctness of the tasks
Metadata
Metadata
Assignees
Labels
No labels