manchester is also working now

This commit is contained in:
Priec
2026-05-22 23:20:22 +02:00
parent 6dae8c727a
commit 92d69e875a
3 changed files with 72 additions and 18 deletions

View File

@@ -70,7 +70,7 @@ pub async fn bit_send(
rx: Receiver<'static, CriticalSectionRawMutex, u8, 128>,
encoding: Encoding,
) {
let mut ticker = Ticker::every(BIT_PERIOD);
let mut ticker = Ticker::every(BIT_PERIOD / 2);
let mut is_high = true;
pin.set_high();
@@ -85,6 +85,7 @@ pub async fn bit_send(
is_high = false;
pin.set_low();
}
ticker.next().await;
}
// toggle, ak sme v 1, inac sa nedeje nic
Encoding::Nrzi => {
@@ -96,10 +97,24 @@ pub async fn bit_send(
pin.set_low();
}
}
ticker.next().await;
}
// manchester xor tabulka
Encoding::Manchester => {
if bit == 1 {
// high -> low
pin.set_high();
ticker.next().await;
pin.set_low();
ticker.next().await;
} else {
// low -> high
pin.set_low();
ticker.next().await;
pin.set_high();
ticker.next().await;
}
}
};
// bitrate
ticker.next().await;
}
}