Skip to content

Commit

Permalink
samples: shields: lmp90100_evb: rtd: use newlib sqrt when available
Browse files Browse the repository at this point in the history
Avoid using local sqrt() approximation when newlib is enabled.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
  • Loading branch information
henrikbrixandersen authored and carlescufi committed Mar 15, 2021
1 parent e51e980 commit 5b87cca
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions samples/shields/lmp90100_evb/rtd/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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;
Expand All @@ -40,6 +42,7 @@ static double sqrt(double value)

return sqrt;
}
#endif /* CONFIG_NEWLIB_LIBC */

static double rtd_temperature(int nom, double resistance)
{
Expand Down

0 comments on commit 5b87cca

Please sign in to comment.