esp-hal/esp32-hal/examples/rtc_time.rs
Kirill Mikhailov fdc1dbfa1d
Unify the low-power peripheral names (RTC_CNTL and LP_CLKRST to LPWR) (#1064)
* WIP

* Adjusting to changes in driver

* Adding CHANGELOG entry
2024-01-08 14:00:26 +00:00

24 lines
602 B
Rust

//! Prints time in milliseconds from the RTC Timer
#![no_std]
#![no_main]
use esp32_hal::{clock::ClockControl, peripherals::Peripherals, prelude::*, Delay, Rtc};
use esp_backtrace as _;
#[entry]
fn main() -> ! {
let peripherals = Peripherals::take();
let system = peripherals.SYSTEM.split();
let clocks = ClockControl::boot_defaults(system.clock_control).freeze();
let rtc = Rtc::new(peripherals.LPWR);
let mut delay = Delay::new(&clocks);
loop {
esp_println::println!("rtc time in milliseconds is {}", rtc.get_time_ms());
delay.delay_ms(1000u32);
}
}