11

Dependencies:   mbed-dev-f303 FastPWM3

Revision:
52:8fff6f1a3f50
Parent:
45:aadebe074af6
--- a/math_ops.cpp	Tue Oct 26 08:56:41 2021 +0000
+++ b/math_ops.cpp	Mon Dec 20 01:24:06 2021 +0000
@@ -35,7 +35,9 @@
         *y = *y * limit/norm;
         }
     }
-
+void limit(float *x, float min, float max){
+    *x = fmaxf(fminf(*x, max), min);
+    }
 
 int float_to_uint(float x, float x_min, float x_max, uint8_t bits){
     /// Converts a float to an unsigned int, given range and number of bits ///