summaryrefslogtreecommitdiff
path: root/include/math_util.h
diff options
context:
space:
mode:
authorYuval Peress <peress@chromium.org>2020-07-14 18:44:20 -0600
committerCommit Bot <commit-bot@chromium.org>2020-08-18 22:04:40 +0000
commit474c6a5321de1a56c0751963d20843a5d4eaf7c1 (patch)
tree7a05135570fd3919df069767a8f0db3dda4a5b47 /include/math_util.h
parentbc932aea929e058ab7561fc341fbea59d18240a0 (diff)
downloadchrome-ec-474c6a5321de1a56c0751963d20843a5d4eaf7c1.tar.gz
common: gyro_cal: Implement gyroscope calibration
Implement the calibration code for the gyroscope which is ported over from AOSP's https://android.googlesource.com/device/google/contexthub/+/refs/heads/master/firmware/os/algos/calibration/gyroscope/ BUG=b:138303429,b:137204366,chromium:1023858 TEST=Added unit tests BRANCH=None Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: Ic1ab2efb66565cda0a96c9c06722136fb184df77 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2244934 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Diffstat (limited to 'include/math_util.h')
-rw-r--r--include/math_util.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/math_util.h b/include/math_util.h
index a54eaf3618..6b60d4a1d6 100644
--- a/include/math_util.h
+++ b/include/math_util.h
@@ -22,6 +22,9 @@ typedef float fp_inter_t;
/* Fixed-point to float, for unit tests */
#define FP_TO_FLOAT(x) ((float)(x))
+#define FLT_MAX (3.4028234664e+38)
+#define FLT_MIN (1.1754943508e-38)
+
#else
/* Fixed-point type */
typedef int32_t fp_t;
@@ -39,6 +42,10 @@ typedef int64_t fp_inter_t;
#define FLOAT_TO_FP(x) ((fp_t)((x) * (float)(1<<FP_BITS)))
/* Fixed-point to float, for unit tests */
#define FP_TO_FLOAT(x) ((float)(x) / (float)(1<<FP_BITS))
+
+#define FLT_MAX INT32_MAX
+#define FLT_MIN INT32_MIN
+
#endif
/*