remove all <cmath> usage

* the NuttX c++ library is incomplete, let's avoid including it until we have a real standard library in place
This commit is contained in:
Daniel Agar
2019-11-25 10:04:04 -05:00
committed by GitHub
parent 4a28c8180b
commit a8ea55d9b6
17 changed files with 21 additions and 21 deletions
@@ -43,7 +43,7 @@
#include <px4_platform_common/defines.h>
#include <systemlib/px4_macros.h>
#include <cmath>
#include <math.h>
#define CAT3_(A, B, C) A##B##C
#define CAT3(A, B, C) CAT3_(A, B, C)
@@ -166,7 +166,7 @@ void start_note(unsigned frequency)
float signal_period = (1.0f / frequency) * 0.5f;
// Calculate the hardware clock divisor rounded to the nearest integer.
unsigned int divisor = std::round(signal_period * TONE_ALARM_CLOCK);
unsigned int divisor = roundf(signal_period * TONE_ALARM_CLOCK);
rCNT = 0;
rMOD = divisor; // Load new signal switching period.
@@ -34,7 +34,7 @@
#include <drivers/device/device.h>
#include <drivers/drv_tone_alarm.h>
#include <px4_platform_common/defines.h>
#include <cmath>
#include <math.h>
/* Check that tone alarm and HRT timers are different */
#if defined(TONE_ALARM_TIMER) && defined(HRT_TIMER)
@@ -288,7 +288,7 @@ void start_note(unsigned frequency)
float signal_period = (1.0f / frequency) * 0.5f;
// Calculate the hardware clock divisor rounded to the nearest integer.
unsigned int divisor = std::round(signal_period * TONE_ALARM_CLOCK);
unsigned int divisor = roundf(signal_period * TONE_ALARM_CLOCK);
// Pick the lowest prescaler value that we can use.
// (Note that the effective prescale value is 1 greater.)