Skip to content

Commit 97d5d92

Browse files
Use void::Void as the GPIO error type
1 parent e273252 commit 97d5d92

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

src/gpio.rs

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,6 @@ pub enum Port {
7979
PH,
8080
}
8181

82-
/// Error type used by the GPIO trait impls.
83-
///
84-
/// GPIO operations cannot fail, so this is uninhabited.
85-
#[derive(Debug)]
86-
pub enum Error {}
87-
8882
macro_rules! gpio {
8983
($GPIOX:ident, $gpiox:ident, $iopxenr:ident, $PXx:ident, [
9084
$($PXi:ident: ($pxi:ident, $i:expr, $MODE:ty),)+
@@ -144,7 +138,7 @@ macro_rules! gpio {
144138
}
145139

146140
impl<MODE> OutputPin for $PXx<Output<MODE>> {
147-
type Error = super::Error;
141+
type Error = void::Void;
148142

149143
fn set_high(&mut self) -> Result<(), Self::Error> {
150144
// NOTE(unsafe) atomic write to a stateless register
@@ -175,7 +169,7 @@ macro_rules! gpio {
175169
impl<MODE> toggleable::Default for $PXx<Output<MODE>> {}
176170

177171
impl<MODE> InputPin for $PXx<Output<MODE>> {
178-
type Error = super::Error;
172+
type Error = void::Void;
179173

180174
fn is_high(&self) -> Result<bool, Self::Error> {
181175
let is_high = !self.is_low()?;
@@ -190,7 +184,7 @@ macro_rules! gpio {
190184
}
191185

192186
impl<MODE> InputPin for $PXx<Input<MODE>> {
193-
type Error = super::Error;
187+
type Error = void::Void;
194188

195189
fn is_high(&self) -> Result<bool, Self::Error> {
196190
let is_high = !self.is_low()?;
@@ -385,7 +379,7 @@ macro_rules! gpio {
385379
}
386380

387381
impl<MODE> OutputPin for $PXi<Output<MODE>> {
388-
type Error = super::Error;
382+
type Error = void::Void;
389383

390384
fn set_high(&mut self) -> Result<(), Self::Error> {
391385
// NOTE(unsafe) atomic write to a stateless register
@@ -417,7 +411,7 @@ macro_rules! gpio {
417411
impl<MODE> toggleable::Default for $PXi<Output<MODE>> {}
418412

419413
impl<MODE> InputPin for $PXi<Output<MODE>> {
420-
type Error = super::Error;
414+
type Error = void::Void;
421415

422416
fn is_high(&self) -> Result<bool, Self::Error> {
423417
let is_high = !self.is_low()?;
@@ -445,8 +439,7 @@ macro_rules! gpio {
445439
}
446440

447441
impl<MODE> InputPin for $PXi<Input<MODE>> {
448-
449-
type Error = super::Error;
442+
type Error = void::Void;
450443

451444
fn is_high(&self) -> Result<bool, Self::Error> {
452445
let is_high = !self.is_low()?;

0 commit comments

Comments
 (0)