Skip to content

Commit

Permalink
Added 'std' feature and implemented std::error::Error for Error<E>
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroenvervaeke committed Sep 12, 2021
1 parent ec56469 commit 63c644d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Cargo.toml
Expand Up @@ -30,3 +30,6 @@ embedded-hal-mock = "0.7"

[profile.release]
lto = true

[features]
std = []
6 changes: 6 additions & 0 deletions src/types.rs
Expand Up @@ -2,6 +2,9 @@ use crate::config::Config;
use core::convert::TryFrom;
use core::fmt::{Display, Formatter};

#[cfg(feature = "std")]
extern crate std;

const DEVICE_BASE_ADDRESS: u8 = 0b100_0000;

/// PCA9685 PWM/Servo/LED controller.
Expand Down Expand Up @@ -34,6 +37,9 @@ impl<E: Display> Display for Error<E> {
}
}

#[cfg(feature = "std")]
impl<E: std::error::Error> std::error::Error for Error<E> {}

/// Output channel selection
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum Channel {
Expand Down

0 comments on commit 63c644d

Please sign in to comment.