2024-06-12 10:12:11 +02:00
|
|
|
//! Simple blinky example using the HAL
|
2024-06-11 13:48:42 +02:00
|
|
|
#![no_main]
|
|
|
|
#![no_std]
|
|
|
|
|
2024-06-11 20:24:24 +02:00
|
|
|
use cortex_m_rt::entry;
|
2024-06-12 10:30:22 +02:00
|
|
|
use embedded_hal::digital::{OutputPin, StatefulOutputPin};
|
2024-06-11 13:48:42 +02:00
|
|
|
use panic_halt as _;
|
2024-06-12 10:12:11 +02:00
|
|
|
use va416xx_hal::{gpio::PinsG, pac};
|
2024-06-11 13:48:42 +02:00
|
|
|
|
|
|
|
#[entry]
|
|
|
|
fn main() -> ! {
|
2024-06-11 20:24:24 +02:00
|
|
|
// SAFETY: Peripherals are only stolen once here.
|
2024-06-12 10:12:11 +02:00
|
|
|
let mut dp = unsafe { pac::Peripherals::steal() };
|
2024-06-11 13:48:42 +02:00
|
|
|
// Enable all peripheral clocks
|
2024-06-11 20:24:24 +02:00
|
|
|
dp.sysconfig
|
|
|
|
.peripheral_clk_enable()
|
2024-06-11 13:48:42 +02:00
|
|
|
.modify(|_, w| unsafe { w.bits(0xffffffff) });
|
2024-06-12 10:12:11 +02:00
|
|
|
let portg = PinsG::new(&mut dp.sysconfig, Some(dp.ioconfig), dp.portg);
|
|
|
|
let mut led = portg.pg5.into_readable_push_pull_output();
|
|
|
|
//let mut delay = CountDownTimer::new(&mut dp.SYSCONFIG, 50.mhz(), dp.TIM0);
|
2024-06-11 13:48:42 +02:00
|
|
|
loop {
|
2024-06-12 10:30:22 +02:00
|
|
|
led.set_high().ok();
|
|
|
|
cortex_m::asm::delay(2_000_000);
|
|
|
|
led.set_low().ok();
|
2024-06-11 20:24:24 +02:00
|
|
|
cortex_m::asm::delay(2_000_000);
|
2024-06-11 13:48:42 +02:00
|
|
|
}
|
|
|
|
}
|