From 44b0fdff9c36865b6f4fdd3449c637e15bc1090a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Poulhi=C3=A8s?= Date: Sun, 19 Jul 2020 14:43:35 +0200 Subject: [PATCH 1/2] re-export interrupt macro from cortex-m-rt This is needed for proper use of #[interrupt] macro to override default handler of device specific interrupt handlers. --- tm4c123x-hal/src/lib.rs | 4 ++++ tm4c129x-hal/src/lib.rs | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/tm4c123x-hal/src/lib.rs b/tm4c123x-hal/src/lib.rs index 8260200..3772060 100644 --- a/tm4c123x-hal/src/lib.rs +++ b/tm4c123x-hal/src/lib.rs @@ -26,6 +26,10 @@ pub use tm4c123x::{self, CorePeripherals, Peripherals}; pub use tm4c_hal::{bb, delay, time}; +// Enable use of interrupt macro +#[cfg(feature = "rt")] +pub use crate::tm4c123x::interrupt; + use embedded_hal as hal; pub mod gpio; diff --git a/tm4c129x-hal/src/lib.rs b/tm4c129x-hal/src/lib.rs index f887b6a..618752c 100644 --- a/tm4c129x-hal/src/lib.rs +++ b/tm4c129x-hal/src/lib.rs @@ -28,6 +28,10 @@ pub use tm4c129x::{self, CorePeripherals, Peripherals}; pub use tm4c_hal::{bb, delay, time}; +// Enable use of interrupt macro +#[cfg(feature = "rt")] +pub use crate::tm4c129x::interrupt; + pub mod gpio; pub mod i2c; pub mod prelude; From 71b29888dbf8dc411bf2f4bddb60e13e19509141 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Poulhi=C3=A8s?= Date: Sun, 19 Jul 2020 15:59:22 +0200 Subject: [PATCH 2/2] Rename a name from a copy/paste and fix SCL pin type The macro i2c_pins was probably copied from the uart one. The type for the SCL pin was also changed from OutputMode to OD. --- tm4c-hal/src/i2c.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tm4c-hal/src/i2c.rs b/tm4c-hal/src/i2c.rs index adf1605..71cd33b 100644 --- a/tm4c-hal/src/i2c.rs +++ b/tm4c-hal/src/i2c.rs @@ -25,17 +25,19 @@ pub enum Error { #[macro_export] /// Implements the traits for an I2C peripheral macro_rules! i2c_pins { - ($UARTn:ident, + ($I2Cn:ident, scl: [$(($($sclgpio: ident)::*, $sclaf: ident)),*], sda: [$(($($sdagpio: ident)::*, $sdaaf: ident)),*], ) => { $( - unsafe impl SclPin<$UARTn> for $($sclgpio)::*>> + unsafe impl SclPin<$I2Cn> for $($sclgpio)::*> + where + T: OutputMode, {} )* $( - unsafe impl SdaPin<$UARTn> for $($sdagpio)::*> + unsafe impl SdaPin<$I2Cn> for $($sdagpio)::*> where T: OutputMode, {}