diff options
author | Ching-Kang Yen <chingkang@chromium.org> | 2020-07-31 02:04:51 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-09-03 07:15:42 +0000 |
commit | 53a2ee971270fcf759766a83496da05685ec8151 (patch) | |
tree | 03c7627b41a63a53ac54e0158cb526c8b9982ffb /common/math_util.c | |
parent | 90c79d90699268d31a3a2d8f48af5955e493005b (diff) | |
download | chrome-ec-53a2ee971270fcf759766a83496da05685ec8151.tar.gz |
common: implement body_detection state machine
Implement body_detection state machine. Detect whether the user is
close to the devices or not.
Use the variance of acceleration from accelerometer to compute the
motion confidence. If motion confidence is high enough, set the motion
state to ON_BODY. If low enough, set it to OFF_BODY.
Also, make gesture_cal() be called only when the gesture sensor data is
updated.
BRANCH=None
BUG=b:123434029
TEST=make buildall, flash the ec, watch the ec console log
Change-Id: If886b7f9fc505ef4db4d7abb08194b8f866121bb
Signed-off-by: Ching-Kang Yen <chingkang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2230938
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Diffstat (limited to 'common/math_util.c')
-rw-r--r-- | common/math_util.c | 3 |
1 files changed, 0 insertions, 3 deletions
diff --git a/common/math_util.c b/common/math_util.c index 450dfbe5e7..dc52729c65 100644 --- a/common/math_util.c +++ b/common/math_util.c @@ -10,9 +10,6 @@ #include "math_util.h" #include "util.h" -/* Some useful math functions. Use with integers only! */ -#define SQ(x) ((x) * (x)) - /* For cosine lookup table, define the increment and the size of the table. */ #define COSINE_LUT_INCR_DEG 5 #define COSINE_LUT_SIZE ((180 / COSINE_LUT_INCR_DEG) + 1) |