2021-10-18 13:24:31 +00:00
|
|
|
#![no_std]
|
|
|
|
#![no_main]
|
|
|
|
#![feature(type_alias_impl_trait)]
|
|
|
|
|
2022-04-02 02:35:06 +00:00
|
|
|
use defmt::info;
|
|
|
|
use embassy::executor::Spawner;
|
|
|
|
use embassy::time::{Duration, Timer};
|
2021-10-18 13:24:31 +00:00
|
|
|
use embassy_nrf::{interrupt, temp::Temp, Peripherals};
|
|
|
|
|
2022-04-02 02:35:06 +00:00
|
|
|
use defmt_rtt as _; // global logger
|
|
|
|
use panic_probe as _;
|
|
|
|
|
2021-10-18 13:24:31 +00:00
|
|
|
#[embassy::main]
|
|
|
|
async fn main(_spawner: Spawner, p: Peripherals) {
|
|
|
|
let irq = interrupt::take!(TEMP);
|
|
|
|
let mut temp = Temp::new(p.TEMP, irq);
|
|
|
|
|
|
|
|
loop {
|
|
|
|
let value = temp.read().await;
|
2021-10-19 13:32:16 +00:00
|
|
|
info!("temperature: {}℃", value.to_num::<u16>());
|
2021-10-18 13:24:31 +00:00
|
|
|
Timer::after(Duration::from_secs(1)).await;
|
|
|
|
}
|
|
|
|
}
|