diff options
author | Determinant <ted.sybil@gmail.com> | 2017-10-18 15:52:06 -0400 |
---|---|---|
committer | Determinant <ted.sybil@gmail.com> | 2017-10-18 15:52:06 -0400 |
commit | d09fadccb157c47c10a2edfbb3b229dda53a0ee1 (patch) | |
tree | d23ea4eade859a2a1594fefda4e96a46b1c67430 /src/ds3231.rs | |
parent | 6e0b5539fd440208edd9ec995ca35a93413843ba (diff) |
reduce unsafe blocks
Diffstat (limited to 'src/ds3231.rs')
-rw-r--r-- | src/ds3231.rs | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/src/ds3231.rs b/src/ds3231.rs index 07e99f1..bd23fdd 100644 --- a/src/ds3231.rs +++ b/src/ds3231.rs @@ -5,7 +5,7 @@ const DS3231_REG_SEC: u8 = 0x00; const DS3231_REG_CTL: u8 = 0x0e; const DS3231_REG_TEMP: u8 = 0x11; -pub struct DS3231<'a>(&'a I2C<'a>); +pub struct DS3231<'a>(pub &'a I2C<'a>); pub struct Date { pub second: u8, @@ -25,10 +25,6 @@ pub struct Temp { } impl<'a> DS3231<'a> { - pub fn new(i2c: &'a I2C<'a>) -> DS3231<'a> { - DS3231(i2c) - } - fn bcd2dec(bcd: u8) -> u8 { (bcd >> 4) * 10 + (bcd & 0x0f) } |