diff options
| author | Ralph Ursprung <[email protected]> | 2025-05-15 17:53:31 +0200 |
|---|---|---|
| committer | Ralph Ursprung <[email protected]> | 2025-05-15 18:27:40 +0200 |
| commit | 117eb45fa0829239da9152b9cf54c3cf706dc76d (patch) | |
| tree | 86eb9a1c2fdcba1efae1705299adbaeaa87884af /embassy-rp/src | |
| parent | d1c2ce927ac41a3f81de0f47e0468523d562d1d1 (diff) | |
add the possibility to document `bind_interrupts` `struct`s
the `bind_interrupts` macro creates a `struct` for the interrupts. it
was so far not possible to document those (except for STM32) and there
was no generic documentation being generated/added either, thus the
`missing_docs` lint was triggered for consumers which enabled it.
with this change it is now possible to manually add a comment on the
`struct` being defined in the macro invocation.
to show that this works one RP example has been modified accordingly.
Diffstat (limited to 'embassy-rp/src')
| -rw-r--r-- | embassy-rp/src/lib.rs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/embassy-rp/src/lib.rs b/embassy-rp/src/lib.rs index f549446bc..f3c5a35bb 100644 --- a/embassy-rp/src/lib.rs +++ b/embassy-rp/src/lib.rs | |||
| @@ -160,15 +160,18 @@ embassy_hal_internal::interrupt_mod!( | |||
| 160 | /// ```rust,ignore | 160 | /// ```rust,ignore |
| 161 | /// use embassy_rp::{bind_interrupts, usb, peripherals}; | 161 | /// use embassy_rp::{bind_interrupts, usb, peripherals}; |
| 162 | /// | 162 | /// |
| 163 | /// bind_interrupts!(struct Irqs { | 163 | /// bind_interrupts!( |
| 164 | /// USBCTRL_IRQ => usb::InterruptHandler<peripherals::USB>; | 164 | /// /// Binds the USB Interrupts. |
| 165 | /// }); | 165 | /// struct Irqs { |
| 166 | /// USBCTRL_IRQ => usb::InterruptHandler<peripherals::USB>; | ||
| 167 | /// } | ||
| 168 | /// ); | ||
| 166 | /// ``` | 169 | /// ``` |
| 167 | /// | 170 | /// |
| 168 | // developer note: this macro can't be in `embassy-hal-internal` due to the use of `$crate`. | 171 | // developer note: this macro can't be in `embassy-hal-internal` due to the use of `$crate`. |
| 169 | #[macro_export] | 172 | #[macro_export] |
| 170 | macro_rules! bind_interrupts { | 173 | macro_rules! bind_interrupts { |
| 171 | ($vis:vis struct $name:ident { | 174 | ($(#[$attr:meta])* $vis:vis struct $name:ident { |
| 172 | $( | 175 | $( |
| 173 | $(#[cfg($cond_irq:meta)])? | 176 | $(#[cfg($cond_irq:meta)])? |
| 174 | $irq:ident => $( | 177 | $irq:ident => $( |
| @@ -178,6 +181,7 @@ macro_rules! bind_interrupts { | |||
| 178 | )* | 181 | )* |
| 179 | }) => { | 182 | }) => { |
| 180 | #[derive(Copy, Clone)] | 183 | #[derive(Copy, Clone)] |
| 184 | $(#[$attr])* | ||
| 181 | $vis struct $name; | 185 | $vis struct $name; |
| 182 | 186 | ||
| 183 | $( | 187 | $( |
