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> Reviewed-on: https://chromium-review.googlesource.com/1230991 Reviewed-by: Martin Roth <martinroth@chromium.org> Commit-Queue: Martin Roth <martinroth@chromium.org> Tested-by: Martin Roth <martinroth@chromium.org>
This commit is contained in:
parent
d86563db5c
commit
a38f7585f1
|
@ -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,
|
||||
},
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)}
|
||||
|
|
|
@ -109,7 +109,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)}
|
||||
|
|
|
@ -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)}
|
||||
|
|
|
@ -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)}
|
||||
|
|
|
@ -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)}
|
||||
|
|
|
@ -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)}
|
||||
|
|
|
@ -125,13 +125,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)}
|
||||
|
|
|
@ -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)}
|
||||
|
|
|
@ -132,7 +132,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)}
|
||||
|
|
|
@ -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) }
|
||||
|
|
|
@ -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) }
|
||||
|
|
|
@ -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)}
|
||||
|
|
|
@ -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)}
|
||||
|
|
|
@ -112,7 +112,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)}
|
||||
|
|
|
@ -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)}
|
||||
|
|
|
@ -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)}
|
||||
|
|
|
@ -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) }
|
||||
|
|
|
@ -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)}
|
||||
|
|
|
@ -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)}
|
||||
|
|
|
@ -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)}
|
||||
|
|
|
@ -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)}
|
||||
|
|
|
@ -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)}
|
||||
|
|
|
@ -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)}
|
||||
|
|
|
@ -110,7 +110,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)}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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)} },
|
||||
|
|
Loading…
Reference in New Issue