mirror of https://github.com/eldruin/ds323x-rs
Seal public types
parent
49f72014a7
commit
ed9502842d
|
@ -1,6 +1,6 @@
|
||||||
//! I2C/SPI interfaces
|
//! I2C/SPI interfaces
|
||||||
|
|
||||||
use super::{Error, DEVICE_ADDRESS};
|
use super::{private, Error, DEVICE_ADDRESS};
|
||||||
use hal::blocking;
|
use hal::blocking;
|
||||||
|
|
||||||
/// I2C interface
|
/// I2C interface
|
||||||
|
@ -17,7 +17,7 @@ pub struct SpiInterface<SPI, CS> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Write data
|
/// Write data
|
||||||
pub trait WriteData {
|
pub trait WriteData: private::Sealed {
|
||||||
/// Error type
|
/// Error type
|
||||||
type Error;
|
type Error;
|
||||||
/// Write to an u8 register
|
/// Write to an u8 register
|
||||||
|
@ -72,7 +72,7 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Read data
|
/// Read data
|
||||||
pub trait ReadData {
|
pub trait ReadData: private::Sealed {
|
||||||
/// Error type
|
/// Error type
|
||||||
type Error;
|
type Error;
|
||||||
/// Read an u8 register
|
/// Read an u8 register
|
||||||
|
|
12
src/lib.rs
12
src/lib.rs
|
@ -567,3 +567,15 @@ pub use ds323x::{
|
||||||
mod ds3231;
|
mod ds3231;
|
||||||
mod ds3232;
|
mod ds3232;
|
||||||
mod ds3234;
|
mod ds3234;
|
||||||
|
|
||||||
|
mod private {
|
||||||
|
use super::{ic, interface};
|
||||||
|
pub trait Sealed {}
|
||||||
|
|
||||||
|
impl<SPI, CS> Sealed for interface::SpiInterface<SPI, CS> {}
|
||||||
|
impl<I2C> Sealed for interface::I2cInterface<I2C> {}
|
||||||
|
|
||||||
|
impl Sealed for ic::DS3231 {}
|
||||||
|
impl Sealed for ic::DS3232 {}
|
||||||
|
impl Sealed for ic::DS3234 {}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue