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-nrf/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-nrf/src')
| -rw-r--r-- | embassy-nrf/src/lib.rs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/embassy-nrf/src/lib.rs b/embassy-nrf/src/lib.rs index 7d86e1218..0c5dd059d 100644 --- a/embassy-nrf/src/lib.rs +++ b/embassy-nrf/src/lib.rs | |||
| @@ -200,9 +200,12 @@ mod chip; | |||
| 200 | /// ```rust,ignore | 200 | /// ```rust,ignore |
| 201 | /// use embassy_nrf::{bind_interrupts, spim, peripherals}; | 201 | /// use embassy_nrf::{bind_interrupts, spim, peripherals}; |
| 202 | /// | 202 | /// |
| 203 | /// bind_interrupts!(struct Irqs { | 203 | /// bind_interrupts!( |
| 204 | /// SPIM3 => spim::InterruptHandler<peripherals::SPI3>; | 204 | /// /// Binds the SPIM3 interrupt. |
| 205 | /// }); | 205 | /// struct Irqs { |
| 206 | /// SPIM3 => spim::InterruptHandler<peripherals::SPI3>; | ||
| 207 | /// } | ||
| 208 | /// ); | ||
| 206 | /// ``` | 209 | /// ``` |
| 207 | /// | 210 | /// |
| 208 | /// Example of how to bind multiple interrupts in a single macro invocation: | 211 | /// Example of how to bind multiple interrupts in a single macro invocation: |
| @@ -219,7 +222,7 @@ mod chip; | |||
| 219 | // developer note: this macro can't be in `embassy-hal-internal` due to the use of `$crate`. | 222 | // developer note: this macro can't be in `embassy-hal-internal` due to the use of `$crate`. |
| 220 | #[macro_export] | 223 | #[macro_export] |
| 221 | macro_rules! bind_interrupts { | 224 | macro_rules! bind_interrupts { |
| 222 | ($vis:vis struct $name:ident { | 225 | ($(#[$attr:meta])* $vis:vis struct $name:ident { |
| 223 | $( | 226 | $( |
| 224 | $(#[cfg($cond_irq:meta)])? | 227 | $(#[cfg($cond_irq:meta)])? |
| 225 | $irq:ident => $( | 228 | $irq:ident => $( |
| @@ -229,6 +232,7 @@ macro_rules! bind_interrupts { | |||
| 229 | )* | 232 | )* |
| 230 | }) => { | 233 | }) => { |
| 231 | #[derive(Copy, Clone)] | 234 | #[derive(Copy, Clone)] |
| 235 | $(#[$attr])* | ||
| 232 | $vis struct $name; | 236 | $vis struct $name; |
| 233 | 237 | ||
| 234 | $( | 238 | $( |
