28 lines
535 B
Rust
28 lines
535 B
Rust
|
#![no_std]
|
||
|
#![no_main]
|
||
|
#![feature(type_alias_impl_trait)]
|
||
|
|
||
|
#[path = "../example_common.rs"]
|
||
|
mod example_common;
|
||
|
use cortex_m_rt::entry;
|
||
|
use embassy_stm32::gpio::{Input, Pull};
|
||
|
use embedded_hal::digital::v2::InputPin;
|
||
|
use example_common::*;
|
||
|
|
||
|
#[entry]
|
||
|
fn main() -> ! {
|
||
|
info!("Hello World!");
|
||
|
|
||
|
let p = embassy_stm32::init(Default::default());
|
||
|
|
||
|
let button = Input::new(p.PC13, Pull::Up);
|
||
|
|
||
|
loop {
|
||
|
if unwrap!(button.is_high()) {
|
||
|
info!("high");
|
||
|
} else {
|
||
|
info!("low");
|
||
|
}
|
||
|
}
|
||
|
}
|