summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYilun Lin <yllin@google.com>2018-09-08 00:31:36 +0800
committerchrome-bot <chrome-bot@chromium.org>2018-09-13 06:13:51 -0700
commitcb49a07fd350d9b513b019f755730d298bf719e7 (patch)
tree49057db244ea0b103c1026e4b9aea2ce5037af1e
parentc857c83cca204ab23e5d355ac1751b3cd7d95fb8 (diff)
downloadchrome-ec-cb49a07fd350d9b513b019f755730d298bf719e7.tar.gz
type: Rename matrix_3x3_t to mat33_fp_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: I51d88d44252184e4b7b3564236833b0b892edc39 Signed-off-by: Yilun Lin <yllin@google.com> Reviewed-on: https://chromium-review.googlesource.com/1215449 Commit-Ready: Yilun Lin <yllin@chromium.org> Tested-by: Yilun Lin <yllin@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
-rw-r--r--baseboard/grunt/baseboard.c10
-rw-r--r--baseboard/grunt/baseboard.h2
-rw-r--r--board/atlas/board.c2
-rw-r--r--board/bobba/board.c2
-rw-r--r--board/cheza/board.c2
-rw-r--r--board/coral/board.c4
-rw-r--r--board/elm/board.c4
-rw-r--r--board/eve/board.c4
-rw-r--r--board/fleex/board.c4
-rw-r--r--board/kukui/board.c2
-rw-r--r--board/meep/board.c2
-rw-r--r--board/nami/board.c6
-rw-r--r--board/nautilus/board.c4
-rw-r--r--board/nocturne/board.c2
-rw-r--r--board/oak/board.c2
-rw-r--r--board/phaser/board.c2
-rw-r--r--board/poppy/board.c8
-rw-r--r--board/rainier/board.c2
-rw-r--r--board/rammus/board.c4
-rw-r--r--board/reef/board.c4
-rw-r--r--board/reef_mchp/board.c4
-rw-r--r--board/rowan/board.c2
-rw-r--r--board/samus/board.c4
-rw-r--r--board/scarlet/board.c2
-rw-r--r--board/strago/board.c4
-rw-r--r--board/yorp/board.c2
-rw-r--r--common/math_util.c4
-rw-r--r--include/math_util.h6
-rw-r--r--include/motion_lid.h4
-rw-r--r--include/motion_sense.h2
-rw-r--r--test/math_util.c2
31 files changed, 54 insertions, 54 deletions
diff --git a/baseboard/grunt/baseboard.c b/baseboard/grunt/baseboard.c
index c70a142840..8b37381f12 100644
--- a/baseboard/grunt/baseboard.c
+++ b/baseboard/grunt/baseboard.c
@@ -340,13 +340,13 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
-matrix_3x3_t grunt_base_standard_ref = {
+mat33_fp_t grunt_base_standard_ref = {
{ FLOAT_TO_FP(1), 0, 0},
{ 0, FLOAT_TO_FP(1), 0},
{ 0, 0, FLOAT_TO_FP(1)}
};
-matrix_3x3_t lid_standard_ref = {
+mat33_fp_t lid_standard_ref = {
{ FLOAT_TO_FP(1), 0, 0},
{ 0, FLOAT_TO_FP(1), 0},
{ 0, 0, FLOAT_TO_FP(1)}
@@ -369,7 +369,7 @@ struct motion_sensor_t motion_sensors[] = {
.drv_data = &g_kx022_data,
.port = I2C_PORT_SENSOR,
.addr = KX022_ADDR1,
- .rot_standard_ref = (const matrix_3x3_t *)&lid_standard_ref,
+ .rot_standard_ref = (const mat33_fp_t *)&lid_standard_ref,
.default_range = 2, /* g, enough for laptop. */
.min_frequency = KX022_ACCEL_MIN_FREQ,
.max_frequency = KX022_ACCEL_MAX_FREQ,
@@ -393,7 +393,7 @@ struct motion_sensor_t motion_sensors[] = {
.port = I2C_PORT_SENSOR,
.addr = BMI160_ADDR0,
.default_range = 2, /* g, enough for laptop */
- .rot_standard_ref = (const matrix_3x3_t *)&grunt_base_standard_ref,
+ .rot_standard_ref = (const mat33_fp_t *)&grunt_base_standard_ref,
.min_frequency = BMI160_ACCEL_MIN_FREQ,
.max_frequency = BMI160_ACCEL_MAX_FREQ,
.config = {
@@ -421,7 +421,7 @@ struct motion_sensor_t motion_sensors[] = {
.port = I2C_PORT_SENSOR,
.addr = BMI160_ADDR0,
.default_range = 1000, /* dps */
- .rot_standard_ref = (const matrix_3x3_t *)&grunt_base_standard_ref,
+ .rot_standard_ref = (const mat33_fp_t *)&grunt_base_standard_ref,
.min_frequency = BMI160_GYRO_MIN_FREQ,
.max_frequency = BMI160_GYRO_MAX_FREQ,
},
diff --git a/baseboard/grunt/baseboard.h b/baseboard/grunt/baseboard.h
index 0a3bce9824..8eef4fc998 100644
--- a/baseboard/grunt/baseboard.h
+++ b/baseboard/grunt/baseboard.h
@@ -252,7 +252,7 @@ enum sensor_id {
* Boards within the Grunt family may need to modify this definition at
* board_init() time.
*/
-extern matrix_3x3_t grunt_base_standard_ref;
+extern mat33_fp_t grunt_base_standard_ref;
/* Sensors without hardware FIFO are in forced mode */
#define CONFIG_ACCEL_FORCE_MODE_MASK (1 << LID_ACCEL)
diff --git a/board/atlas/board.c b/board/atlas/board.c
index 09cb8c3a25..6e403bfd8f 100644
--- a/board/atlas/board.c
+++ b/board/atlas/board.c
@@ -577,7 +577,7 @@ static struct opt3001_drv_data_t g_opt3001_data = {
};
/* Matrix to rotate accelerometer into standard reference frame */
-const matrix_3x3_t base_standard_ref = {
+const mat33_fp_t base_standard_ref = {
{ FLOAT_TO_FP(-1), 0, 0},
{ 0, FLOAT_TO_FP(1), 0},
{ 0, 0, FLOAT_TO_FP(-1)}
diff --git a/board/bobba/board.c b/board/bobba/board.c
index 9b0bc42ebf..9245f71821 100644
--- a/board/bobba/board.c
+++ b/board/bobba/board.c
@@ -117,7 +117,7 @@ static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
/* Matrix to rotate accelrator into standard reference frame */
-const matrix_3x3_t base_standard_ref = {
+const mat33_fp_t base_standard_ref = {
{ 0, FLOAT_TO_FP(-1), 0},
{ FLOAT_TO_FP(1), 0, 0},
{ 0, 0, FLOAT_TO_FP(1)}
diff --git a/board/cheza/board.c b/board/cheza/board.c
index c514a0875e..3e176736fd 100644
--- a/board/cheza/board.c
+++ b/board/cheza/board.c
@@ -474,7 +474,7 @@ static struct mutex g_lid_mutex;
static struct bmi160_drv_data_t g_bmi160_data;
/* Matrix to rotate accelerometer into standard reference frame */
-const matrix_3x3_t base_standard_ref = {
+const mat33_fp_t base_standard_ref = {
{ FLOAT_TO_FP(-1), 0, 0},
{ 0, FLOAT_TO_FP(-1), 0},
{ 0, 0, FLOAT_TO_FP(1)}
diff --git a/board/coral/board.c b/board/coral/board.c
index 2cf54638e5..e651561e11 100644
--- a/board/coral/board.c
+++ b/board/coral/board.c
@@ -710,13 +710,13 @@ static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
/* Matrix to rotate accelrator into standard reference frame */
-const matrix_3x3_t base_standard_ref = {
+const mat33_fp_t base_standard_ref = {
{ 0, FLOAT_TO_FP(-1), 0},
{ FLOAT_TO_FP(1), 0, 0},
{ 0, 0, FLOAT_TO_FP(1)}
};
-const matrix_3x3_t mag_standard_ref = {
+const mat33_fp_t mag_standard_ref = {
{ FLOAT_TO_FP(-1), 0, 0},
{ 0, FLOAT_TO_FP(1), 0},
{ 0, 0, FLOAT_TO_FP(-1)}
diff --git a/board/elm/board.c b/board/elm/board.c
index 7ebf20225b..67a60d1aed 100644
--- a/board/elm/board.c
+++ b/board/elm/board.c
@@ -438,13 +438,13 @@ DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT);
static struct mutex g_kx022_mutex[2];
/* Matrix to rotate accelerometer into standard reference frame */
-const matrix_3x3_t base_standard_ref = {
+const mat33_fp_t base_standard_ref = {
{ FLOAT_TO_FP(-1), 0, 0},
{ 0, FLOAT_TO_FP(1), 0},
{ 0, 0, FLOAT_TO_FP(-1)}
};
-const matrix_3x3_t lid_standard_ref = {
+const mat33_fp_t lid_standard_ref = {
{ FLOAT_TO_FP(1), 0, 0},
{ 0, FLOAT_TO_FP(-1), 0},
{ 0, 0, FLOAT_TO_FP(-1)}
diff --git a/board/eve/board.c b/board/eve/board.c
index 30089a3321..9943d4688b 100644
--- a/board/eve/board.c
+++ b/board/eve/board.c
@@ -786,13 +786,13 @@ static struct si114x_drv_data_t g_si114x_data = {
};
/* Matrix to rotate accelrator into standard reference frame */
-const matrix_3x3_t mag_standard_ref = {
+const mat33_fp_t mag_standard_ref = {
{ FLOAT_TO_FP(-1), 0, 0},
{ 0, FLOAT_TO_FP(1), 0},
{ 0, 0, FLOAT_TO_FP(-1)}
};
-const matrix_3x3_t lid_standard_ref = {
+const mat33_fp_t lid_standard_ref = {
{FLOAT_TO_FP(-1), 0, 0},
{ 0, FLOAT_TO_FP(-1), 0},
{ 0, 0, FLOAT_TO_FP(1)}
diff --git a/board/fleex/board.c b/board/fleex/board.c
index 220c031c95..d9227928b7 100644
--- a/board/fleex/board.c
+++ b/board/fleex/board.c
@@ -115,13 +115,13 @@ static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
/* Matrix to rotate accelerometer into standard reference frame */
-const matrix_3x3_t lid_standard_ref = {
+const mat33_fp_t lid_standard_ref = {
{ 0, FLOAT_TO_FP(1), 0},
{ FLOAT_TO_FP(-1), 0, 0},
{ 0, 0, FLOAT_TO_FP(1)}
};
- const matrix_3x3_t base_standard_ref = {
+ const mat33_fp_t base_standard_ref = {
{ FLOAT_TO_FP(-1), 0, 0},
{ 0, FLOAT_TO_FP(-1), 0},
{ 0, 0, FLOAT_TO_FP(1)}
diff --git a/board/kukui/board.c b/board/kukui/board.c
index 5509aee78a..5d610c83a4 100644
--- a/board/kukui/board.c
+++ b/board/kukui/board.c
@@ -353,7 +353,7 @@ static struct mutex g_base_mutex;
static struct bmi160_drv_data_t g_bmi160_data;
/* Matrix to rotate accelerometer into standard reference frame */
-const matrix_3x3_t base_standard_ref = {
+const mat33_fp_t base_standard_ref = {
{ FLOAT_TO_FP(-1), 0, 0},
{ 0, FLOAT_TO_FP(-1), 0},
{ 0, 0, FLOAT_TO_FP(1)}
diff --git a/board/meep/board.c b/board/meep/board.c
index 83fe05a50f..725e8b186b 100644
--- a/board/meep/board.c
+++ b/board/meep/board.c
@@ -122,7 +122,7 @@ static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
/* Matrix to rotate accelrator into standard reference frame */
-const matrix_3x3_t base_standard_ref = {
+const mat33_fp_t base_standard_ref = {
{ 0, FLOAT_TO_FP(-1), 0},
{ FLOAT_TO_FP(1), 0, 0},
{ 0, 0, FLOAT_TO_FP(1)}
diff --git a/board/nami/board.c b/board/nami/board.c
index 76edea3f73..cb5efe7bf6 100644
--- a/board/nami/board.c
+++ b/board/nami/board.c
@@ -683,19 +683,19 @@ static struct kionix_accel_data g_kx022_data;
static struct accelgyro_saved_data_t g_bma255_data;
/* Matrix to rotate accelrator into standard reference frame */
-const matrix_3x3_t base_standard_ref = {
+const mat33_fp_t base_standard_ref = {
{ 0, FLOAT_TO_FP(-1), 0},
{ FLOAT_TO_FP(1), 0, 0},
{ 0, 0, FLOAT_TO_FP(1)}
};
-const matrix_3x3_t lid_standard_ref = {
+const mat33_fp_t lid_standard_ref = {
{ FLOAT_TO_FP(1), 0, 0},
{ 0, FLOAT_TO_FP(-1), 0},
{ 0, 0, FLOAT_TO_FP(-1)}
};
-const matrix_3x3_t rotation_x180_z90 = {
+const mat33_fp_t rotation_x180_z90 = {
{ 0, FLOAT_TO_FP(-1), 0 },
{ FLOAT_TO_FP(-1), 0, 0 },
{ 0, 0, FLOAT_TO_FP(-1) }
diff --git a/board/nautilus/board.c b/board/nautilus/board.c
index 39d46283e5..e765064bf6 100644
--- a/board/nautilus/board.c
+++ b/board/nautilus/board.c
@@ -621,13 +621,13 @@ static struct bmi160_drv_data_t g_bmi160_data;
static struct accelgyro_saved_data_t g_bma255_data;
/* Matrix to rotate accelrator into standard reference frame */
-const matrix_3x3_t base_standard_ref = {
+const mat33_fp_t base_standard_ref = {
{ FLOAT_TO_FP(-1), 0, 0 },
{ 0, FLOAT_TO_FP(1), 0 },
{ 0, 0, FLOAT_TO_FP(-1) }
};
-const matrix_3x3_t lid_standard_ref = {
+const mat33_fp_t lid_standard_ref = {
{ FLOAT_TO_FP(-1), 0, 0 },
{ 0, FLOAT_TO_FP(1), 0 },
{ 0, 0, FLOAT_TO_FP(-1) }
diff --git a/board/nocturne/board.c b/board/nocturne/board.c
index 4afb2fb581..fd61390cc1 100644
--- a/board/nocturne/board.c
+++ b/board/nocturne/board.c
@@ -159,7 +159,7 @@ static struct opt3001_drv_data_t g_opt3001_data = {
};
/* Matrix to rotate accel/gyro into standard reference frame. */
-const matrix_3x3_t lid_standard_ref = {
+const mat33_fp_t lid_standard_ref = {
{ 0, FLOAT_TO_FP(1), 0},
{ FLOAT_TO_FP(-1), 0, 0},
{ 0, 0, FLOAT_TO_FP(1)}
diff --git a/board/oak/board.c b/board/oak/board.c
index ae5fbbbb2e..4fd49330d1 100644
--- a/board/oak/board.c
+++ b/board/oak/board.c
@@ -606,7 +606,7 @@ static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
/* Matrix to rotate accelrator into standard reference frame */
-const matrix_3x3_t base_standard_ref = {
+const mat33_fp_t base_standard_ref = {
{ FLOAT_TO_FP(-1), 0, 0},
{ 0, FLOAT_TO_FP(-1), 0},
{ 0, 0, FLOAT_TO_FP(1)}
diff --git a/board/phaser/board.c b/board/phaser/board.c
index b529f83787..d66c0236ac 100644
--- a/board/phaser/board.c
+++ b/board/phaser/board.c
@@ -101,7 +101,7 @@ static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
/* Matrix to rotate lid and base sensor into standard reference frame */
-const matrix_3x3_t standard_rot_ref = {
+const mat33_fp_t standard_rot_ref = {
{ FLOAT_TO_FP(-1), 0, 0},
{ 0, FLOAT_TO_FP(-1), 0},
{ 0, 0, FLOAT_TO_FP(1)}
diff --git a/board/poppy/board.c b/board/poppy/board.c
index e20685e40f..61b990b7a2 100644
--- a/board/poppy/board.c
+++ b/board/poppy/board.c
@@ -746,27 +746,27 @@ static struct opt3001_drv_data_t g_opt3001_data = {
};
/* Matrix to rotate accelrator into standard reference frame */
-const matrix_3x3_t mag_standard_ref = {
+const mat33_fp_t mag_standard_ref = {
{ FLOAT_TO_FP(-1), 0, 0},
{ 0, FLOAT_TO_FP(1), 0},
{ 0, 0, FLOAT_TO_FP(-1)}
};
#ifdef BOARD_SORAKA
-const matrix_3x3_t lid_standard_ref = {
+const mat33_fp_t lid_standard_ref = {
{ 0, FLOAT_TO_FP(-1), 0},
{FLOAT_TO_FP(1), 0, 0},
{ 0, 0, FLOAT_TO_FP(1)}
};
/* For rev3 and older */
-const matrix_3x3_t lid_standard_ref_old = {
+const mat33_fp_t lid_standard_ref_old = {
{FLOAT_TO_FP(-1), 0, 0},
{ 0, FLOAT_TO_FP(-1), 0},
{ 0, 0, FLOAT_TO_FP(1)}
};
#else
-const matrix_3x3_t lid_standard_ref = {
+const mat33_fp_t lid_standard_ref = {
{FLOAT_TO_FP(-1), 0, 0},
{ 0, FLOAT_TO_FP(-1), 0},
{ 0, 0, FLOAT_TO_FP(1)}
diff --git a/board/rainier/board.c b/board/rainier/board.c
index 0b61cd03e1..c3b7fab020 100644
--- a/board/rainier/board.c
+++ b/board/rainier/board.c
@@ -350,7 +350,7 @@ static struct mutex g_base_mutex;
static struct bmi160_drv_data_t g_bmi160_data;
/* Matrix to rotate accelerometer into standard reference frame */
-const matrix_3x3_t base_standard_ref = {
+const mat33_fp_t base_standard_ref = {
{ 0, FLOAT_TO_FP(1), 0},
{ FLOAT_TO_FP(-1), 0, 0},
{ 0, 0, FLOAT_TO_FP(1)}
diff --git a/board/rammus/board.c b/board/rammus/board.c
index 7bf268ec69..2b6c528b4a 100644
--- a/board/rammus/board.c
+++ b/board/rammus/board.c
@@ -563,13 +563,13 @@ static struct bmi160_drv_data_t g_bmi160_data;
static struct accelgyro_saved_data_t g_bma255_data;
/* Matrix to rotate accelrator into standard reference frame */
-const matrix_3x3_t base_standard_ref = {
+const mat33_fp_t base_standard_ref = {
{ FLOAT_TO_FP(-1), 0, 0 },
{ 0, FLOAT_TO_FP(1), 0 },
{ 0, 0, FLOAT_TO_FP(-1) }
};
-const matrix_3x3_t lid_standard_ref = {
+const mat33_fp_t lid_standard_ref = {
{ FLOAT_TO_FP(-1), 0, 0 },
{ 0, FLOAT_TO_FP(1), 0 },
{ 0, 0, FLOAT_TO_FP(-1) }
diff --git a/board/reef/board.c b/board/reef/board.c
index d5cbe46099..54766f73b9 100644
--- a/board/reef/board.c
+++ b/board/reef/board.c
@@ -696,13 +696,13 @@ static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
/* Matrix to rotate accelrator into standard reference frame */
-const matrix_3x3_t base_standard_ref = {
+const mat33_fp_t base_standard_ref = {
{ 0, FLOAT_TO_FP(-1), 0},
{ FLOAT_TO_FP(1), 0, 0},
{ 0, 0, FLOAT_TO_FP(1)}
};
-const matrix_3x3_t mag_standard_ref = {
+const mat33_fp_t mag_standard_ref = {
{ FLOAT_TO_FP(-1), 0, 0},
{ 0, FLOAT_TO_FP(1), 0},
{ 0, 0, FLOAT_TO_FP(-1)}
diff --git a/board/reef_mchp/board.c b/board/reef_mchp/board.c
index 81d6134915..91dc329b0c 100644
--- a/board/reef_mchp/board.c
+++ b/board/reef_mchp/board.c
@@ -962,13 +962,13 @@ static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
/* Matrix to rotate accelrator into standard reference frame */
-const matrix_3x3_t base_standard_ref = {
+const mat33_fp_t base_standard_ref = {
{ 0, FLOAT_TO_FP(-1), 0},
{ FLOAT_TO_FP(1), 0, 0},
{ 0, 0, FLOAT_TO_FP(1)}
};
-const matrix_3x3_t mag_standard_ref = {
+const mat33_fp_t mag_standard_ref = {
{ FLOAT_TO_FP(-1), 0, 0},
{ 0, FLOAT_TO_FP(1), 0},
{ 0, 0, FLOAT_TO_FP(-1)}
diff --git a/board/rowan/board.c b/board/rowan/board.c
index 8feda44674..15c54b8392 100644
--- a/board/rowan/board.c
+++ b/board/rowan/board.c
@@ -441,7 +441,7 @@ BUILD_ASSERT(ARRAY_SIZE(als) == ALS_COUNT);
static struct mutex g_lid_mutex;
/* Matrix to rotate accelerometer into standard reference frame */
-const matrix_3x3_t lid_standard_ref = {
+const mat33_fp_t lid_standard_ref = {
{ FLOAT_TO_FP(-1), 0, 0},
{ 0, FLOAT_TO_FP(-1), 0},
{ 0, 0, FLOAT_TO_FP(1)}
diff --git a/board/samus/board.c b/board/samus/board.c
index 646d8ded9a..b8f66ca101 100644
--- a/board/samus/board.c
+++ b/board/samus/board.c
@@ -299,13 +299,13 @@ struct lsm6ds0_data g_saved_data[2];
/* Four Motion sensors */
/* Matrix to rotate accelrator into standard reference frame */
-const matrix_3x3_t base_standard_ref = {
+const mat33_fp_t base_standard_ref = {
{FLOAT_TO_FP(-1), 0, 0},
{ 0, FLOAT_TO_FP(-1), 0},
{ 0, 0, FLOAT_TO_FP(-1)}
};
-const matrix_3x3_t lid_standard_ref = {
+const mat33_fp_t lid_standard_ref = {
{ 0, FLOAT_TO_FP(1), 0},
{FLOAT_TO_FP(-1), 0, 0},
{ 0, 0, FLOAT_TO_FP(-1)}
diff --git a/board/scarlet/board.c b/board/scarlet/board.c
index 4a785e8655..adfee70cd7 100644
--- a/board/scarlet/board.c
+++ b/board/scarlet/board.c
@@ -372,7 +372,7 @@ static struct mutex g_base_mutex;
static struct bmi160_drv_data_t g_bmi160_data;
/* Matrix to rotate accelerometer into standard reference frame */
-const matrix_3x3_t base_standard_ref = {
+const mat33_fp_t base_standard_ref = {
{ FLOAT_TO_FP(-1), 0, 0},
{ 0, FLOAT_TO_FP(-1), 0},
{ 0, 0, FLOAT_TO_FP(1)}
diff --git a/board/strago/board.c b/board/strago/board.c
index 05bd7fda17..7b7304e374 100644
--- a/board/strago/board.c
+++ b/board/strago/board.c
@@ -183,13 +183,13 @@ static struct mutex g_kxcj9_mutex[2];
struct kionix_accel_data g_kxcj9_data[2];
/* Matrix to rotate accelrator into standard reference frame */
-const matrix_3x3_t base_standard_ref = {
+const mat33_fp_t base_standard_ref = {
{ 0, FLOAT_TO_FP(1), 0},
{FLOAT_TO_FP(-1), 0, 0},
{ 0, 0, FLOAT_TO_FP(1)}
};
-const matrix_3x3_t lid_standard_ref = {
+const mat33_fp_t lid_standard_ref = {
{FLOAT_TO_FP(-1), 0, 0},
{ 0, FLOAT_TO_FP(-1), 0},
{ 0, 0, FLOAT_TO_FP(-1)}
diff --git a/board/yorp/board.c b/board/yorp/board.c
index 920bcf661b..5cbce8d72f 100644
--- a/board/yorp/board.c
+++ b/board/yorp/board.c
@@ -98,7 +98,7 @@ static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
/* Matrix to rotate accelrator into standard reference frame */
-const matrix_3x3_t base_standard_ref = {
+const mat33_fp_t base_standard_ref = {
{ 0, FLOAT_TO_FP(-1), 0},
{ FLOAT_TO_FP(1), 0, 0},
{ 0, 0, FLOAT_TO_FP(1)}
diff --git a/common/math_util.c b/common/math_util.c
index 4cdddb1eab..d0b5887199 100644
--- a/common/math_util.c
+++ b/common/math_util.c
@@ -176,7 +176,7 @@ fp_t cosine_of_angle_diff(const intv3_t v1, const intv3_t v2)
* rotate a vector v
* - support input v and output res are the same vector
*/
-void rotate(const intv3_t v, const matrix_3x3_t R, intv3_t res)
+void rotate(const intv3_t v, const mat33_fp_t R, intv3_t res)
{
fp_inter_t t[3];
@@ -204,7 +204,7 @@ void rotate(const intv3_t v, const matrix_3x3_t R, intv3_t res)
res[2] = FP_TO_INT(t[2]);
}
-void rotate_inv(const intv3_t v, const matrix_3x3_t R, intv3_t res)
+void rotate_inv(const intv3_t v, const mat33_fp_t R, intv3_t res)
{
fp_inter_t t[3];
fp_t deter;
diff --git a/include/math_util.h b/include/math_util.h
index d94084f30d..1bcff13525 100644
--- a/include/math_util.h
+++ b/include/math_util.h
@@ -96,7 +96,7 @@ static inline fp_t fp_abs(fp_t a)
* Note that constant matrices MUST be initialized using FLOAT_TO_FP()
* or INT_TO_FP() for all non-zero values.
*/
-typedef fp_t matrix_3x3_t[3][3];
+typedef fp_t mat33_fp_t[3][3];
/* Integer vector */
typedef int intv3_t[3];
@@ -141,7 +141,7 @@ fp_t cosine_of_angle_diff(const intv3_t v1, const intv3_t v2);
* @param R Rotation matrix.
* @param res Resultant vector.
*/
-void rotate(const intv3_t v, const matrix_3x3_t R, intv3_t res);
+void rotate(const intv3_t v, const mat33_fp_t R, intv3_t res);
/**
* Rotate vector v by rotation matrix R^-1.
@@ -150,6 +150,6 @@ void rotate(const intv3_t v, const matrix_3x3_t R, intv3_t res);
* @param R Rotation matrix.
* @param res Resultant vector.
*/
-void rotate_inv(const intv3_t v, const matrix_3x3_t R, intv3_t res);
+void rotate_inv(const intv3_t v, const mat33_fp_t R, intv3_t res);
#endif /* __CROS_EC_MATH_UTIL_H */
diff --git a/include/motion_lid.h b/include/motion_lid.h
index 6ce299c0e5..110d614811 100644
--- a/include/motion_lid.h
+++ b/include/motion_lid.h
@@ -17,13 +17,13 @@
*/
struct accel_orientation {
/* Rotation matrix to rotate positive 90 degrees around the hinge. */
- matrix_3x3_t rot_hinge_90;
+ mat33_fp_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;
+ mat33_fp_t rot_hinge_180;
/* Vector pointing along hinge axis. */
intv3_t hinge_axis;
diff --git a/include/motion_sense.h b/include/motion_sense.h
index bbc82a0f71..a63fc7ae79 100644
--- a/include/motion_sense.h
+++ b/include/motion_sense.h
@@ -90,7 +90,7 @@ struct motion_sensor_t {
*/
uint8_t in_spoof_mode;
- const matrix_3x3_t *rot_standard_ref;
+ const mat33_fp_t *rot_standard_ref;
/*
* default_range: set by default by the EC.
diff --git a/test/math_util.c b/test/math_util.c
index 9a449a93a3..8fd32e5a79 100644
--- a/test/math_util.c
+++ b/test/math_util.c
@@ -46,7 +46,7 @@ static int test_acos(void)
}
-const matrix_3x3_t test_matrices[] = {
+const mat33_fp_t test_matrices[] = {
{{ 0, FLOAT_TO_FP(-1), 0},
{FLOAT_TO_FP(-1), 0, 0},
{ 0, 0, FLOAT_TO_FP(1)} },