From 3d22bb41f24376208bd62bb84e0491edeab641f6 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Sun, 14 Feb 2021 12:47:23 -0800 Subject: [PATCH] Rebase #144, formerly #133 to pull in USB for nrf52480 Fixes compilation by pointing to current versions and takes in @unrelentingtech's fork of usb-device and suggestion in https://github.com/nrf-rs/nrf-hal/pull/144#pullrequestreview-574865733 I folded in the hello world portion from japaric's PR summary text. refs: https://github.com/mvirkkunen/usb-device/pull/51 closes: https://github.com/nrf-rs/nrf-hal/pull/144 --- mod.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mod.rs b/mod.rs index 043b15a..ec5ac8a 100644 --- a/mod.rs +++ b/mod.rs @@ -10,7 +10,7 @@ mod errata; use crate::{ clocks::{Clocks, ExternalOscillator}, - target::USBD, + pac::USBD, }; use core::sync::atomic::{compiler_fence, Ordering}; use core::{cell::Cell, mem, ptr, slice}; @@ -470,7 +470,7 @@ impl UsbBus for Usbd<'_> { // stage and must be followed by us responding with an ACK token to an OUT token // sent from the host (AKA the status stage) -- `usb-device` provides no call back // for that so we'll trigger the status stage using a shortcut - let is_short_packet = buf.len() < self.max_packet_size_0.into(); + let is_short_packet = buf.len() < self.max_packet_size_0 as usize; regs.shorts.modify(|_, w| { if is_short_packet { w.ep0datadone_ep0status().set_bit() @@ -572,7 +572,7 @@ impl UsbBus for Usbd<'_> { unsafe { if ep_addr.index() == 0 { - regs.tasks_ep0stall.write(|w| w.tasks_ep0stall().set_bit()); + regs.tasks_ep0stall.write(|w| w.tasks_ep0stall().bit(stalled)); } else { regs.epstall.write(|w| { w.ep() @@ -607,7 +607,6 @@ impl UsbBus for Usbd<'_> { errata::pre_wakeup(); regs.lowpower.write(|w| w.lowpower().force_normal()); - }); }