First commit

This commit is contained in:
Miguel I.
2025-09-02 18:12:30 +02:00
commit 71b3c6f703
865 changed files with 114028 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
#include "temperature.h"
#include <nrfx_temp.h>
#include <zephyr/sys/printk.h>
int temperature_init(void) {
nrfx_temp_config_t cfg = NRFX_TEMP_DEFAULT_CONFIG;
return nrfx_temp_init(&cfg, NULL);
}
int temperature_get_celsius(int32_t *temp_c) {
nrfx_temp_measure();
int32_t raw = nrfx_temp_result_get();
/* Convert to °C (raw is 0.25 °C per LSB) */
*temp_c = raw / 4;
return 0;
}

View File

@@ -0,0 +1,9 @@
#ifndef TEMPERATURE_H
#define TEMPERATURE_H
#include <stdint.h>
int temperature_init(void);
int temperature_get_celsius(int32_t *temp_c);
#endif // TEMPERATURE_H