aboutsummaryrefslogtreecommitdiff
path: root/examples/nrf/src
diff options
context:
space:
mode:
Diffstat (limited to 'examples/nrf/src')
-rw-r--r--examples/nrf/src/bin/temp.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/examples/nrf/src/bin/temp.rs b/examples/nrf/src/bin/temp.rs
new file mode 100644
index 000000000..04d1d58fe
--- /dev/null
+++ b/examples/nrf/src/bin/temp.rs
@@ -0,0 +1,26 @@
1#![no_std]
2#![no_main]
3#![feature(type_alias_impl_trait)]
4
5#[path = "../example_common.rs"]
6mod example_common;
7use example_common::*;
8
9use defmt::panic;
10use embassy::{
11 executor::Spawner,
12 time::{Duration, Timer},
13};
14use embassy_nrf::{interrupt, temp::Temp, Peripherals};
15
16#[embassy::main]
17async fn main(_spawner: Spawner, p: Peripherals) {
18 let irq = interrupt::take!(TEMP);
19 let mut temp = Temp::new(p.TEMP, irq);
20
21 loop {
22 let value = temp.read().await;
23 info!("temperature: {}", value.to_num::<u16>());
24 Timer::after(Duration::from_secs(1)).await;
25 }
26}