Skip to content

Commit a73d1c2

Browse files
authored
Merge pull request #95 from Sh3Rm4n/infallible
Switch to Infallible error type
2 parents 59ac083 + 4742bf4 commit a73d1c2

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/gpio.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//! General Purpose Input / Output
22
3+
use core::convert::Infallible;
34
use core::marker::PhantomData;
45

56
#[cfg(feature = "unproven")]
@@ -142,7 +143,7 @@ macro_rules! gpio {
142143
}
143144

144145
impl<MODE> OutputPin for PXx<Output<MODE>> {
145-
type Error = ();
146+
type Error = Infallible;
146147

147148
fn set_high(&mut self) -> Result<(), Self::Error> {
148149
// NOTE(unsafe, write) atomic write to a stateless register
@@ -181,7 +182,7 @@ macro_rules! gpio {
181182

182183
#[cfg(feature = "unproven")]
183184
impl<MODE> InputPin for PXx<Input<MODE>> {
184-
type Error = ();
185+
type Error = Infallible;
185186

186187
fn is_high(&self) -> Result<bool, Self::Error> {
187188
Ok(!self.is_low()?)
@@ -239,6 +240,7 @@ macro_rules! gpio {
239240
))))]
240241
pub mod $gpiox {
241242
use core::marker::PhantomData;
243+
use core::convert::Infallible;
242244

243245
use crate::hal::digital::v2::OutputPin;
244246
#[cfg(feature = "unproven")]
@@ -380,7 +382,7 @@ macro_rules! gpio {
380382
}
381383

382384
impl<MODE> OutputPin for $PXx<Output<MODE>> {
383-
type Error = ();
385+
type Error = Infallible;
384386

385387
fn set_high(&mut self) -> Result<(), Self::Error> {
386388
// NOTE(unsafe, write) atomic write to a stateless register
@@ -397,7 +399,7 @@ macro_rules! gpio {
397399

398400
#[cfg(feature = "unproven")]
399401
impl<MODE> InputPin for $PXx<Input<MODE>> {
400-
type Error = ();
402+
type Error = Infallible;
401403

402404
fn is_high(&self) -> Result<bool, Self::Error> {
403405
Ok(!self.is_low()?)
@@ -656,7 +658,7 @@ macro_rules! gpio {
656658
}
657659

658660
impl<MODE> OutputPin for $PXi<Output<MODE>> {
659-
type Error = ();
661+
type Error = Infallible;
660662

661663
fn set_high(&mut self) -> Result<(), Self::Error> {
662664
// NOTE(unsafe, write) atomic write to a stateless register
@@ -673,7 +675,7 @@ macro_rules! gpio {
673675

674676
#[cfg(feature = "unproven")]
675677
impl<MODE> InputPin for $PXi<Input<MODE>> {
676-
type Error = ();
678+
type Error = Infallible;
677679

678680
fn is_high(&self) -> Result<bool, Self::Error> {
679681
Ok(!self.is_low()?)

0 commit comments

Comments
 (0)