diff options
| author | Ulf Lilleengen <[email protected]> | 2023-12-21 08:50:54 +0100 |
|---|---|---|
| committer | Ulf Lilleengen <[email protected]> | 2023-12-21 10:29:57 +0100 |
| commit | 0acf7b09c3bc9176d00479d601356d8df2537a9b (patch) | |
| tree | 7a04543c661b38b6aba8893c9150ef8090199ee5 /examples/nrf52840/src/bin/usb_serial_multitask.rs | |
| parent | d832d45c0ba5f2624a5f5c1e549e2d7fe8bd0e01 (diff) | |
chore: replace make_static! macro usage with non-macro version
Diffstat (limited to 'examples/nrf52840/src/bin/usb_serial_multitask.rs')
| -rw-r--r-- | examples/nrf52840/src/bin/usb_serial_multitask.rs | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/examples/nrf52840/src/bin/usb_serial_multitask.rs b/examples/nrf52840/src/bin/usb_serial_multitask.rs index cd4392903..7a7bf962b 100644 --- a/examples/nrf52840/src/bin/usb_serial_multitask.rs +++ b/examples/nrf52840/src/bin/usb_serial_multitask.rs | |||
| @@ -12,7 +12,7 @@ use embassy_nrf::{bind_interrupts, pac, peripherals, usb}; | |||
| 12 | use embassy_usb::class::cdc_acm::{CdcAcmClass, State}; | 12 | use embassy_usb::class::cdc_acm::{CdcAcmClass, State}; |
| 13 | use embassy_usb::driver::EndpointError; | 13 | use embassy_usb::driver::EndpointError; |
| 14 | use embassy_usb::{Builder, Config, UsbDevice}; | 14 | use embassy_usb::{Builder, Config, UsbDevice}; |
| 15 | use static_cell::make_static; | 15 | use static_cell::StaticCell; |
| 16 | use {defmt_rtt as _, panic_probe as _}; | 16 | use {defmt_rtt as _, panic_probe as _}; |
| 17 | 17 | ||
| 18 | bind_interrupts!(struct Irqs { | 18 | bind_interrupts!(struct Irqs { |
| @@ -64,17 +64,23 @@ async fn main(spawner: Spawner) { | |||
| 64 | config.device_protocol = 0x01; | 64 | config.device_protocol = 0x01; |
| 65 | config.composite_with_iads = true; | 65 | config.composite_with_iads = true; |
| 66 | 66 | ||
| 67 | let state = make_static!(State::new()); | 67 | static STATE: StaticCell<State> = StaticCell::new(); |
| 68 | let state = STATE.init(State::new()); | ||
| 68 | 69 | ||
| 69 | // Create embassy-usb DeviceBuilder using the driver and config. | 70 | // Create embassy-usb DeviceBuilder using the driver and config. |
| 71 | static DEVICE_DESC: StaticCell<[u8; 256]> = StaticCell::new(); | ||
| 72 | static CONFIG_DESC: StaticCell<[u8; 256]> = StaticCell::new(); | ||
| 73 | static BOS_DESC: StaticCell<[u8; 256]> = StaticCell::new(); | ||
| 74 | static MSOS_DESC: StaticCell<[u8; 128]> = StaticCell::new(); | ||
| 75 | static CONTROL_BUF: StaticCell<[u8; 128]> = StaticCell::new(); | ||
| 70 | let mut builder = Builder::new( | 76 | let mut builder = Builder::new( |
| 71 | driver, | 77 | driver, |
| 72 | config, | 78 | config, |
| 73 | &mut make_static!([0; 256])[..], | 79 | &mut DEVICE_DESC.init([0; 256])[..], |
| 74 | &mut make_static!([0; 256])[..], | 80 | &mut CONFIG_DESC.init([0; 256])[..], |
| 75 | &mut make_static!([0; 256])[..], | 81 | &mut BOS_DESC.init([0; 256])[..], |
| 76 | &mut make_static!([0; 128])[..], | 82 | &mut MSOS_DESC.init([0; 128])[..], |
| 77 | &mut make_static!([0; 128])[..], | 83 | &mut CONTROL_BUF.init([0; 128])[..], |
| 78 | ); | 84 | ); |
| 79 | 85 | ||
| 80 | // Create classes on the builder. | 86 | // Create classes on the builder. |
