test/motion_angle_tablet.c: Format with clang-format
BRANCH=none
TEST=none
#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,
+ 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,17 +60,16 @@ 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],
+ 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 * \
+ TEST_ASSERT(index < 2 * TEST_LID_SAMPLE_SIZE *
(TABLET_MODE_DEBOUNCE_COUNT + 2) ||
tablet_get_mode());
}
@@ -86,9 +84,8 @@ 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],
+ 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 *
@@ -98,7 +95,6 @@ static int test_lid_angle_less180(void)
return EC_SUCCESS;
}
-
void run_test(int argc, char **argv)
{
test_reset();
