summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2014-10-23 16:58:21 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-10-29 22:23:54 +0000
commit66164f2784b1ca34d9a10febd39c19db064c1750 (patch)
tree965c82a6d0826de677ff5c95e8191f53a01cd9e0 /test
parentd5b32aa6e1e9ac206f4cbdd6cf4452a08dc2ec36 (diff)
downloadchrome-ec-66164f2784b1ca34d9a10febd39c19db064c1750.tar.gz
Samus: Split motion sense and lid angle
Split motion_sense.c. Translate the accel data in the Android coordinate right away. BUG=chrome-os-partner:32002 BRANCH=ToT TEST=On samus, check lid angle are still correct. Change-Id: If743e25245dc1ce4cdacb8a4d5af22616c4a79e4 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/225486 Reviewed-by: Sheng-liang Song <ssl@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org>
Diffstat (limited to 'test')
-rw-r--r--test/build.mk4
-rw-r--r--test/motion_lid.c (renamed from test/motion_sense.c)27
-rw-r--r--test/motion_lid.tasklist (renamed from test/motion_sense.tasklist)0
-rw-r--r--test/test_config.h6
4 files changed, 28 insertions, 9 deletions
diff --git a/test/build.mk b/test/build.mk
index 8995c41fb9..593142b58d 100644
--- a/test/build.mk
+++ b/test/build.mk
@@ -30,7 +30,7 @@ test-list-host=mutex pingpong utils kb_scan kb_mkbp lid_sw power_button hooks
test-list-host+=thermal flash queue kb_8042 extpwr_gpio console_edit system
test-list-host+=sbs_charging adapter host_command thermal_falco led_spring
test-list-host+=bklight_lid bklight_passthru interrupt timer_dos button
-test-list-host+=motion_sense math_util sbs_charging_v2 battery_get_params_smart
+test-list-host+=motion_lid math_util sbs_charging_v2 battery_get_params_smart
test-list-host+=lightbar inductive_charging usb_pd
adapter-y=adapter.o
@@ -52,7 +52,7 @@ kb_scan-y=kb_scan.o
led_spring-y=led_spring.o led_spring_impl.o
lid_sw-y=lid_sw.o
math_util-y=math_util.o
-motion_sense-y=motion_sense.o
+motion_lid-y=motion_lid.o
mutex-y=mutex.o
pingpong-y=pingpong.o
power_button-y=power_button.o
diff --git a/test/motion_sense.c b/test/motion_lid.c
index 5148935533..e8880e85a8 100644
--- a/test/motion_sense.c
+++ b/test/motion_lid.c
@@ -11,6 +11,7 @@
#include "common.h"
#include "hooks.h"
#include "host_command.h"
+#include "motion_lid.h"
#include "motion_sense.h"
#include "task.h"
#include "test_util.h"
@@ -88,15 +89,27 @@ const struct accelgyro_drv test_motion_sense = {
.get_data_rate = accel_get_data_rate,
};
+const matrix_3x3_t base_standard_ref = {
+ { 1, 0, 0},
+ { 0, 1, 0},
+ { 0, 0, 1}
+};
+
+const matrix_3x3_t lid_standard_ref = {
+ { 1, 0, 0},
+ { 1, 0, 0},
+ { 0, 0, 1}
+};
+
struct motion_sensor_t motion_sensors[] = {
{SENSOR_ACTIVE_S0_S3_S5, "base", SENSOR_CHIP_LSM6DS0,
SENSOR_ACCELEROMETER, LOCATION_BASE,
&test_motion_sense, NULL, NULL,
- 0, 119000, 2},
+ 0, &base_standard_ref, 119000, 2},
{SENSOR_ACTIVE_S0, "lid", SENSOR_CHIP_KXCJ9,
SENSOR_ACCELEROMETER, LOCATION_LID,
&test_motion_sense, NULL, NULL,
- 0, 100000, 2},
+ 0, &lid_standard_ref, 100000, 2},
};
const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
@@ -130,7 +143,7 @@ static int test_lid_angle(void)
task_wake(TASK_ID_MOTIONSENSE);
while ((*lpc_status & EC_MEMMAP_ACC_STATUS_SAMPLE_ID_MASK) == sample)
msleep(5);
- TEST_ASSERT(motion_get_lid_angle() == 0);
+ TEST_ASSERT(motion_lid_get_angle() == 0);
/* Set lid open to 90 degrees. */
lid->xyz[X] = -1000;
@@ -140,7 +153,7 @@ static int test_lid_angle(void)
task_wake(TASK_ID_MOTIONSENSE);
while ((*lpc_status & EC_MEMMAP_ACC_STATUS_SAMPLE_ID_MASK) == sample)
msleep(5);
- TEST_ASSERT(motion_get_lid_angle() == 90);
+ TEST_ASSERT(motion_lid_get_angle() == 90);
/* Set lid open to 225. */
lid->xyz[X] = 500;
@@ -150,7 +163,7 @@ static int test_lid_angle(void)
task_wake(TASK_ID_MOTIONSENSE);
while ((*lpc_status & EC_MEMMAP_ACC_STATUS_SAMPLE_ID_MASK) == sample)
msleep(5);
- TEST_ASSERT(motion_get_lid_angle() == 225);
+ TEST_ASSERT(motion_lid_get_angle() == 225);
/*
* Align base with hinge and make sure it returns unreliable for angle.
@@ -163,7 +176,7 @@ static int test_lid_angle(void)
task_wake(TASK_ID_MOTIONSENSE);
while ((*lpc_status & EC_MEMMAP_ACC_STATUS_SAMPLE_ID_MASK) == sample)
msleep(5);
- TEST_ASSERT(motion_get_lid_angle() == LID_ANGLE_UNRELIABLE);
+ TEST_ASSERT(motion_lid_get_angle() == LID_ANGLE_UNRELIABLE);
/*
* Use all three axes and set lid to negative base and make sure
@@ -179,7 +192,7 @@ static int test_lid_angle(void)
task_wake(TASK_ID_MOTIONSENSE);
while ((*lpc_status & EC_MEMMAP_ACC_STATUS_SAMPLE_ID_MASK) == sample)
msleep(5);
- TEST_ASSERT(motion_get_lid_angle() == 180);
+ TEST_ASSERT(motion_lid_get_angle() == 180);
return EC_SUCCESS;
}
diff --git a/test/motion_sense.tasklist b/test/motion_lid.tasklist
index 60688f9c34..60688f9c34 100644
--- a/test/motion_sense.tasklist
+++ b/test/motion_lid.tasklist
diff --git a/test/test_config.h b/test/test_config.h
index 24ccb19024..9a06858834 100644
--- a/test/test_config.h
+++ b/test/test_config.h
@@ -50,6 +50,12 @@
#define I2C_PORT_CHARGER 1
#endif
+#ifdef TEST_MOTION_LID
+#define CONFIG_LID_ANGLE
+#define CONFIG_SENSOR_BASE 0
+#define CONFIG_SENSOR_LID 1
+#endif
+
#ifdef TEST_SBS_CHARGING
#define CONFIG_BATTERY_MOCK
#define CONFIG_BATTERY_SMART