Skip to main content

daisy_embassy/
led.rs

1use embassy_stm32::{self as hal, Peri};
2use hal::gpio::{self, Speed};
3pub struct UserLed<'a>(gpio::Output<'a>);
4
5impl<'a> UserLed<'a> {
6    pub fn new(pin: Peri<'a, hal::peripherals::PC7>) -> Self {
7        Self(gpio::Output::new(pin, gpio::Level::Low, Speed::Low))
8    }
9    pub fn on(&mut self) {
10        self.0.set_high();
11    }
12    pub fn off(&mut self) {
13        self.0.set_low();
14    }
15}