add the possibility to document bind_interrupts structs

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.
This commit is contained in:
Ralph Ursprung
2025-05-15 17:53:31 +02:00
parent d1c2ce927a
commit 117eb45fa0
5 changed files with 38 additions and 20 deletions

View File

@@ -200,9 +200,12 @@ mod chip;
/// ```rust,ignore
/// use embassy_nrf::{bind_interrupts, spim, peripherals};
///
/// bind_interrupts!(struct Irqs {
/// SPIM3 => spim::InterruptHandler<peripherals::SPI3>;
/// });
/// bind_interrupts!(
/// /// Binds the SPIM3 interrupt.
/// struct Irqs {
/// SPIM3 => spim::InterruptHandler<peripherals::SPI3>;
/// }
/// );
/// ```
///
/// Example of how to bind multiple interrupts in a single macro invocation:
@@ -219,7 +222,7 @@ mod chip;
// developer note: this macro can't be in `embassy-hal-internal` due to the use of `$crate`.
#[macro_export]
macro_rules! bind_interrupts {
($vis:vis struct $name:ident {
($(#[$attr:meta])* $vis:vis struct $name:ident {
$(
$(#[cfg($cond_irq:meta)])?
$irq:ident => $(
@@ -229,6 +232,7 @@ macro_rules! bind_interrupts {
)*
}) => {
#[derive(Copy, Clone)]
$(#[$attr])*
$vis struct $name;
$(