From f1756787dbe8446ca30482c737b2938a94b315af Mon Sep 17 00:00:00 2001 From: Dylan McKay Date: Thu, 31 Aug 2017 02:24:24 +1200 Subject: [PATCH] Make a module public --- build.rs | 3 ++- src/lib.rs | 4 ++-- src/spi.rs | 5 ++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/build.rs b/build.rs index b1b5f56..9f1ea92 100644 --- a/build.rs +++ b/build.rs @@ -53,7 +53,8 @@ fn generate_cores_mod_rs(mcus: &[Mcu]) -> Result<(), io::Error> { fn write_core_module(mcu: &Mcu, w: &mut Write) -> Result<(), io::Error> { writeln!(w, "//! Core for {}.", mcu.device.name)?; writeln!(w)?; - writeln!(w, "use {{HardwareSpi, HardwareUsart, Register}};")?; + writeln!(w, "use {{HardwareUsart, Register}};")?; + writeln!(w, "use spi::HardwareSpi;")?; writeln!(w)?; gen::write_registers(mcu, w)?; diff --git a/src/lib.rs b/src/lib.rs index 4fc6780..6036bad 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -10,7 +10,6 @@ pub use self::reg::Register; pub use self::pin::Pin; -pub use self::spi::HardwareSpi; pub use self::usart::HardwareUsart; pub mod prelude; @@ -19,9 +18,10 @@ pub mod timer0; pub mod timer1; pub mod cores; +pub mod spi; + mod reg; mod pin; -mod spi; mod usart; pub enum DataDirection { diff --git a/src/spi.rs b/src/spi.rs index d36440a..216e24b 100644 --- a/src/spi.rs +++ b/src/spi.rs @@ -133,8 +133,7 @@ pub trait HardwareSpi { } /// Constants for the control register. -#[allow(dead_code)] -mod control_register { +pub mod control_register { pub const INTERRUPT_ENABLE: u8 = 1<<7; pub const ENABLE: u8 = 1<<6; pub const DATA_ORDER_LSB: u8 = 1<<5; @@ -151,7 +150,7 @@ mod control_register { /// Constants for the status register. #[allow(dead_code)] -mod status_register { +pub mod status_register { /// SPI interrupt flag. pub const SPIF: u8 = 1<<7; /// Write collision flag.