Browse Source

Merge pull request #19 from david-sawatzke/send_sync

Add Send & Sync impls for Pin
features/pwm
Daniel Egger 4 years ago committed by GitHub
parent
commit
b07a4885ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      CHANGELOG.md
  2. 6
      src/gpio.rs

4
CHANGELOG.md

@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased]
### Added
- Added Sync & Send ability to Pin
## [v0.10.0] - 2018-12-23
### Added

6
src/gpio.rs

@ -65,6 +65,12 @@ pub struct Pin<MODE> {
_mode: PhantomData<MODE>,
}
// NOTE(unsafe) The only write acess is to BSRR, which is thread safe
unsafe impl<MODE> Sync for Pin<MODE> {}
// NOTE(unsafe) this only enables read access to the same pin from multiple
// threads
unsafe impl<MODE> Send for Pin<MODE> {}
impl<MODE> StatefulOutputPin for Pin<Output<MODE>> {
fn is_set_high(&self) -> bool {
!self.is_set_low()

Loading…
Cancel
Save