GPIO example works
This commit is contained in:
@ -3,7 +3,7 @@
|
||||
#![no_std]
|
||||
|
||||
use cortex_m_rt::entry;
|
||||
use embedded_hal::digital::{OutputPin, StatefulOutputPin};
|
||||
use embedded_hal::digital::StatefulOutputPin;
|
||||
use panic_halt as _;
|
||||
use va416xx_hal::{gpio::PinsG, pac};
|
||||
|
||||
@ -11,17 +11,11 @@ use va416xx_hal::{gpio::PinsG, pac};
|
||||
fn main() -> ! {
|
||||
// SAFETY: Peripherals are only stolen once here.
|
||||
let mut dp = unsafe { pac::Peripherals::steal() };
|
||||
// Enable all peripheral clocks
|
||||
dp.sysconfig
|
||||
.peripheral_clk_enable()
|
||||
.modify(|_, w| unsafe { w.bits(0xffffffff) });
|
||||
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);
|
||||
loop {
|
||||
led.set_high().ok();
|
||||
cortex_m::asm::delay(2_000_000);
|
||||
led.set_low().ok();
|
||||
cortex_m::asm::delay(2_000_000);
|
||||
led.toggle().ok();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user