aboutsummaryrefslogtreecommitdiff
path: root/embassy-nrf
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2023-12-08 21:26:28 +0100
committerDario Nieuwenhuis <[email protected]>2023-12-08 21:26:28 +0100
commit6c746dcf3944fdd2901697c2bab107033458e22c (patch)
treeb54ff7b6feab720e2ffca7e91e5eee099a0a4cf8 /embassy-nrf
parent3ef18ec133b681d0ad3d25c050b5b960483c444e (diff)
Document how to bind multiple interrupts and handlers in `bind_interrupts!`.
Diffstat (limited to 'embassy-nrf')
-rw-r--r--embassy-nrf/src/lib.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/embassy-nrf/src/lib.rs b/embassy-nrf/src/lib.rs
index 3274dafb1..9093ad919 100644
--- a/embassy-nrf/src/lib.rs
+++ b/embassy-nrf/src/lib.rs
@@ -97,6 +97,28 @@ mod chip;
97/// This defines the right interrupt handlers, and creates a unit struct (like `struct Irqs;`) 97/// This defines the right interrupt handlers, and creates a unit struct (like `struct Irqs;`)
98/// and implements the right [`Binding`]s for it. You can pass this struct to drivers to 98/// and implements the right [`Binding`]s for it. You can pass this struct to drivers to
99/// prove at compile-time that the right interrupts have been bound. 99/// prove at compile-time that the right interrupts have been bound.
100///
101/// Example of how to bind one interrupt:
102///
103/// ```rust,ignore
104/// use embassy_nrf::{bind_interrupts, spim, peripherals};
105///
106/// bind_interrupts!(struct Irqs {
107/// SPIM3 => spim::InterruptHandler<peripherals::SPI3>;
108/// });
109/// ```
110///
111/// Example of how to bind multiple interrupts in a single macro invocation:
112///
113/// ```rust,ignore
114/// use embassy_nrf::{bind_interrupts, spim, twim, peripherals};
115///
116/// bind_interrupts!(struct Irqs {
117/// SPIM3 => spim::InterruptHandler<peripherals::SPI3>;
118/// SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0 => twim::InterruptHandler<peripherals::TWISPI0>;
119/// });
120/// ```
121
100// developer note: this macro can't be in `embassy-hal-internal` due to the use of `$crate`. 122// developer note: this macro can't be in `embassy-hal-internal` due to the use of `$crate`.
101#[macro_export] 123#[macro_export]
102macro_rules! bind_interrupts { 124macro_rules! bind_interrupts {