aboutsummaryrefslogtreecommitdiff
path: root/examples/rp/src/bin/usb_serial.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_serial.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_serial.rs')
-rw-r--r--examples/rp/src/bin/usb_serial.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/examples/rp/src/bin/usb_serial.rs b/examples/rp/src/bin/usb_serial.rs
index 8160a1875..ca728536c 100644
--- a/examples/rp/src/bin/usb_serial.rs
+++ b/examples/rp/src/bin/usb_serial.rs
@@ -5,13 +5,18 @@
5use defmt::{info, panic}; 5use defmt::{info, panic};
6use embassy_executor::Spawner; 6use embassy_executor::Spawner;
7use embassy_futures::join::join; 7use embassy_futures::join::join;
8use embassy_rp::interrupt; 8use embassy_rp::bind_interrupts;
9use embassy_rp::usb::{Driver, Instance}; 9use embassy_rp::peripherals::USB;
10use embassy_rp::usb::{Driver, Instance, InterruptHandler};
10use embassy_usb::class::cdc_acm::{CdcAcmClass, State}; 11use embassy_usb::class::cdc_acm::{CdcAcmClass, State};
11use embassy_usb::driver::EndpointError; 12use embassy_usb::driver::EndpointError;
12use embassy_usb::{Builder, Config}; 13use embassy_usb::{Builder, Config};
13use {defmt_rtt as _, panic_probe as _}; 14use {defmt_rtt as _, panic_probe as _};
14 15
16bind_interrupts!(struct Irqs {
17 USBCTRL_IRQ => InterruptHandler<USB>;
18});
19
15#[embassy_executor::main] 20#[embassy_executor::main]
16async fn main(_spawner: Spawner) { 21async fn main(_spawner: Spawner) {
17 info!("Hello there!"); 22 info!("Hello there!");
@@ -19,8 +24,7 @@ async fn main(_spawner: Spawner) {
19 let p = embassy_rp::init(Default::default()); 24 let p = embassy_rp::init(Default::default());
20 25
21 // Create the driver, from the HAL. 26 // Create the driver, from the HAL.
22 let irq = interrupt::take!(USBCTRL_IRQ); 27 let driver = Driver::new(p.USB, Irqs);
23 let driver = Driver::new(p.USB, irq);
24 28
25 // Create embassy-usb Config 29 // Create embassy-usb Config
26 let mut config = Config::new(0xc0de, 0xcafe); 30 let mut config = Config::new(0xc0de, 0xcafe);