Add low power print to lp-core

Signed-off-by: Thomas Klaehn <thomas.klaehn@perinet.io>
This commit is contained in:
Thomas Klaehn
2025-02-14 07:33:55 +01:00
parent 18610940f4
commit 38830d9fe4
2 changed files with 18 additions and 8 deletions

View File

@@ -7,15 +7,17 @@
#![no_std]
#![no_main]
use core::fmt::Write;
use embedded_hal::{delay::DelayNs, digital::OutputPin};
use esp_lp_hal::{delay::Delay, gpio::Output, prelude::*, wake_hp_core};
use esp_lp_hal::{delay::Delay, uart::LpUart, gpio::Output, prelude::*, wake_hp_core};
use panic_halt as _;
const ADDRESS: u32 = 0x5000_2000;
#[entry]
fn main(mut gpio1: Output<1>) -> ! {
fn main(mut lp_uart :LpUart, mut gpio1: Output<1>) -> ! {
let mut i: u32 = 0;
let ptr = ADDRESS as *mut u32;
@@ -26,10 +28,12 @@ fn main(mut gpio1: Output<1>) -> ! {
ptr.write_volatile(i);
}
writeln!(lp_uart, "high\n").unwrap();
gpio1.set_high().unwrap();
wake_hp_core();
Delay.delay_ms(500);
writeln!(lp_uart, "low\n").unwrap();
gpio1.set_low().unwrap();
Delay.delay_ms(500);
}