Skip to content

Commit 9c9c6e1

Browse files
authored
Merge pull request #103 from TheZoq2/master
Remove OutputPin impl for Alternate mode pins
2 parents 1350f81 + b8207f6 commit 9c9c6e1

File tree

2 files changed

+1
-24
lines changed

2 files changed

+1
-24
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1414
### Breaking changes
1515

1616
- Change timer/pwm init API
17+
- Remove `set_low` and `set_high` for pins in Alternate output mode
1718

1819
### Changed
1920

src/gpio.rs

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -479,30 +479,6 @@ macro_rules! gpio {
479479

480480
impl<MODE> toggleable::Default for $PXi<Output<MODE>> {}
481481

482-
impl<MODE> OutputPin for $PXi<Alternate<MODE>> {
483-
type Error = Void;
484-
fn set_high(&mut self) -> Result<(), Self::Error> {
485-
// NOTE(unsafe) atomic write to a stateless register
486-
Ok(unsafe { (*$GPIOX::ptr()).bsrr.write(|w| w.bits(1 << $i)) })
487-
}
488-
489-
fn set_low(&mut self) -> Result<(), Self::Error> {
490-
// NOTE(unsafe) atomic write to a stateless register
491-
Ok(unsafe { (*$GPIOX::ptr()).bsrr.write(|w| w.bits(1 << (16 + $i))) })
492-
}
493-
}
494-
495-
impl<MODE> StatefulOutputPin for $PXi<Alternate<MODE>> {
496-
fn is_set_high(&self) -> Result<bool, Self::Error> {
497-
self.is_set_low().map(|b| !b)
498-
}
499-
500-
fn is_set_low(&self) -> Result<bool, Self::Error> {
501-
// NOTE(unsafe) atomic read with no side effects
502-
Ok(unsafe { (*$GPIOX::ptr()).odr.read().bits() & (1 << $i) == 0 })
503-
}
504-
}
505-
506482
impl<MODE> InputPin for $PXi<Input<MODE>> {
507483
type Error = Void;
508484
fn is_high(&self) -> Result<bool, Self::Error> {

0 commit comments

Comments
 (0)