aboutsummaryrefslogtreecommitdiff
path: root/examples/rp/src/bin/usb_ethernet.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_ethernet.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_ethernet.rs')
-rw-r--r--examples/rp/src/bin/usb_ethernet.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/examples/rp/src/bin/usb_ethernet.rs b/examples/rp/src/bin/usb_ethernet.rs
index 431db63eb..38ff1620d 100644
--- a/examples/rp/src/bin/usb_ethernet.rs
+++ b/examples/rp/src/bin/usb_ethernet.rs
@@ -6,8 +6,9 @@ use defmt::*;
6use embassy_executor::Spawner; 6use embassy_executor::Spawner;
7use embassy_net::tcp::TcpSocket; 7use embassy_net::tcp::TcpSocket;
8use embassy_net::{Stack, StackResources}; 8use embassy_net::{Stack, StackResources};
9use embassy_rp::usb::Driver; 9use embassy_rp::peripherals::USB;
10use embassy_rp::{interrupt, peripherals}; 10use embassy_rp::usb::{Driver, InterruptHandler};
11use embassy_rp::{bind_interrupts, peripherals};
11use embassy_usb::class::cdc_ncm::embassy_net::{Device, Runner, State as NetState}; 12use embassy_usb::class::cdc_ncm::embassy_net::{Device, Runner, State as NetState};
12use embassy_usb::class::cdc_ncm::{CdcNcmClass, State}; 13use embassy_usb::class::cdc_ncm::{CdcNcmClass, State};
13use embassy_usb::{Builder, Config, UsbDevice}; 14use embassy_usb::{Builder, Config, UsbDevice};
@@ -15,6 +16,10 @@ use embedded_io::asynch::Write;
15use static_cell::StaticCell; 16use static_cell::StaticCell;
16use {defmt_rtt as _, panic_probe as _}; 17use {defmt_rtt as _, panic_probe as _};
17 18
19bind_interrupts!(struct Irqs {
20 USBCTRL_IRQ => InterruptHandler<USB>;
21});
22
18type MyDriver = Driver<'static, peripherals::USB>; 23type MyDriver = Driver<'static, peripherals::USB>;
19 24
20macro_rules! singleton { 25macro_rules! singleton {
@@ -48,8 +53,7 @@ async fn main(spawner: Spawner) {
48 let p = embassy_rp::init(Default::default()); 53 let p = embassy_rp::init(Default::default());
49 54
50 // Create the driver, from the HAL. 55 // Create the driver, from the HAL.
51 let irq = interrupt::take!(USBCTRL_IRQ); 56 let driver = Driver::new(p.USB, Irqs);
52 let driver = Driver::new(p.USB, irq);
53 57
54 // Create embassy-usb Config 58 // Create embassy-usb Config
55 let mut config = Config::new(0xc0de, 0xcafe); 59 let mut config = Config::new(0xc0de, 0xcafe);