Skip to content

Commit

Permalink
Rebase #144, formerly #133 to pull in USB for nrf52480
Browse files Browse the repository at this point in the history
Fixes compilation by pointing to current versions and takes in
@unrelentingtech's fork of usb-device and suggestion in
nrf-rs/nrf-hal#144 (review)

I folded in the hello world portion from japaric's PR summary text.

refs: rust-embedded-community/usb-device#51

closes: nrf-rs/nrf-hal#144
  • Loading branch information
wez authored and Disasm committed Feb 17, 2021
1 parent 2593ee4 commit 3d22bb4
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -607,7 +607,6 @@ impl UsbBus for Usbd<'_> {
errata::pre_wakeup();

regs.lowpower.write(|w| w.lowpower().force_normal());

});
}

Expand Down

0 comments on commit 3d22bb4

Please sign in to comment.