diff options
author | Gwendal Grignou <gwendal@chromium.org> | 2014-10-23 16:58:21 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-10-29 22:23:54 +0000 |
commit | 66164f2784b1ca34d9a10febd39c19db064c1750 (patch) | |
tree | 965c82a6d0826de677ff5c95e8191f53a01cd9e0 /include/motion_sense.h | |
parent | d5b32aa6e1e9ac206f4cbdd6cf4452a08dc2ec36 (diff) | |
download | chrome-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 'include/motion_sense.h')
-rw-r--r-- | include/motion_sense.h | 79 |
1 files changed, 17 insertions, 62 deletions
diff --git a/include/motion_sense.h b/include/motion_sense.h index be764a8d00..bb5acc308c 100644 --- a/include/motion_sense.h +++ b/include/motion_sense.h @@ -12,66 +12,6 @@ #include "math_util.h" #include "chipset.h" -/* Anything outside of lid angle range [-180, 180] should work. */ -#define LID_ANGLE_UNRELIABLE 500.0F - -/** - * 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 the lid sensor into the same reference - * frame as the base sensor. - */ - matrix_3x3_t rot_align; - - /* 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; - - /* - * Rotation matrix to rotate base sensor into the standard reference - * frame. - */ - matrix_3x3_t rot_standard_ref; - - /* 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]. - */ -int motion_get_lid_angle(void); - - -/** - * Interrupt function for lid accelerometer. - * - * @param signal GPIO signal that caused interrupt - */ -void accel_int_lid(enum gpio_signal signal); - -/** - * Interrupt function for base accelerometer. - * - * @param signal GPIO signal that caused interrupt - */ -void accel_int_base(enum gpio_signal signal); - enum sensor_location_t { LOCATION_BASE = 0, LOCATION_LID = 1, @@ -110,6 +50,7 @@ struct motion_sensor_t { struct mutex *mutex; void *drv_data; uint8_t i2c_addr; + const matrix_3x3_t *rot_standard_ref; /* Default configuration parameters, RO only */ int default_odr; @@ -122,9 +63,7 @@ struct motion_sensor_t { /* state parameters */ enum sensor_state state; enum chipset_state_mask active; - vector_3_t raw_xyz; vector_3_t xyz; - }; /* Defined at board level. */ @@ -137,4 +76,20 @@ extern const unsigned int motion_sensor_count; */ #define MOTION_SENSE_HOOK_PRIO (HOOK_PRIO_DEFAULT) +#ifdef CONFIG_ACCEL_INTERRUPTS +/** + * Interrupt function for lid accelerometer. + * + * @param signal GPIO signal that caused interrupt + */ +void accel_int_lid(enum gpio_signal signal); + +/** + * Interrupt function for base accelerometer. + * + * @param signal GPIO signal that caused interrupt + */ +void accel_int_base(enum gpio_signal signal); +#endif + #endif /* __CROS_EC_MOTION_SENSE_H */ |