mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-27 01:45:55 +08:00
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:
@@ -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.)
|
||||
|
||||
Reference in New Issue
Block a user