Skip to content

Commit ab62290

Browse files
committed
nrfx_temp blocking example
1 parent c0ad3cf commit ab62290

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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+
void setup() {
11+
Serial.begin(9600);
12+
// setting the handler to NULL will initialize the driver in blocking mode
13+
nrfx_temp_init(&config, NULL);
14+
}
15+
16+
void loop() {
17+
nrfx_temp_measure(); // In blocking mode: this function waits until the measurement is finished.
18+
int32_t raw_temp = nrfx_temp_result_get();
19+
Serial.println(nrfx_temp_calculate(raw_temp));
20+
21+
delay(1000);
22+
}

0 commit comments

Comments
 (0)