Skip to content

Commit c0ad3cf

Browse files
committed
nrfx_temp non-blocking example
1 parent 1323bbe commit c0ad3cf

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
This is example usage of the nrfx_temp driver
3+
*/
4+
5+
#include <nrfx_temp.h>
6+
#include <Adafruit_TinyUSB.h>
7+
8+
nrfx_temp_config_t config = NRFX_TEMP_DEFAULT_CONFIG;
9+
10+
// this function is called when the temperature measurement is ready
11+
void temp_handler(int32_t raw_temp) {
12+
Serial.println(nrfx_temp_calculate(raw_temp));
13+
}
14+
15+
void setup() {
16+
Serial.begin(9600);
17+
nrfx_temp_init(&config, &temp_handler);
18+
}
19+
20+
void loop() {
21+
nrfx_temp_measure();
22+
23+
delay(1000);
24+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name=nrfx examples
2+
version=1.0
3+
author=Neotje
4+
maintainer=Neotje <[email protected]>
5+
sentence=Examples for the Adafruit nRF52 Arduino platform using nrfx
6+
paragraph=Examples for the Adafruit nRF52 Arduino platform using nrfx
7+
category=other
8+
url=https://github.com/adafruit/Adafruit_nRF52_Arduino
9+
architectures=*

0 commit comments

Comments
 (0)