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-imxrt/src/lib.rs | |
| 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-imxrt/src/lib.rs')
| -rw-r--r-- | embassy-imxrt/src/lib.rs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/embassy-imxrt/src/lib.rs b/embassy-imxrt/src/lib.rs index b1183d8fc..5b7341fbd 100644 --- a/embassy-imxrt/src/lib.rs +++ b/embassy-imxrt/src/lib.rs | |||
| @@ -54,16 +54,20 @@ pub use crate::pac::NVIC_PRIO_BITS; | |||
| 54 | /// ```rust,ignore | 54 | /// ```rust,ignore |
| 55 | /// use embassy_imxrt::{bind_interrupts, flexspi, peripherals}; | 55 | /// use embassy_imxrt::{bind_interrupts, flexspi, peripherals}; |
| 56 | /// | 56 | /// |
| 57 | /// bind_interrupts!(struct Irqs { | 57 | /// bind_interrupts!( |
| 58 | /// FLEXSPI_IRQ => flexspi::InterruptHandler<peripherals::FLEXSPI>; | 58 | /// /// Binds the FLEXSPI interrupt. |
| 59 | /// }); | 59 | /// struct Irqs { |
| 60 | /// FLEXSPI_IRQ => flexspi::InterruptHandler<peripherals::FLEXSPI>; | ||
| 61 | /// } | ||
| 62 | /// ); | ||
| 60 | /// ``` | 63 | /// ``` |
| 61 | /// | 64 | /// |
| 62 | // developer note: this macro can't be in `embassy-hal-internal` due to the use of `$crate`. | 65 | // developer note: this macro can't be in `embassy-hal-internal` due to the use of `$crate`. |
| 63 | #[macro_export] | 66 | #[macro_export] |
| 64 | macro_rules! bind_interrupts { | 67 | macro_rules! bind_interrupts { |
| 65 | ($vis:vis struct $name:ident { $($irq:ident => $($handler:ty),*;)* }) => { | 68 | ($(#[$attr:meta])* $vis:vis struct $name:ident { $($irq:ident => $($handler:ty),*;)* }) => { |
| 66 | #[derive(Copy, Clone)] | 69 | #[derive(Copy, Clone)] |
| 70 | $(#[$attr])* | ||
| 67 | $vis struct $name; | 71 | $vis struct $name; |
| 68 | 72 | ||
| 69 | $( | 73 | $( |
