manchester is also working now
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user