aboutsummaryrefslogtreecommitdiff
path: root/embassy-rp/src/lib.rs
diff options
context:
space:
mode:
authorgoueslati <[email protected]>2023-06-12 14:27:53 +0100
committergoueslati <[email protected]>2023-06-12 14:27:53 +0100
commit2d89cfb18f00aefbfa108728dfea3398e80ea3e4 (patch)
tree6485dacac7e61c4378ac522e709edb0a86bd7523 /embassy-rp/src/lib.rs
parent2dd5ce83ec0421564e85b667f5dabd592f313e5c (diff)
parentab86b060500ceda1c80e39f35af69cb08a7b63a2 (diff)
fix merge conflict
Diffstat (limited to 'embassy-rp/src/lib.rs')
-rw-r--r--embassy-rp/src/lib.rs68
1 files changed, 65 insertions, 3 deletions
diff --git a/embassy-rp/src/lib.rs b/embassy-rp/src/lib.rs
index 4e4542d70..d6f73219f 100644
--- a/embassy-rp/src/lib.rs
+++ b/embassy-rp/src/lib.rs
@@ -16,7 +16,6 @@ pub mod flash;
16mod float; 16mod float;
17pub mod gpio; 17pub mod gpio;
18pub mod i2c; 18pub mod i2c;
19pub mod interrupt;
20pub mod multicore; 19pub mod multicore;
21pub mod pwm; 20pub mod pwm;
22mod reset; 21mod reset;
@@ -37,14 +36,77 @@ pub mod pio_instr_util;
37pub mod relocate; 36pub mod relocate;
38 37
39// Reexports 38// Reexports
40pub use embassy_cortex_m::executor;
41pub use embassy_cortex_m::interrupt::_export::interrupt;
42pub use embassy_hal_common::{into_ref, Peripheral, PeripheralRef}; 39pub use embassy_hal_common::{into_ref, Peripheral, PeripheralRef};
43#[cfg(feature = "unstable-pac")] 40#[cfg(feature = "unstable-pac")]
44pub use rp_pac as pac; 41pub use rp_pac as pac;
45#[cfg(not(feature = "unstable-pac"))] 42#[cfg(not(feature = "unstable-pac"))]
46pub(crate) use rp_pac as pac; 43pub(crate) use rp_pac as pac;
47 44
45#[cfg(feature = "rt")]
46pub use crate::pac::NVIC_PRIO_BITS;
47
48embassy_hal_common::interrupt_mod!(
49 TIMER_IRQ_0,
50 TIMER_IRQ_1,
51 TIMER_IRQ_2,
52 TIMER_IRQ_3,
53 PWM_IRQ_WRAP,
54 USBCTRL_IRQ,
55 XIP_IRQ,
56 PIO0_IRQ_0,
57 PIO0_IRQ_1,
58 PIO1_IRQ_0,
59 PIO1_IRQ_1,
60 DMA_IRQ_0,
61 DMA_IRQ_1,
62 IO_IRQ_BANK0,
63 IO_IRQ_QSPI,
64 SIO_IRQ_PROC0,
65 SIO_IRQ_PROC1,
66 CLOCKS_IRQ,
67 SPI0_IRQ,
68 SPI1_IRQ,
69 UART0_IRQ,
70 UART1_IRQ,
71 ADC_IRQ_FIFO,
72 I2C0_IRQ,
73 I2C1_IRQ,
74 RTC_IRQ,
75 SWI_IRQ_0,
76 SWI_IRQ_1,
77 SWI_IRQ_2,
78 SWI_IRQ_3,
79 SWI_IRQ_4,
80 SWI_IRQ_5,
81);
82
83/// Macro to bind interrupts to handlers.
84///
85/// This defines the right interrupt handlers, and creates a unit struct (like `struct Irqs;`)
86/// and implements the right [`Binding`]s for it. You can pass this struct to drivers to
87/// prove at compile-time that the right interrupts have been bound.
88// developer note: this macro can't be in `embassy-hal-common` due to the use of `$crate`.
89#[macro_export]
90macro_rules! bind_interrupts {
91 ($vis:vis struct $name:ident { $($irq:ident => $($handler:ty),*;)* }) => {
92 $vis struct $name;
93
94 $(
95 #[allow(non_snake_case)]
96 #[no_mangle]
97 unsafe extern "C" fn $irq() {
98 $(
99 <$handler as $crate::interrupt::typelevel::Handler<$crate::interrupt::typelevel::$irq>>::on_interrupt();
100 )*
101 }
102
103 $(
104 unsafe impl $crate::interrupt::typelevel::Binding<$crate::interrupt::typelevel::$irq, $handler> for $name {}
105 )*
106 )*
107 };
108}
109
48embassy_hal_common::peripherals! { 110embassy_hal_common::peripherals! {
49 PIN_0, 111 PIN_0,
50 PIN_1, 112 PIN_1,