rp: add initial version

This commit is contained in:
Dario Nieuwenhuis
2021-03-29 04:11:32 +02:00
parent 2bcd1aaebb
commit 2cd3bdc90c
23 changed files with 1277 additions and 7 deletions

View File

@ -125,7 +125,7 @@ pub fn interrupt_declare(item: TokenStream) -> TokenStream {
type Priority = crate::interrupt::Priority;
fn number(&self) -> u16 {
use cortex_m::interrupt::InterruptNumber;
let irq = crate::pac::interrupt::#name;
let irq = crate::pac::Interrupt::#name;
irq.number() as u16
}
unsafe fn steal() -> Self {
@ -199,7 +199,11 @@ mod chip;
#[path = "chip/stm32.rs"]
mod chip;
#[cfg(any(feature = "nrf", feature = "stm32"))]
#[cfg(feature = "rp")]
#[path = "chip/rp.rs"]
mod chip;
#[cfg(any(feature = "nrf", feature = "stm32", feature = "rp"))]
#[proc_macro_attribute]
pub fn main(args: TokenStream, item: TokenStream) -> TokenStream {
let macro_args = syn::parse_macro_input!(args as syn::AttributeArgs);
@ -267,11 +271,10 @@ pub fn main(args: TokenStream, item: TokenStream) -> TokenStream {
::core::mem::transmute(t)
}
#chip_setup
let mut executor = ::embassy::executor::Executor::new();
let executor = unsafe { make_static(&mut executor) };
executor.set_alarm(alarm);
#chip_setup
executor.run(|spawner| {
spawner.spawn(__embassy_main(spawner)).unwrap();