diff --git a/CHANGELOG.md b/CHANGELOG.md index 21d83ff..b9ec7a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. * New enums and allocators for Isochronous endpoints ([#60](https://github.com/rust-embedded-community/usb-device/pull/60)). * Ability to select USB revision ([#116](https://github.com/rust-embedded-community/usb-device/pull/116)). * Added support for alternate settings on interfaces ([#114](https://github.com/rust-embedded-community/usb-device/pull/114)). +* Added support for architectures without atomics ([#115](https://github.com/rust-embedded-community/usb-device/pull/115)). ### Changed * `EndpointType` enum now has fields for isochronous synchronization and usage ([#60](https://github.com/rust-embedded-community/usb-device/pull/60)). diff --git a/Cargo.toml b/Cargo.toml index e1da13e..7693656 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,6 +11,7 @@ repository = "https://github.com/mvirkkunen/usb-device" [dependencies] defmt = { version = "0.3", optional = true } +portable-atomic = { version = "1.2.0", default-features = false } [dev-dependencies] rusb = "0.9.1" diff --git a/src/bus.rs b/src/bus.rs index 8c8531d..398b192 100644 --- a/src/bus.rs +++ b/src/bus.rs @@ -6,7 +6,7 @@ use crate::{Result, UsbDirection, UsbError}; use core::cell::RefCell; use core::mem; use core::ptr; -use core::sync::atomic::{AtomicPtr, Ordering}; +use portable_atomic::{AtomicPtr, Ordering}; /// A trait for device-specific USB peripherals. Implement this to add support for a new hardware /// platform. diff --git a/src/endpoint.rs b/src/endpoint.rs index de7c75f..2b31eec 100644 --- a/src/endpoint.rs +++ b/src/endpoint.rs @@ -1,7 +1,7 @@ use crate::bus::UsbBus; use crate::{Result, UsbDirection}; use core::marker::PhantomData; -use core::sync::atomic::{AtomicPtr, Ordering}; +use portable_atomic::{AtomicPtr, Ordering}; /// Trait for endpoint type markers. pub trait EndpointDirection {