diff --git a/examples/blinky-blocking.rs b/examples/blinky-blocking.rs index 50dd31205438eb1c94127b72c7d4c359629175f7..8c529f90e5d175882e857534ea54b5109d1d444c 100644 --- a/examples/blinky-blocking.rs +++ b/examples/blinky-blocking.rs @@ -14,7 +14,7 @@ extern crate cortex_m_rtfm as rtfm; extern crate nb; use blue_pill::Timer; -use blue_pill::led::{self, Green}; +use blue_pill::led::{self, PC13}; use blue_pill::prelude::*; use blue_pill::time::Hertz; use rtfm::{app, Threshold}; @@ -48,9 +48,9 @@ fn idle(_t: &mut Threshold, r: idle::Resources) -> ! { state = !state; if state { - Green.on(); + PC13.on(); } else { - Green.off(); + PC13.off(); } } } diff --git a/examples/blinky.rs b/examples/blinky.rs index 4020fae4597487c4ec2021ca3f7ee60b91d3a80d..cfd02d83051b34a8c9608a6484d9b060d065cc8d 100644 --- a/examples/blinky.rs +++ b/examples/blinky.rs @@ -8,7 +8,7 @@ extern crate blue_pill; extern crate cortex_m; extern crate cortex_m_rtfm as rtfm; -use blue_pill::led::{self, Green}; +use blue_pill::led::{self, PC13}; use cortex_m::peripheral::SystClkSource; use rtfm::{app, Threshold}; @@ -48,8 +48,8 @@ fn toggle(_t: &mut Threshold, r: SYS_TICK::Resources) { **r.ON = !**r.ON; if **r.ON { - Green.on(); + PC13.on(); } else { - Green.off(); + PC13.off(); } } diff --git a/examples/concurrent.rs b/examples/concurrent.rs index 10abc90c7e224b3a53a397854a5d2abc86b3affa..d0ea6f1f70f2426eec76c573d41bbd5472e8fef6 100644 --- a/examples/concurrent.rs +++ b/examples/concurrent.rs @@ -9,7 +9,7 @@ extern crate cortex_m; extern crate cortex_m_rtfm as rtfm; use blue_pill::Serial; -use blue_pill::led::{self, Green}; +use blue_pill::led::{self, PC13}; use blue_pill::prelude::*; use blue_pill::serial::Event; use blue_pill::time::Hertz; @@ -69,8 +69,8 @@ fn toggle(_t: &mut Threshold, r: SYS_TICK::Resources) { **r.ON = !**r.ON; if **r.ON { - Green.on(); + PC13.on(); } else { - Green.off(); + PC13.off(); } } diff --git a/examples/led.rs b/examples/led.rs index 64143f46a4c87c7b7284ddd6f28fa09f37a35a3c..a8473b7a333d9493bb9fb8e66102809dfc646eeb 100644 --- a/examples/led.rs +++ b/examples/led.rs @@ -8,7 +8,7 @@ extern crate blue_pill; extern crate cortex_m_rtfm as rtfm; -use blue_pill::led::{self, Green}; +use blue_pill::led::{self, PC13}; use rtfm::app; app! { @@ -20,7 +20,7 @@ fn init(p: init::Peripherals) { } fn idle() -> ! { - Green.on(); + PC13.on(); // Sleep loop { diff --git a/examples/preemption.rs b/examples/preemption.rs index 4423ecddfc6b7b0bcd1d09435973670426a61731..69bac66fa244ebea83c6e9092ec719adbc0be651 100644 --- a/examples/preemption.rs +++ b/examples/preemption.rs @@ -9,7 +9,7 @@ extern crate cortex_m; extern crate cortex_m_rtfm as rtfm; use blue_pill::Serial; -use blue_pill::led::{self, Green}; +use blue_pill::led::{self, PC13}; use blue_pill::prelude::*; use blue_pill::serial::Event; use blue_pill::time::Hertz; @@ -79,8 +79,8 @@ fn toggle(t: &mut Threshold, mut r: SYS_TICK::Resources) { **r.ON = !**r.ON; if **r.ON { - Green.on(); + PC13.on(); } else { - Green.off(); + PC13.off(); } } diff --git a/examples/sharing.rs b/examples/sharing.rs index d499c5791347a20f81c9dae22810b2e4bd0a777a..dcf0934b46c1022b4e38e150a22bf3cd92276f90 100644 --- a/examples/sharing.rs +++ b/examples/sharing.rs @@ -9,7 +9,7 @@ extern crate cortex_m; extern crate cortex_m_rtfm as rtfm; use blue_pill::Serial; -use blue_pill::led::{self, Green}; +use blue_pill::led::{self, PC13}; use blue_pill::prelude::*; use blue_pill::serial::Event; use blue_pill::time::Hertz; @@ -74,8 +74,8 @@ fn toggle(_t: &mut Threshold, r: SYS_TICK::Resources) { **r.ON = !**r.ON; if **r.ON { - Green.on(); + PC13.on(); } else { - Green.off(); + PC13.off(); } } diff --git a/examples/wait1.rs b/examples/wait1.rs index 21f51c98fbdc5fae72bfbce5e5790f70371abfe5..0675e3be13997733219db6321670e2147583c1ee 100644 --- a/examples/wait1.rs +++ b/examples/wait1.rs @@ -9,7 +9,7 @@ extern crate blue_pill; extern crate cortex_m_rtfm as rtfm; use blue_pill::Timer; -use blue_pill::led::{self, Green}; +use blue_pill::led::{self, PC13}; use blue_pill::prelude::*; use blue_pill::time::Hertz; use rtfm::{app, Threshold}; @@ -43,9 +43,9 @@ fn idle(_t: &mut Threshold, r: idle::Resources) -> ! { state = !state; if state { - Green.on(); + PC13.on(); } else { - Green.off(); + PC13.off(); } } } diff --git a/examples/wait2.rs b/examples/wait2.rs index 3b23c27c87f844f5ce40b8e1b7c7668f314e433b..8cfe53a6166e55c1fafd2b79e3fb1dc27dc51f1e 100644 --- a/examples/wait2.rs +++ b/examples/wait2.rs @@ -9,7 +9,7 @@ extern crate blue_pill; extern crate cortex_m_rtfm as rtfm; use blue_pill::Timer; -use blue_pill::led::{self, Green}; +use blue_pill::led::{self, PC13}; use blue_pill::prelude::*; use blue_pill::time::Hertz; use rtfm::{app, Threshold}; @@ -42,9 +42,9 @@ fn idle(_t: &mut Threshold, r: idle::Resources) -> ! { state = !state; if state { - Green.on(); + PC13.on(); } else { - Green.off(); + PC13.off(); } } } diff --git a/examples/wait3.rs b/examples/wait3.rs index b5d5c3e006d9d8f295c58ec47cd274de22185920..ae367f439a95de83c4a2452e8c307bfcbbb1302b 100644 --- a/examples/wait3.rs +++ b/examples/wait3.rs @@ -9,7 +9,7 @@ extern crate blue_pill; extern crate cortex_m_rtfm as rtfm; use blue_pill::Timer; -use blue_pill::led::{self, Green}; +use blue_pill::led::{self, PC13}; use blue_pill::prelude::*; use blue_pill::time::Hertz; use rtfm::{app, Threshold}; @@ -43,9 +43,9 @@ fn idle(_t: &mut Threshold, r: idle::Resources) -> ! { state = !state; if state { - Green.on(); + PC13.on(); } else { - Green.off(); + PC13.off(); } } } diff --git a/examples/wait4.rs b/examples/wait4.rs index 393f454e021197f9de9ccff6c394a68a9061a961..94284bb3e5f2ffa5c5e5191bb397d4e6276fed2e 100644 --- a/examples/wait4.rs +++ b/examples/wait4.rs @@ -9,7 +9,7 @@ extern crate blue_pill; extern crate cortex_m_rtfm as rtfm; use blue_pill::Timer; -use blue_pill::led::{self, Green}; +use blue_pill::led::{self, PC13}; use blue_pill::prelude::*; use blue_pill::time::Hertz; use rtfm::{app, Threshold}; @@ -43,9 +43,9 @@ fn idle(_t: &mut Threshold, r: idle::Resources) -> ! { state = !state; if state { - Green.on(); + PC13.on(); } else { - Green.off(); + PC13.off(); } } } diff --git a/src/led.rs b/src/led.rs index ab7038e9d59cf51ea4bb3e2ba4933212a6a89f00..2c6137d6c421b4d221487cf7c7ff0e852c1e3e37 100644 --- a/src/led.rs +++ b/src/led.rs @@ -1,11 +1,11 @@ //! User LEDs //! -//! - Green = PC13 +//! - PC13 use stm32f103xx::{GPIOC, RCC}; -/// Green LED (PC13) -pub struct Green; +/// LED connected to pin PC13 +pub struct PC13; /// Initializes the user LED pub fn init(gpioc: &GPIOC, rcc: &RCC) { @@ -17,7 +17,7 @@ pub fn init(gpioc: &GPIOC, rcc: &RCC) { gpioc.crh.modify(|_, w| w.mode13().output().cnf13().push()); } -impl Green { +impl PC13 { /// Turns the LED on pub fn on(&self) { unsafe {