summaryrefslogtreecommitdiff
path: root/common/lid_angle.c
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2015-01-28 15:23:55 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-02-05 19:41:41 +0000
commitfd6a6900f786d47fc5364f9013356a741da5c113 (patch)
treeb701989e3564488dceb5ef965a1123aad22adcb9 /common/lid_angle.c
parentdf28140cc81bc87b4a278a2876db2c52158996c6 (diff)
downloadchrome-ec-fd6a6900f786d47fc5364f9013356a741da5c113.tar.gz
Convert motion sense calculations to fixed point.
Motion sense calculations do not require huge amounts of precision, so fixed point is plenty accurate. And fixed point works on Cortex-M0, which lacks a FPU. BUG=chrome-os-partner:36126 BRANCH=minnie (samus already works with the FPU, but could grab this if we want additional testing) TEST=manual 1. Boot system 2. At EC console: accelinfo on 250 3. Move lid through several different angles (30 degrees to max open) and see that it updates correctly and relatively smoothly. A few degrees of angle jitter is normal. 4. At several angles, rotate the chromebook around and see that the lid angle remains relatively stable. 5. If the hinge is made normal to the ground (or within 15 degrees of vertical), the angle should read 500, since the acceleration vectors don't yield good results in that orientation (for either fixed or float math). And run 'make buildall -j', which tests arc_cos() and lid angle calculations Change-Id: I70a0d08b8914629a3e21ae5578cbe8e50f29ad68 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/244116 Reviewed-by: Alec Berg <alecaberg@chromium.org>
Diffstat (limited to 'common/lid_angle.c')
-rw-r--r--common/lid_angle.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/common/lid_angle.c b/common/lid_angle.c
index a55cd5d291..eb6f6c94b5 100644
--- a/common/lid_angle.c
+++ b/common/lid_angle.c
@@ -59,7 +59,7 @@ static const int kb_wake_small_angle = 13;
*
* @return true/false
*/
-static int lid_in_range_to_accept_keys(float ang)
+static int lid_in_range_to_accept_keys(int ang)
{
/*
* If the keyboard wake large angle is min or max, then this
@@ -82,7 +82,7 @@ static int lid_in_range_to_accept_keys(float ang)
*
* @return true/false
*/
-static int lid_in_range_to_ignore_keys(float ang)
+static int lid_in_range_to_ignore_keys(int ang)
{
/*
* If the keyboard wake large angle is min or max, then this
@@ -114,9 +114,9 @@ void lid_angle_set_kb_wake_angle(int ang)
kb_wake_large_angle = ang;
}
-void lidangle_keyscan_update(float lid_ang)
+void lidangle_keyscan_update(int lid_ang)
{
- static float lidangle_buffer[KEY_SCAN_LID_ANGLE_BUFFER_SIZE];
+ static int lidangle_buffer[KEY_SCAN_LID_ANGLE_BUFFER_SIZE];
static int index;
int i;