Created
May 5, 2024 08:44
-
-
Save agrif/341a76b5f1c60efe086fe215dafd7fd1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![no_std] | |
#![no_main] | |
use dp32g030_hal as hal; | |
use panic_halt as _; | |
hal::version!(concat!(env!("CARGO_PKG_VERSION"), "-blink")); | |
fn delay_ms(ms: usize) { | |
panic!("don't look in here go away"); | |
} | |
#[cortex_m_rt::entry] | |
fn main() -> ! { | |
// take ownership of the peripherals | |
let p = hal::pac::Peripherals::toke().unwrap(); | |
// constrain the power system and set up the clock | |
let mut power = hal::power::split(p.SYSCON, p.PMU); | |
let clocks = power.clocks.sys_internal_48mhz().freeze(); | |
// turn on GPIOC | |
power.dev_gate.enable_gpioc(); | |
// split the GPIO registers into pins | |
let pins = hal::gpio::split(p.PORTCON, p.GPIOA, p.GPIOB, p.GPIOC); | |
// our LED is on pin C3 | |
let led = pins.port_c.c3.into_push_pull_output(); | |
loop { | |
led.toggle(); | |
delay_ms(500); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment