-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmain.rs
30 lines (23 loc) · 753 Bytes
/
main.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#![no_std]
#![no_main]
#![feature(type_alias_impl_trait)]
use embassy_executor::executor::Spawner;
use embassy_stm32::Peripherals;
use embedded_hal::digital::v2::OutputPin;
use embassy_stm32::gpio::{Level, Output, Speed};
use embassy_stm32::usart::{Config, Uart};
use embassy_stm32::dma::NoDma;
use embedded_hal::blocking::serial::Write;
use panic_halt as _;
#[embassy_executor::main]
async fn main(_spawner: Spawner, p: Peripherals) -> ! {
let config = Config::default();
let tx = p.PA9;
let rx = p.PA10;
let mut usart = Uart::new(p.USART1, rx, tx, NoDma, NoDma, config);
let mut led = Output::new(p.PA4, Level::High, Speed::Low);
led.set_high();
usart.bwrite_all(b"embassy example\r\n").unwrap();
loop {
}
}