Skip to content

Commit 028abb9

Browse files
authored
Merge pull request #115 from ia0/polyfill
Support architectures without atomics with polyfill
2 parents 4ad3f72 + 9c266b9 commit 028abb9

File tree

4 files changed

+4
-2
lines changed

4 files changed

+4
-2
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1111
* New enums and allocators for Isochronous endpoints ([#60](https://github.com/rust-embedded-community/usb-device/pull/60)).
1212
* Ability to select USB revision ([#116](https://github.com/rust-embedded-community/usb-device/pull/116)).
1313
* Added support for alternate settings on interfaces ([#114](https://github.com/rust-embedded-community/usb-device/pull/114)).
14+
* Added support for architectures without atomics ([#115](https://github.com/rust-embedded-community/usb-device/pull/115)).
1415

1516
### Changed
1617
* `EndpointType` enum now has fields for isochronous synchronization and usage ([#60](https://github.com/rust-embedded-community/usb-device/pull/60)).

Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ repository = "https://github.com/mvirkkunen/usb-device"
1111

1212
[dependencies]
1313
defmt = { version = "0.3", optional = true }
14+
portable-atomic = { version = "1.2.0", default-features = false }
1415

1516
[dev-dependencies]
1617
rusb = "0.9.1"

src/bus.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::{Result, UsbDirection, UsbError};
66
use core::cell::RefCell;
77
use core::mem;
88
use core::ptr;
9-
use core::sync::atomic::{AtomicPtr, Ordering};
9+
use portable_atomic::{AtomicPtr, Ordering};
1010

1111
/// A trait for device-specific USB peripherals. Implement this to add support for a new hardware
1212
/// platform.

src/endpoint.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::bus::UsbBus;
22
use crate::{Result, UsbDirection};
33
use core::marker::PhantomData;
4-
use core::sync::atomic::{AtomicPtr, Ordering};
4+
use portable_atomic::{AtomicPtr, Ordering};
55

66
/// Trait for endpoint type markers.
77
pub trait EndpointDirection {

0 commit comments

Comments
 (0)