use embedded_hal::digital::OutputPin; use stm32f4xx_hal::gpio::{ Output, PushPull, gpiob::{PB0, PB7, PB14}, }; type GreenPin = PB0>; type BluePin = PB7>; type RedPin = PB14>; pub struct Led { pin: PIN, } impl Led { fn new(pin: PIN) -> Self { Led { pin } } pub fn on(&mut self) { self.pin.set_high(); } pub fn off(&mut self) { self.pin.set_low(); } } impl Led { pub fn green(pin: GreenPin) -> Self { Self::new(pin) } } impl Led { pub fn blue(pin: BluePin) -> Self { Self::new(pin) } } impl Led { pub fn red(pin: RedPin) -> Self { Self::new(pin) } }