final working
This commit is contained in:
@@ -12,7 +12,7 @@ use embassy_sync::channel::Channel;
|
||||
use embassy_time::Duration;
|
||||
use semestralka2::receive::bit_receive_and_decode;
|
||||
use semestralka2::send::Tx;
|
||||
use semestralka2::send::{bit_send, nrz};
|
||||
use semestralka2::send::{bit_send, msg_encode};
|
||||
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
@@ -37,11 +37,11 @@ async fn main(spawner: Spawner) {
|
||||
|
||||
info!("starting loop");
|
||||
loop {
|
||||
nrz(b"ahoj", &sender).await;
|
||||
nrz(b"hello", &sender).await;
|
||||
msg_encode(b"ahoj", &sender).await;
|
||||
msg_encode(b"hello", &sender).await;
|
||||
|
||||
let data = [0x01, 0x02, 0x03, 0x04];
|
||||
nrz(&data, &sender).await;
|
||||
msg_encode(&data, &sender).await;
|
||||
|
||||
info!("frame sent");
|
||||
embassy_time::Timer::after(Duration::from_secs(1)).await;
|
||||
|
||||
@@ -22,7 +22,7 @@ async fn send_byte(byte: u8, tx: &Tx) {
|
||||
}
|
||||
|
||||
/// [START] [LEN] [PAYLOAD ...] [CRC] [P] [STOP]
|
||||
pub async fn nrz(payload: &[u8], tx: &Tx) {
|
||||
pub async fn msg_encode(payload: &[u8], tx: &Tx) {
|
||||
// start
|
||||
send_byte(START, tx).await;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user