esp-hal/esp32c6-lp-hal/examples/blinky.rs
Björn Quentin a0e5737a22
Macro to load LP core code (#779)
* Macro to load LP core code

* Fix imports, add CHANGELOG.md entry

* Avoid code warning

* Omit path from function signature

* More error checking

* Clippy fix

* Include the ELF used by the lp_core_basic example

* Make object dependency optional

* Use 1.65 for RISCV MSRV check

* Use RUSTC_BOOTSTRAP for RISCV MSRV check

* Remove the pre-compiled LP core example

* Pin toml_edit in esp32c6-lp-hal-procmacro
2023-09-14 12:16:12 +02:00

34 lines
674 B
Rust

//! Counts a 32 bit value at 0x5000_2000 and blinks GPIO 1.
//! Make sure the LP RAM is cleared before loading the code.
#![no_std]
#![no_main]
use esp32c6_lp_hal::{
delay::Delay,
gpio::{GpioPin, Output, PushPull},
prelude::*,
};
use panic_halt as _;
#[entry]
fn main(mut gpio1: GpioPin<Output<PushPull>, 1>) -> ! {
let mut i: u32 = 0;
let ptr = 0x5000_2000 as *mut u32;
let mut delay = Delay::new();
loop {
i = i.wrapping_add(1u32);
unsafe {
ptr.write_volatile(i);
}
gpio1.set_high().unwrap();
delay.delay_ms(500);
gpio1.set_low().unwrap();
delay.delay_ms(500);
}
}