mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-27 18:25:05 +00:00
Using the lid angle, detect if we are in tablet mode or not.
We are in tablet mode when the lid angle is large enough:
tablet_mode:
1 | +-----<----+----------
| \/ /\
| | |
0 |------------------------>----+
+------------------+----------+----------+ lid angle
0 240 300 360
BRANCH=kevin
BUG=chrome-os-partner:55702,b:27849483
TEST=Check on Kevin event are sent on tablet mode transition.
Change-Id: Id9935ce4dd717e2c20fa6c9520defb504a1760d9
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/383073
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
58 lines
1.5 KiB
C
58 lines
1.5 KiB
C
/* Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
/* Header for motion_lid.h */
|
|
|
|
#ifndef __CROS_EC_MOTION_LID_H
|
|
#define __CROS_EC_MOTION_LID_H
|
|
|
|
#include "host_command.h"
|
|
#include "math_util.h"
|
|
|
|
/**
|
|
* This structure defines all of the data needed to specify the orientation
|
|
* of the base and lid accelerometers in order to calculate the lid angle.
|
|
*/
|
|
struct accel_orientation {
|
|
/* Rotation matrix to rotate positive 90 degrees around the hinge. */
|
|
matrix_3x3_t rot_hinge_90;
|
|
|
|
/*
|
|
* Rotation matrix to rotate 180 degrees around the hinge. The value
|
|
* here should be rot_hinge_90 ^ 2.
|
|
*/
|
|
matrix_3x3_t rot_hinge_180;
|
|
|
|
/* Vector pointing along hinge axis. */
|
|
vector_3_t hinge_axis;
|
|
};
|
|
|
|
/* Link global structure for orientation. This must be defined in board.c. */
|
|
extern const struct accel_orientation acc_orient;
|
|
|
|
|
|
/**
|
|
* Get last calculated lid angle. Note, the lid angle calculated by the EC
|
|
* is un-calibrated and is an approximate angle.
|
|
*
|
|
* @return lid angle in degrees in range [0, 360], or LID_ANGLE_UNRELIABLE
|
|
* if the lid angle can't be determined.
|
|
*/
|
|
int motion_lid_get_angle(void);
|
|
|
|
int host_cmd_motion_lid(struct host_cmd_handler_args *args);
|
|
|
|
void motion_lid_calc(void);
|
|
|
|
#ifdef CONFIG_LID_ANGLE_TABLET_MODE
|
|
int motion_lid_in_tablet_mode(void);
|
|
#else
|
|
static inline int motion_lid_in_tablet_mode(void) { return 0; }
|
|
#endif
|
|
|
|
#endif /* __CROS_EC_MOTION_LID_H */
|
|
|
|
|