From 51954554bada55c2495683438af60732e0504fc6 Mon Sep 17 00:00:00 2001 From: yanorei32 Date: Wed, 11 Oct 2023 03:02:51 +0900 Subject: [PATCH] Remove unused code --- src/main.rs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/main.rs b/src/main.rs index c7f7238..e914208 100644 --- a/src/main.rs +++ b/src/main.rs @@ -22,7 +22,6 @@ mod app { #[shared] struct Shared { can_tx_queue: BinaryHeap, - tx_count: usize, } #[local] @@ -77,10 +76,7 @@ mod app { let led = gpioc.pc13.into_push_pull_output(&mut gpioc.crh); ( - Shared { - can_tx_queue, - tx_count: 0, - }, + Shared { can_tx_queue }, Local { can_tx, can_rx, @@ -101,7 +97,7 @@ mod app { rtic::pend(Interrupt::USB_HP_CAN_TX); } - #[idle(shared = [can_tx_queue, tx_count], local = [delay])] + #[idle(shared = [can_tx_queue], local = [delay])] fn idle(cx: idle::Context) -> ! { let mut tx_queue = cx.shared.can_tx_queue; @@ -126,21 +122,19 @@ mod app { unreachable!() } - #[task(binds = USB_HP_CAN_TX, local = [can_tx, led], shared = [can_tx_queue, tx_count])] + #[task(binds = USB_HP_CAN_TX, local = [can_tx, led], shared = [can_tx_queue])] fn can_tx(cx: can_tx::Context) { let tx = cx.local.can_tx; let mut tx_queue = cx.shared.can_tx_queue; - let mut tx_count = cx.shared.tx_count; tx.clear_interrupt_flags(); - (&mut tx_queue, &mut tx_count).lock(|tx_queue, tx_count| { + (&mut tx_queue).lock(|tx_queue| { while let Some(frame) = tx_queue.peek() { match tx.transmit(&frame.0) { Ok(status) => match status.dequeued_frame() { None => { tx_queue.pop(); - *tx_count += 1; cx.local.led.toggle(); } Some(pending_frame) => {