Seal public types

pull/4/head
Diego Barrios Romero 2019-05-16 19:24:25 +02:00
parent 49f72014a7
commit ed9502842d
2 changed files with 15 additions and 3 deletions

View File

@ -1,6 +1,6 @@
//! I2C/SPI interfaces
use super::{Error, DEVICE_ADDRESS};
use super::{private, Error, DEVICE_ADDRESS};
use hal::blocking;
/// I2C interface
@ -17,7 +17,7 @@ pub struct SpiInterface<SPI, CS> {
}
/// Write data
pub trait WriteData {
pub trait WriteData: private::Sealed {
/// Error type
type Error;
/// Write to an u8 register
@ -72,7 +72,7 @@ where
}
/// Read data
pub trait ReadData {
pub trait ReadData: private::Sealed {
/// Error type
type Error;
/// Read an u8 register

View File

@ -567,3 +567,15 @@ pub use ds323x::{
mod ds3231;
mod ds3232;
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 {}
}