samples: shields: lmp90100_evb: rtd: use newlib sqrt when available

Avoid using local sqrt() approximation when newlib is enabled.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
This commit is contained in:
Henrik Brix Andersen 2021-02-20 19:04:57 +01:00 committed by Carles Cufí
commit 5b87cca98b

View file

@ -8,6 +8,7 @@
#include <device.h>
#include <drivers/adc.h>
#include <stdio.h>
#include <math.h>
#define LOG_LEVEL CONFIG_LOG_DEFAULT_LEVEL
#include <logging/log.h>
@ -25,6 +26,7 @@ LOG_MODULE_REGISTER(main);
/* Bottom resistor value in ohms */
#define BOTTOM_RESISTANCE 2000
#ifndef CONFIG_NEWLIB_LIBC
static double sqrt(double value)
{
double sqrt = value / 3;
@ -40,6 +42,7 @@ static double sqrt(double value)
return sqrt;
}
#endif /* CONFIG_NEWLIB_LIBC */
static double rtd_temperature(int nom, double resistance)
{