aboutsummaryrefslogtreecommitdiff
path: root/examples/rp/src/bin/usb_logger.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2023-05-15 15:59:30 +0000
committerGitHub <[email protected]>2023-05-15 15:59:30 +0000
commit1a87f7477abdb033d960a6af63c95a9e0575e670 (patch)
tree0523c59fe3ef2bd406d44ab414f2903c68a918b9 /examples/rp/src/bin/usb_logger.rs
parent2bf2e54db925e1d8845deb5eaea737b6add95402 (diff)
parent14a5d03af2a74eccaa9930bdf81eef43791a4b33 (diff)
Merge #1458
1458: rp: remove take!, add bind_interrupts! r=Dirbaio a=pennae both of the uart interrupts now check a flag that only the dma rx path ever sets (and now unsets again on drop) to return early if it's not as they expect. this is ... not our preferred solution, but if bind_interrupts *must* allow mutiple handlers to be specified then this is the only way we can think of that doesn't break uarts. Co-authored-by: pennae <[email protected]>
Diffstat (limited to 'examples/rp/src/bin/usb_logger.rs')
-rw-r--r--examples/rp/src/bin/usb_logger.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/examples/rp/src/bin/usb_logger.rs b/examples/rp/src/bin/usb_logger.rs
index 52417a02e..7c90d0ca3 100644
--- a/examples/rp/src/bin/usb_logger.rs
+++ b/examples/rp/src/bin/usb_logger.rs
@@ -3,12 +3,16 @@
3#![feature(type_alias_impl_trait)] 3#![feature(type_alias_impl_trait)]
4 4
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_rp::interrupt; 6use embassy_rp::bind_interrupts;
7use embassy_rp::peripherals::USB; 7use embassy_rp::peripherals::USB;
8use embassy_rp::usb::Driver; 8use embassy_rp::usb::{Driver, InterruptHandler};
9use embassy_time::{Duration, Timer}; 9use embassy_time::{Duration, Timer};
10use {defmt_rtt as _, panic_probe as _}; 10use {defmt_rtt as _, panic_probe as _};
11 11
12bind_interrupts!(struct Irqs {
13 USBCTRL_IRQ => InterruptHandler<USB>;
14});
15
12#[embassy_executor::task] 16#[embassy_executor::task]
13async fn logger_task(driver: Driver<'static, USB>) { 17async fn logger_task(driver: Driver<'static, USB>) {
14 embassy_usb_logger::run!(1024, log::LevelFilter::Info, driver); 18 embassy_usb_logger::run!(1024, log::LevelFilter::Info, driver);
@@ -17,8 +21,7 @@ async fn logger_task(driver: Driver<'static, USB>) {
17#[embassy_executor::main] 21#[embassy_executor::main]
18async fn main(spawner: Spawner) { 22async fn main(spawner: Spawner) {
19 let p = embassy_rp::init(Default::default()); 23 let p = embassy_rp::init(Default::default());
20 let irq = interrupt::take!(USBCTRL_IRQ); 24 let driver = Driver::new(p.USB, Irqs);
21 let driver = Driver::new(p.USB, irq);
22 spawner.spawn(logger_task(driver)).unwrap(); 25 spawner.spawn(logger_task(driver)).unwrap();
23 26
24 let mut counter = 0; 27 let mut counter = 0;