summaryrefslogtreecommitdiff
path: root/include/online_calibration.h
diff options
context:
space:
mode:
authorYuval Peress <peress@chromium.org>2020-01-16 11:20:01 -0700
committerCommit Bot <commit-bot@chromium.org>2020-03-09 23:02:12 +0000
commita00ace498da24a9288fd39f9728c8fd80cd54336 (patch)
tree98ea22bd6f4d1098bb9dfdaafb98795e1024eb27 /include/online_calibration.h
parent5ccb5c7cc9c448b66c6f8e0abbb2dd785da0efb7 (diff)
downloadchrome-ec-a00ace498da24a9288fd39f9728c8fd80cd54336.tar.gz
common: online_calibration: Fire MKBP event on new calibration
Implement online calibration for accelerometers and fire a new MKBP event when a new calibration value is computed. TEST=Added new unit tests BRANCH=None BUG=b:138303429,chromium:1023858 Change-Id: I31ec7164be0d8c7dac210a1ac4b94ec9ecd6a60a Signed-off-by: Yuval Peress <peress@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2012847 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Diffstat (limited to 'include/online_calibration.h')
-rw-r--r--include/online_calibration.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/include/online_calibration.h b/include/online_calibration.h
index 5d22ec5d5f..6f8fad33a7 100644
--- a/include/online_calibration.h
+++ b/include/online_calibration.h
@@ -7,6 +7,7 @@
#define __CROS_EC_ONLINE_CALIBRATION_H
#include "motion_sense.h"
+#include "stdbool.h"
/**
* Initialize the online calibration caches.
@@ -26,4 +27,20 @@ int online_calibration_process_data(
struct motion_sensor_t *sensor,
uint32_t timestamp);
+/**
+ * Check if new calibration values are available since the last read.
+ *
+ * @return True if the calibration values have changed.
+ */
+bool online_calibration_has_new_values(void);
+
+/**
+ * Read available calibration values and reset dirty bits.
+ *
+ * @param sensor_num The sensor index to get the calibration values for.
+ * @param out The target to copy the data into.
+ * @return True if a value was written to `out`.
+ */
+bool online_calibration_read(int sensor_num, int16_t out[3]);
+
#endif /* __CROS_EC_ONLINE_CALIBRATION_H */