Fix for readability
This commit is contained in:
parent
bf82cfe6dc
commit
6ce8a12bf8
35
src/main.rs
35
src/main.rs
|
@ -14,7 +14,7 @@ mod app {
|
|||
can::Can,
|
||||
device::TIM2,
|
||||
gpio::{Output, Pin},
|
||||
pac::{CAN1, Interrupt},
|
||||
pac::{Interrupt, CAN1},
|
||||
prelude::*,
|
||||
timer::Delay,
|
||||
};
|
||||
|
@ -105,26 +105,25 @@ mod app {
|
|||
fn idle(cx: idle::Context) -> ! {
|
||||
let mut tx_queue = cx.shared.can_tx_queue;
|
||||
|
||||
loop {
|
||||
for sign in [1, -1] {
|
||||
for speed in (0..=120)
|
||||
.chain((0..40).map(|_| 120))
|
||||
.chain((0..=120).map(|i| 120 - i))
|
||||
{
|
||||
tx_queue.lock(|mut tx_queue| {
|
||||
enqueue_frame(
|
||||
&mut tx_queue,
|
||||
Frame::new_data(
|
||||
StandardId::new(0x1FF).unwrap(),
|
||||
speed2array(speed * 250 * sign),
|
||||
),
|
||||
);
|
||||
});
|
||||
for sign in [1, -1].iter().cycle() {
|
||||
for speed in (0..=30_000)
|
||||
.step_by(250)
|
||||
.chain(core::iter::repeat(30_000).take(1000 / 25))
|
||||
.chain((0..=30_000).step_by(250).map(|v| 30_000 - v))
|
||||
.map(|v| v * sign)
|
||||
{
|
||||
tx_queue.lock(|mut tx_queue| {
|
||||
enqueue_frame(
|
||||
&mut tx_queue,
|
||||
Frame::new_data(StandardId::new(0x1FF).unwrap(), speed2array(speed)),
|
||||
);
|
||||
});
|
||||
|
||||
cx.local.delay.delay(25.millis());
|
||||
}
|
||||
cx.local.delay.delay(25.millis());
|
||||
}
|
||||
}
|
||||
|
||||
unreachable!()
|
||||
}
|
||||
|
||||
#[task(binds = USB_HP_CAN_TX, local = [can_tx, led], shared = [can_tx_queue, tx_count])]
|
||||
|
|
Loading…
Reference in New Issue
Block a user