This is an automated email from the ASF dual-hosted git repository.

raiden00 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 917f1a6  libdsp: Fix compile error with the standard math library
917f1a6 is described below

commit 917f1a64ad79705f8b5e541e6749394dbda2c21d
Author: baggio63446333 <[email protected]>
AuthorDate: Thu Dec 2 19:04:47 2021 +0900

    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 5c32749..fa30f91 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)

Reply via email to