Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #[macro_use(singleton)]
- use core::cell::{Cell, RefCell};
- use cortex_m::singleton;
- use cortex_m::interrupt::free;
- use cortex_m::interrupt::Mutex;
- use cortex_m::peripheral::NVIC;
- use stm32_hal2::
- {
- low_power,
- clocks::Clocks,
- pac::{self, interrupt},
- gpio::{Pin, PinMode, Port},
- usart::{Usart, UsartConfig, UsartInterrupt},
- };
- pub struct Board_debug
- {
- // LEDs
- red_led: Pin,
- green_led: Pin,
- orange_led: Pin,
- }
- impl Board_debug
- {
- // public constructor method
- pub fn new() -> Self
- {
- let x: &'static mut bool = singleton!(: bool = false).unwrap();
- Self
- {
- red_led: Pin::new(Port::B, 14, PinMode::Output),
- green_led: Pin::new(Port::B, 0, PinMode::Output),
- orange_led: Pin::new(Port::B, 7, PinMode::Output),
- }
- }
- // change green led state
- pub fn green_led_change(&mut self, level: bool)
- {
- if(level)
- {
- self.green_led.set_high();
- }
- else
- {
- self.green_led.set_low();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement