update blinky led example, bump HAL dependency
Some checks failed
Rust/vorago-reb1/pipeline/head There was a failure building this commit

This commit is contained in:
Robin Müller 2021-12-18 15:00:54 +01:00
parent 0c5a5efea0
commit 2f503ac3b1
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
3 changed files with 28 additions and 16 deletions

View File

@ -18,7 +18,7 @@ dummy-pin = "0.1.1"
max116xx-10bit = "0.2.1"
[dependencies.va108xx-hal]
version = "0.4.2"
version = "0.4.3"
features = ["rt"]
[features]

View File

@ -9,7 +9,7 @@
use cortex_m_rt::entry;
use embedded_hal::digital::v2::ToggleableOutputPin;
use panic_halt as _;
use va108xx_hal::{gpio::pins::PinsA, pac, prelude::*};
use va108xx_hal::{gpio::pins::PinsA, pac, prelude::*, timer::set_up_ms_timer};
use vorago_reb1::leds::Leds;
// REB LED pin definitions. All on port A
@ -64,23 +64,30 @@ fn main() -> ! {
let mut led1 = pins.pa10.into_push_pull_output();
let mut led2 = pins.pa7.into_push_pull_output();
let mut led3 = pins.pa6.into_push_pull_output();
let mut delay = set_up_ms_timer(
&mut dp.SYSCONFIG,
&mut dp.IRQSEL,
50.mhz().into(),
dp.TIM0,
pac::Interrupt::OC0,
);
for _ in 0..10 {
led1.set_low().ok();
led2.set_low().ok();
led3.set_low().ok();
cortex_m::asm::delay(5_000_000);
delay.delay_ms(200_u16);
led1.set_high().ok();
led2.set_high().ok();
led3.set_high().ok();
cortex_m::asm::delay(5_000_000);
delay.delay_ms(200_u16);
}
loop {
led1.toggle().ok();
cortex_m::asm::delay(5_000_000);
delay.delay_ms(200_u16);
led2.toggle().ok();
cortex_m::asm::delay(5_000_000);
delay.delay_ms(200_u16);
led3.toggle().ok();
cortex_m::asm::delay(5_000_000);
delay.delay_ms(200_u16);
}
}
LibType::Bsp => {
@ -90,22 +97,27 @@ fn main() -> ! {
pinsa.pa7.into_push_pull_output(),
pinsa.pa6.into_push_pull_output(),
);
let mut delay = set_up_ms_timer(
&mut dp.SYSCONFIG,
&mut dp.IRQSEL,
50.mhz().into(),
dp.TIM0,
pac::Interrupt::OC0,
);
loop {
for _ in 0..10 {
// Blink all LEDs quickly
for led in leds.iter_mut() {
led.toggle();
}
cortex_m::asm::delay(5_000_000);
delay.delay_ms(200_u16);
}
// Now use a wave pattern
loop {
leds[0].toggle();
cortex_m::asm::delay(5_000_000);
leds[1].toggle();
cortex_m::asm::delay(5_000_000);
leds[2].toggle();
cortex_m::asm::delay(5_000_000);
for led in leds.iter_mut() {
led.toggle();
delay.delay_ms(200_u16);
}
}
}
}

View File

@ -14,7 +14,7 @@ use va108xx_hal::{
prelude::*,
spi::{Spi, SpiBase, SpiConfig, TransferConfig},
timer::{default_ms_irq_handler, set_up_ms_timer, Delay},
utility::{port_mux, PortSel, Funsel}
utility::{port_mux, Funsel, PortSel},
};
use vorago_reb1::max11619::{
max11619_externally_clocked_no_wakeup, max11619_externally_clocked_with_wakeup,
@ -39,7 +39,7 @@ pub enum ReadMode {
#[derive(Debug, PartialEq, Copy, Clone)]
pub enum MuxMode {
None,
PortB19to17
PortB19to17,
}
const EXAMPLE_MODE: ExampleMode = ExampleMode::NotUsingEoc;