diff options
| author | Dario Nieuwenhuis <[email protected]> | 2023-12-08 21:26:28 +0100 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2023-12-08 21:26:28 +0100 |
| commit | 6c746dcf3944fdd2901697c2bab107033458e22c (patch) | |
| tree | b54ff7b6feab720e2ffca7e91e5eee099a0a4cf8 /embassy-rp/src | |
| parent | 3ef18ec133b681d0ad3d25c050b5b960483c444e (diff) | |
Document how to bind multiple interrupts and handlers in `bind_interrupts!`.
Diffstat (limited to 'embassy-rp/src')
| -rw-r--r-- | embassy-rp/src/lib.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/embassy-rp/src/lib.rs b/embassy-rp/src/lib.rs index 66e4cfdcf..5151323a9 100644 --- a/embassy-rp/src/lib.rs +++ b/embassy-rp/src/lib.rs | |||
| @@ -86,6 +86,17 @@ embassy_hal_internal::interrupt_mod!( | |||
| 86 | /// This defines the right interrupt handlers, and creates a unit struct (like `struct Irqs;`) | 86 | /// This defines the right interrupt handlers, and creates a unit struct (like `struct Irqs;`) |
| 87 | /// and implements the right [`Binding`]s for it. You can pass this struct to drivers to | 87 | /// and implements the right [`Binding`]s for it. You can pass this struct to drivers to |
| 88 | /// prove at compile-time that the right interrupts have been bound. | 88 | /// prove at compile-time that the right interrupts have been bound. |
| 89 | /// | ||
| 90 | /// Example of how to bind one interrupt: | ||
| 91 | /// | ||
| 92 | /// ```rust,ignore | ||
| 93 | /// use embassy_rp::{bind_interrupts, usb, peripherals}; | ||
| 94 | /// | ||
| 95 | /// bind_interrupts!(struct Irqs { | ||
| 96 | /// USBCTRL_IRQ => usb::InterruptHandler<peripherals::USB>; | ||
| 97 | /// }); | ||
| 98 | /// ``` | ||
| 99 | /// | ||
| 89 | // developer note: this macro can't be in `embassy-hal-internal` due to the use of `$crate`. | 100 | // developer note: this macro can't be in `embassy-hal-internal` due to the use of `$crate`. |
| 90 | #[macro_export] | 101 | #[macro_export] |
| 91 | macro_rules! bind_interrupts { | 102 | macro_rules! bind_interrupts { |
