From c0ad3cf6f06f702eb722df7b1a352177f99a5b4c Mon Sep 17 00:00:00 2001 From: neotje Date: Sun, 23 Oct 2022 12:45:03 +0200 Subject: [PATCH] nrfx_temp non-blocking example --- .../nrfx_temp_non-blocking.ino | 24 +++++++++++++++++++ libraries/nrfx_examples/library.properties | 9 +++++++ 2 files changed, 33 insertions(+) create mode 100644 libraries/nrfx_examples/examples/nrfx_temp_non-blocking/nrfx_temp_non-blocking.ino create mode 100644 libraries/nrfx_examples/library.properties diff --git a/libraries/nrfx_examples/examples/nrfx_temp_non-blocking/nrfx_temp_non-blocking.ino b/libraries/nrfx_examples/examples/nrfx_temp_non-blocking/nrfx_temp_non-blocking.ino new file mode 100644 index 00000000..a180e1c9 --- /dev/null +++ b/libraries/nrfx_examples/examples/nrfx_temp_non-blocking/nrfx_temp_non-blocking.ino @@ -0,0 +1,24 @@ +/* + This is example usage of the nrfx_temp driver +*/ + +#include +#include + +nrfx_temp_config_t config = NRFX_TEMP_DEFAULT_CONFIG; + +// this function is called when the temperature measurement is ready +void temp_handler(int32_t raw_temp) { + Serial.println(nrfx_temp_calculate(raw_temp)); +} + +void setup() { + Serial.begin(9600); + nrfx_temp_init(&config, &temp_handler); +} + +void loop() { + nrfx_temp_measure(); + + delay(1000); +} diff --git a/libraries/nrfx_examples/library.properties b/libraries/nrfx_examples/library.properties new file mode 100644 index 00000000..88677392 --- /dev/null +++ b/libraries/nrfx_examples/library.properties @@ -0,0 +1,9 @@ +name=nrfx examples +version=1.0 +author=Neotje +maintainer=Neotje +sentence=Examples for the Adafruit nRF52 Arduino platform using nrfx +paragraph=Examples for the Adafruit nRF52 Arduino platform using nrfx +category=other +url=https://github.com/adafruit/Adafruit_nRF52_Arduino +architectures=*