From 917f1a64ad79705f8b5e541e6749394dbda2c21d Mon Sep 17 00:00:00 2001 From: baggio63446333 Date: Thu, 2 Dec 2021 19:04:47 +0900 Subject: [PATCH] libdsp: Fix compile error with the standard math library The libdsp uses M_PI_F and M_PI_2_F which are defined only in the NuttX math library. Fix an compile error when CONFIG_LIBM is disabled and the other math library is used. --- include/dsp.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/dsp.h b/include/dsp.h index 5c32749435..fa30f9176f 100644 --- a/include/dsp.h +++ b/include/dsp.h @@ -70,6 +70,16 @@ /* Some lib constants *******************************************************/ +/* These are defined only in the NuttX math library */ + +#ifndef M_PI_F +#define M_PI_F ((float)M_PI) +#endif + +#ifndef M_PI_2_F +#define M_PI_2_F ((float)M_PI_2) +#endif + /* Motor electrical angle is in range 0.0 to 2*PI */ #define MOTOR_ANGLE_E_MAX (2.0f*M_PI_F)