summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorYilun Lin <yllin@google.com>2018-09-08 00:06:09 +0800
committerchrome-bot <chrome-bot@chromium.org>2018-09-13 06:13:47 -0700
commitc4a842a78c778e7c15cd3f78ae354e4d21a85ae9 (patch)
tree6668b4fd3911769f0011b5b17512d66923eea5fc /include
parente6344f8560bad936573be75f6b2810373c2cdb01 (diff)
downloadchrome-ec-c4a842a78c778e7c15cd3f78ae354e4d21a85ae9.tar.gz
type: Rename vector_3_t to intv3_t.
Naming of many vector types and matrix types are not clear enough. For example, we have: vector_3_t, which is a vector of three int. vec3_t, which is a vector of three float. size4_t, which is a vector of four size_t. mat33_t, which is a 3x3 matrix of float. matrix_3x3_t, which is a 3x3 matrix of fixed point. Besides, we have types like int8_t, uint16_t types. To clearly distinguished types, the CL propose to, For vector types, naming should be `$type + 'v' + $num + '_t'`: vector_3_t becomes intv3_t vec3_t becomes floatv3_t vector 4 of uint16_t becomes uint16v4_t (which doesn't exist yet) For matrix types, naming should be `mat$N$N_` + $type + '_t', where $N is the matrix size: matrix_3x3_t becomes mat33_fp_t # fp: fixed point mat33_t becomes mat33_float_t TEST=make buildall -j BUG=b:114662791 Change-Id: I865aa3ecbab6cb97f8585a081a679adf00febe1d Signed-off-by: Yilun Lin <yllin@google.com> Reviewed-on: https://chromium-review.googlesource.com/1215442 Commit-Ready: Yilun Lin <yllin@chromium.org> Tested-by: Yilun Lin <yllin@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/accelgyro.h2
-rw-r--r--include/mag_cal.h4
-rw-r--r--include/math_util.h8
-rw-r--r--include/motion_lid.h2
-rw-r--r--include/motion_sense.h6
5 files changed, 11 insertions, 11 deletions
diff --git a/include/accelgyro.h b/include/accelgyro.h
index ea7b3efa6c..b2ea962ba2 100644
--- a/include/accelgyro.h
+++ b/include/accelgyro.h
@@ -30,7 +30,7 @@ struct accelgyro_drv {
* @v Vector to store acceleration (in units of counts).
* @return EC_SUCCESS if successful, non-zero if error.
*/
- int (*read)(const struct motion_sensor_t *s, vector_3_t v);
+ int (*read)(const struct motion_sensor_t *s, intv3_t v);
/**
* Setter and getter methods for the sensor range. The sensor range
diff --git a/include/mag_cal.h b/include/mag_cal.h
index 76410a193e..e0d6048be1 100644
--- a/include/mag_cal.h
+++ b/include/mag_cal.h
@@ -33,7 +33,7 @@ struct mag_cal_t {
vec4_t acc_w;
float radius;
- vector_3_t bias;
+ intv3_t bias;
/* number of samples needed to calibrate */
uint16_t batch_size;
@@ -42,5 +42,5 @@ struct mag_cal_t {
void init_mag_cal(struct mag_cal_t *moc);
-int mag_cal_update(struct mag_cal_t *moc, const vector_3_t v);
+int mag_cal_update(struct mag_cal_t *moc, const intv3_t v);
#endif /* __CROS_EC_MAG_CAL_H */
diff --git a/include/math_util.h b/include/math_util.h
index 093c6c099e..d94084f30d 100644
--- a/include/math_util.h
+++ b/include/math_util.h
@@ -99,7 +99,7 @@ static inline fp_t fp_abs(fp_t a)
typedef fp_t matrix_3x3_t[3][3];
/* Integer vector */
-typedef int vector_3_t[3];
+typedef int intv3_t[3];
/* For vectors, define which coordinates are in which location. */
enum {
@@ -132,7 +132,7 @@ fp_t arc_cos(fp_t x);
*
* @return Cosine of the angle between v1 and v2.
*/
-fp_t cosine_of_angle_diff(const vector_3_t v1, const vector_3_t v2);
+fp_t cosine_of_angle_diff(const intv3_t v1, const intv3_t v2);
/**
* Rotate vector v by rotation matrix R.
@@ -141,7 +141,7 @@ fp_t cosine_of_angle_diff(const vector_3_t v1, const vector_3_t v2);
* @param R Rotation matrix.
* @param res Resultant vector.
*/
-void rotate(const vector_3_t v, const matrix_3x3_t R, vector_3_t res);
+void rotate(const intv3_t v, const matrix_3x3_t R, intv3_t res);
/**
* Rotate vector v by rotation matrix R^-1.
@@ -150,6 +150,6 @@ void rotate(const vector_3_t v, const matrix_3x3_t R, vector_3_t res);
* @param R Rotation matrix.
* @param res Resultant vector.
*/
-void rotate_inv(const vector_3_t v, const matrix_3x3_t R, vector_3_t res);
+void rotate_inv(const intv3_t v, const matrix_3x3_t R, intv3_t res);
#endif /* __CROS_EC_MATH_UTIL_H */
diff --git a/include/motion_lid.h b/include/motion_lid.h
index 155c7735c9..6ce299c0e5 100644
--- a/include/motion_lid.h
+++ b/include/motion_lid.h
@@ -26,7 +26,7 @@ struct accel_orientation {
matrix_3x3_t rot_hinge_180;
/* Vector pointing along hinge axis. */
- vector_3_t hinge_axis;
+ intv3_t hinge_axis;
};
/* Link global structure for orientation. This must be defined in board.c. */
diff --git a/include/motion_sense.h b/include/motion_sense.h
index 07687feb5a..bbc82a0f71 100644
--- a/include/motion_sense.h
+++ b/include/motion_sense.h
@@ -118,9 +118,9 @@ struct motion_sensor_t {
/* state parameters */
enum sensor_state state;
- vector_3_t raw_xyz;
- vector_3_t xyz;
- vector_3_t spoof_xyz;
+ intv3_t raw_xyz;
+ intv3_t xyz;
+ intv3_t spoof_xyz;
/* How many flush events are pending */
uint32_t flush_pending;