diff options
Diffstat (limited to 'test/motion_angle_tablet.c')
-rw-r--r-- | test/motion_angle_tablet.c | 44 |
1 files changed, 20 insertions, 24 deletions
diff --git a/test/motion_angle_tablet.c b/test/motion_angle_tablet.c index 8eea053405..2c0c15c828 100644 --- a/test/motion_angle_tablet.c +++ b/test/motion_angle_tablet.c @@ -1,4 +1,4 @@ -/* Copyright 2018 The Chromium OS Authors. All rights reserved. +/* Copyright 2018 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. * @@ -19,25 +19,24 @@ #include "test_util.h" #include "util.h" - /*****************************************************************************/ /* Test utilities */ /* convert array value from g to m.s^2. */ int filler(const struct motion_sensor_t *s, const float v) { - return FP_TO_INT( fp_div( - FLOAT_TO_FP(v) * MOTION_SCALING_FACTOR, - fp_mul(INT_TO_FP(s->current_range), MOTION_ONE_G))); + return FP_TO_INT( + fp_div(FLOAT_TO_FP(v) * MOTION_SCALING_FACTOR, + fp_mul(INT_TO_FP(s->current_range), MOTION_ONE_G))); } static int test_lid_angle_less180(void) { int index = 0, lid_angle; - struct motion_sensor_t *lid = &motion_sensors[ - CONFIG_LID_ANGLE_SENSOR_LID]; - struct motion_sensor_t *base = &motion_sensors[ - CONFIG_LID_ANGLE_SENSOR_BASE]; + struct motion_sensor_t *lid = + &motion_sensors[CONFIG_LID_ANGLE_SENSOR_LID]; + struct motion_sensor_t *base = + &motion_sensors[CONFIG_LID_ANGLE_SENSOR_BASE]; /* We don't have TASK_CHIP so simulate init ourselves */ hook_notify(HOOK_CHIPSET_SHUTDOWN); @@ -61,18 +60,17 @@ static int test_lid_angle_less180(void) /* Check we stay in tablet mode, even when hinge is vertical. */ while (index < kAccelerometerVerticalHingeTestDataLength) { - feed_accel_data(kAccelerometerVerticalHingeTestData, - &index, filler); + feed_accel_data(kAccelerometerVerticalHingeTestData, &index, + filler); wait_for_valid_sample(); lid_angle = motion_lid_get_angle(); cprints(CC_ACCEL, "%d : LID(%d, %d, %d)/BASE(%d, %d, %d): %d", - index / TEST_LID_SAMPLE_SIZE, - lid->xyz[X], lid->xyz[Y], lid->xyz[Z], - base->xyz[X], base->xyz[Y], base->xyz[Z], - lid_angle); + index / TEST_LID_SAMPLE_SIZE, lid->xyz[X], lid->xyz[Y], + lid->xyz[Z], base->xyz[X], base->xyz[Y], base->xyz[Z], + lid_angle); /* We need few sample to debounce and enter laptop mode. */ - TEST_ASSERT(index < 2 * TEST_LID_SAMPLE_SIZE * \ - (TABLET_MODE_DEBOUNCE_COUNT + 2) || + TEST_ASSERT(index < 2 * TEST_LID_SAMPLE_SIZE * + (TABLET_MODE_DEBOUNCE_COUNT + 2) || tablet_get_mode()); } /* @@ -86,20 +84,18 @@ static int test_lid_angle_less180(void) wait_for_valid_sample(); lid_angle = motion_lid_get_angle(); cprints(CC_ACCEL, "%d : LID(%d, %d, %d)/BASE(%d, %d, %d): %d", - index / TEST_LID_SAMPLE_SIZE, - lid->xyz[X], lid->xyz[Y], lid->xyz[Z], - base->xyz[X], base->xyz[Y], base->xyz[Z], - lid_angle); + index / TEST_LID_SAMPLE_SIZE, lid->xyz[X], lid->xyz[Y], + lid->xyz[Z], base->xyz[X], base->xyz[Y], base->xyz[Z], + lid_angle); /* We need few sample to debounce and enter laptop mode. */ TEST_ASSERT(index < TEST_LID_SAMPLE_SIZE * - (TABLET_MODE_DEBOUNCE_COUNT + 2) || + (TABLET_MODE_DEBOUNCE_COUNT + 2) || tablet_get_mode()); } return EC_SUCCESS; } - -void run_test(int argc, char **argv) +void run_test(int argc, const char **argv) { test_reset(); |