Skip to content

Commit

Permalink
Id can be public
Browse files Browse the repository at this point in the history
Signed-off-by: JadKHaddad <jadkhaddad@gmail.com>
  • Loading branch information
JadKHaddad committed Apr 13, 2024
1 parent ca21f21 commit f9fd674
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
7 changes: 1 addition & 6 deletions bmp180/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@ pub enum BMP180Error<I2CError> {
I2C(I2CError),
/// Invalid device ID.
InvalidId(u8),
/// Arithmetic error.
///
/// Accurs on:
/// - Deviding by zero
/// - Overflow
/// - Underflow
/// Arithmetic error, like deviding by zero, overflow, etc.
Arithmetic,
}
2 changes: 2 additions & 0 deletions bmp180/src/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
#[cfg_attr(feature = "impl-defmt-format", derive(defmt::Format))]
#[cfg_attr(feature = "impl-debug", derive(core::fmt::Debug))]
pub enum Id {
/// Valid device ID.
Valid = 0x55,
}

impl Id {
/// Check if the device ID is valid.
pub fn is_valid(id: u8) -> bool {
id == Id::Valid as u8
}
Expand Down
3 changes: 2 additions & 1 deletion bmp180/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ mod address;
mod calibration;
mod device;
mod error;
pub(crate) mod id;
mod id;
mod mode;
mod register;

Expand All @@ -32,6 +32,7 @@ pub mod fuzz;
pub use crate::address::Address;
pub use crate::calibration::Calibration;
pub use crate::error::BMP180Error;
pub use crate::id::Id;
pub use crate::mode::Mode;

#[cfg(feature = "async")]
Expand Down

0 comments on commit f9fd674

Please sign in to comment.