diff options
| author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2023-05-15 15:59:30 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-05-15 15:59:30 +0000 |
| commit | 1a87f7477abdb033d960a6af63c95a9e0575e670 (patch) | |
| tree | 0523c59fe3ef2bd406d44ab414f2903c68a918b9 /examples/rp/src/bin/usb_ethernet.rs | |
| parent | 2bf2e54db925e1d8845deb5eaea737b6add95402 (diff) | |
| parent | 14a5d03af2a74eccaa9930bdf81eef43791a4b33 (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.rs | 12 |
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::*; | |||
| 6 | use embassy_executor::Spawner; | 6 | use embassy_executor::Spawner; |
| 7 | use embassy_net::tcp::TcpSocket; | 7 | use embassy_net::tcp::TcpSocket; |
| 8 | use embassy_net::{Stack, StackResources}; | 8 | use embassy_net::{Stack, StackResources}; |
| 9 | use embassy_rp::usb::Driver; | 9 | use embassy_rp::peripherals::USB; |
| 10 | use embassy_rp::{interrupt, peripherals}; | 10 | use embassy_rp::usb::{Driver, InterruptHandler}; |
| 11 | use embassy_rp::{bind_interrupts, peripherals}; | ||
| 11 | use embassy_usb::class::cdc_ncm::embassy_net::{Device, Runner, State as NetState}; | 12 | use embassy_usb::class::cdc_ncm::embassy_net::{Device, Runner, State as NetState}; |
| 12 | use embassy_usb::class::cdc_ncm::{CdcNcmClass, State}; | 13 | use embassy_usb::class::cdc_ncm::{CdcNcmClass, State}; |
| 13 | use embassy_usb::{Builder, Config, UsbDevice}; | 14 | use embassy_usb::{Builder, Config, UsbDevice}; |
| @@ -15,6 +16,10 @@ use embedded_io::asynch::Write; | |||
| 15 | use static_cell::StaticCell; | 16 | use static_cell::StaticCell; |
| 16 | use {defmt_rtt as _, panic_probe as _}; | 17 | use {defmt_rtt as _, panic_probe as _}; |
| 17 | 18 | ||
| 19 | bind_interrupts!(struct Irqs { | ||
| 20 | USBCTRL_IRQ => InterruptHandler<USB>; | ||
| 21 | }); | ||
| 22 | |||
| 18 | type MyDriver = Driver<'static, peripherals::USB>; | 23 | type MyDriver = Driver<'static, peripherals::USB>; |
| 19 | 24 | ||
| 20 | macro_rules! singleton { | 25 | macro_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); |
