working but probably wrong. timer + bit turn on for semestralka1
This commit is contained in:
@@ -1 +1,4 @@
|
||||
// src/software_uart/mod.rs
|
||||
|
||||
pub mod suart;
|
||||
pub use suart::*;
|
||||
|
||||
@@ -1,2 +1,19 @@
|
||||
// src/software_uart/suart.rs
|
||||
|
||||
use embassy_stm32::peripherals::{PA2, PA3};
|
||||
use embassy_stm32::gpio::{Input, Output, Pull, Speed, Level};
|
||||
use embassy_stm32::Peripherals;
|
||||
use embassy_time::Timer;
|
||||
|
||||
pub async fn suart_test(mut tx_pin: PA2, rx_pin: PA3) {
|
||||
let mut tx = Output::new(tx_pin.into(), Level::Low, Speed::Low);
|
||||
let _rx = Input::new(rx_pin.into(), Pull::Up);
|
||||
|
||||
loop {
|
||||
tx.set_high();
|
||||
Timer::after_millis(500).await;
|
||||
|
||||
tx.set_low();
|
||||
Timer::after_millis(500).await;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user