Skip to content

Commit

Permalink
Add new I2C address for SHT40-CD1B-R3
Browse files Browse the repository at this point in the history
There is this new kid on the block and the address set used by the
SHT4Tx device family has been extended. Let's prepare handling this enum
for further additions by marking it as non-exhaustive.
  • Loading branch information
sirhcel committed Oct 13, 2024
1 parent 775f4a6 commit de49afa
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,19 @@ use fixed::types::{I16F16, I18F14, U16F16};
/// I2C adresses used by STH4x sensors.
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[non_exhaustive]
pub enum Address {
Address0x44,
Address0x45,
Address0x46,
}

impl From<Address> for u8 {
fn from(address: Address) -> Self {
match address {
Address::Address0x44 => 0x44,
Address::Address0x45 => 0x45,
Address::Address0x46 => 0x46,
}
}
}
Expand Down

0 comments on commit de49afa

Please sign in to comment.