Remove unused code
This commit is contained in:
parent
6ce8a12bf8
commit
51954554ba
14
src/main.rs
14
src/main.rs
|
@ -22,7 +22,6 @@ mod app {
|
|||
#[shared]
|
||||
struct Shared {
|
||||
can_tx_queue: BinaryHeap<PriorityFrame, Max, 16>,
|
||||
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) => {
|
||||
|
|
Loading…
Reference in New Issue
Block a user