Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ repository = "https://github.com/rust-embedded-community/usb-device"

[dependencies]
defmt = { version = "0.3", optional = true }
portable-atomic = { version = "1.2.0", default-features = false }
portable-atomic = { version = "1.2.0", default-features = false, optional = true }
heapless = "0.8"
log = { version = "0.4", default-features = false, optional = true}

Expand All @@ -20,13 +20,15 @@ rusb = "0.9.1"
rand = "0.8.5"

[features]
default = ["portable-atomic"]

# Use larger endpoint buffers for highspeed operation (default fullspeed)
#
# Note: usb-device doesn't truly support high speed enumeration yet, so setting this will make
# TestClass only compliant with high speed mode. It may still manage to be enumerated as a full
# speed device, but the descriptors will be invalid.
test-class-high-speed = []
portable-atomic = ["dep:portable-atomic"]

[[test]]
name = "test_class_host"
Expand Down
3 changes: 3 additions & 0 deletions src/bus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ use crate::{Result, UsbDirection, UsbError};
use core::cell::RefCell;
use core::mem;
use core::ptr;
#[cfg(feature = "portable-atomic")]
use portable_atomic::{AtomicPtr, Ordering};
#[cfg(not(feature = "portable-atomic"))]
use core::sync::atomic::{AtomicPtr, Ordering};

/// A trait for device-specific USB peripherals. Implement this to add support for a new hardware
/// platform.
Expand Down
3 changes: 3 additions & 0 deletions src/endpoint.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
use crate::bus::UsbBus;
use crate::{Result, UsbDirection};
use core::marker::PhantomData;
#[cfg(feature = "portable-atomic")]
use portable_atomic::{AtomicPtr, Ordering};
#[cfg(not(feature = "portable-atomic"))]
use core::sync::atomic::{AtomicPtr, Ordering};

/// Trait for endpoint type markers.
pub trait EndpointDirection {
Expand Down