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]
|
#[shared]
|
||||||
struct Shared {
|
struct Shared {
|
||||||
can_tx_queue: BinaryHeap<PriorityFrame, Max, 16>,
|
can_tx_queue: BinaryHeap<PriorityFrame, Max, 16>,
|
||||||
tx_count: usize,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[local]
|
#[local]
|
||||||
|
@ -77,10 +76,7 @@ mod app {
|
||||||
let led = gpioc.pc13.into_push_pull_output(&mut gpioc.crh);
|
let led = gpioc.pc13.into_push_pull_output(&mut gpioc.crh);
|
||||||
|
|
||||||
(
|
(
|
||||||
Shared {
|
Shared { can_tx_queue },
|
||||||
can_tx_queue,
|
|
||||||
tx_count: 0,
|
|
||||||
},
|
|
||||||
Local {
|
Local {
|
||||||
can_tx,
|
can_tx,
|
||||||
can_rx,
|
can_rx,
|
||||||
|
@ -101,7 +97,7 @@ mod app {
|
||||||
rtic::pend(Interrupt::USB_HP_CAN_TX);
|
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) -> ! {
|
fn idle(cx: idle::Context) -> ! {
|
||||||
let mut tx_queue = cx.shared.can_tx_queue;
|
let mut tx_queue = cx.shared.can_tx_queue;
|
||||||
|
|
||||||
|
@ -126,21 +122,19 @@ mod app {
|
||||||
unreachable!()
|
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) {
|
fn can_tx(cx: can_tx::Context) {
|
||||||
let tx = cx.local.can_tx;
|
let tx = cx.local.can_tx;
|
||||||
let mut tx_queue = cx.shared.can_tx_queue;
|
let mut tx_queue = cx.shared.can_tx_queue;
|
||||||
let mut tx_count = cx.shared.tx_count;
|
|
||||||
|
|
||||||
tx.clear_interrupt_flags();
|
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() {
|
while let Some(frame) = tx_queue.peek() {
|
||||||
match tx.transmit(&frame.0) {
|
match tx.transmit(&frame.0) {
|
||||||
Ok(status) => match status.dequeued_frame() {
|
Ok(status) => match status.dequeued_frame() {
|
||||||
None => {
|
None => {
|
||||||
tx_queue.pop();
|
tx_queue.pop();
|
||||||
*tx_count += 1;
|
|
||||||
cx.local.led.toggle();
|
cx.local.led.toggle();
|
||||||
}
|
}
|
||||||
Some(pending_frame) => {
|
Some(pending_frame) => {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user