Skip to content
Snippets Groups Projects
Commit e84cb4f4 authored by Benjamin Koch's avatar Benjamin Koch
Browse files

bugfix: off-by-one for TX length

parent 3d697032
No related branches found
No related tags found
No related merge requests found
......@@ -246,7 +246,7 @@ impl RS485 {
sm1.set_enable(true);
let mut tx_data = [0, 'H' as u32, 'e' as u32, 'l' as u32, 'l' as u32, 'o' as u32, '\r' as u32, '\n' as u32];
tx_data[0] = (tx_data.len() - 1) as u32;
tx_data[0] = (tx_data.len() - 2) as u32;
for i in 1..tx_data.len() {
let x = tx_data[i] & 0xff;
let mut parity = 0;
......@@ -271,7 +271,11 @@ impl RS485 {
sm.rx().dma_pull(dma_in_ref.reborrow(), &mut din),
//debug_print_pio_addr(embassy_rp::pac::PIO0.sm(0)),
tx_future.continue_wait(),
rx_future.continue_wait(),
select(
rx_future.continue_wait(),
//debug_print_pio_addr(embassy_rp::pac::PIO0.sm(1)),
core::future::pending::<()>(),
),
).await;
match x {
Either4::First(_) => {
......@@ -360,7 +364,7 @@ impl RS485 {
drop(tx_future);
tx_future = DontAbort::new(sm1.tx().dma_push(dma_tx_ref.reborrow(), &tx_data));
},
Either4::Fourth(x) => {
Either4::Fourth(Either::First(x)) => {
drop(rx_future);
match x {
Result::Ok(()) => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment