diff options
author | Yilun Lin <yllin@google.com> | 2018-09-08 00:06:09 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-09-13 06:13:47 -0700 |
commit | c4a842a78c778e7c15cd3f78ae354e4d21a85ae9 (patch) | |
tree | 6668b4fd3911769f0011b5b17512d66923eea5fc /driver | |
parent | e6344f8560bad936573be75f6b2810373c2cdb01 (diff) | |
download | chrome-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 'driver')
-rw-r--r-- | driver/accel_bma2x2.c | 2 | ||||
-rw-r--r-- | driver/accel_kionix.c | 2 | ||||
-rw-r--r-- | driver/accel_lis2dh.c | 2 | ||||
-rw-r--r-- | driver/accelgyro_bmi160.c | 8 | ||||
-rw-r--r-- | driver/accelgyro_lsm6ds0.c | 2 | ||||
-rw-r--r-- | driver/accelgyro_lsm6dsm.c | 2 | ||||
-rw-r--r-- | driver/als_bh1730.c | 2 | ||||
-rw-r--r-- | driver/als_opt3001.c | 2 | ||||
-rw-r--r-- | driver/als_si114x.c | 2 | ||||
-rw-r--r-- | driver/baro_bmp280.c | 2 | ||||
-rw-r--r-- | driver/gyro_l3gd20h.c | 2 | ||||
-rw-r--r-- | driver/mag_bmm150.c | 16 | ||||
-rw-r--r-- | driver/mag_bmm150.h | 6 | ||||
-rw-r--r-- | driver/stm_mems_common.c | 2 | ||||
-rw-r--r-- | driver/stm_mems_common.h | 2 | ||||
-rw-r--r-- | driver/sync.c | 2 |
16 files changed, 28 insertions, 28 deletions
diff --git a/driver/accel_bma2x2.c b/driver/accel_bma2x2.c index 48e38fc14d..c1e9eb4d63 100644 --- a/driver/accel_bma2x2.c +++ b/driver/accel_bma2x2.c @@ -153,7 +153,7 @@ static int get_offset(const struct motion_sensor_t *s, int16_t *offset, return EC_SUCCESS; } -static int read(const struct motion_sensor_t *s, vector_3_t v) +static int read(const struct motion_sensor_t *s, intv3_t v) { uint8_t acc[6]; int ret, i; diff --git a/driver/accel_kionix.c b/driver/accel_kionix.c index 8e6984ad79..d486d4bcd5 100644 --- a/driver/accel_kionix.c +++ b/driver/accel_kionix.c @@ -449,7 +449,7 @@ static int check_orientation_locked(const struct motion_sensor_t *s) } #endif -static int read(const struct motion_sensor_t *s, vector_3_t v) +static int read(const struct motion_sensor_t *s, intv3_t v) { uint8_t acc[6]; uint8_t reg; diff --git a/driver/accel_lis2dh.c b/driver/accel_lis2dh.c index df0b7be7de..5f9b1b86b5 100644 --- a/driver/accel_lis2dh.c +++ b/driver/accel_lis2dh.c @@ -130,7 +130,7 @@ static int is_data_ready(const struct motion_sensor_t *s, int *ready) return EC_SUCCESS; } -static int read(const struct motion_sensor_t *s, vector_3_t v) +static int read(const struct motion_sensor_t *s, intv3_t v) { uint8_t raw[OUT_XYZ_SIZE]; int ret, tmp = 0; diff --git a/driver/accelgyro_bmi160.c b/driver/accelgyro_bmi160.c index 084304af54..8966d57261 100644 --- a/driver/accelgyro_bmi160.c +++ b/driver/accelgyro_bmi160.c @@ -475,7 +475,7 @@ static int get_offset(const struct motion_sensor_t *s, int16_t *temp) { int i, val, val98; - vector_3_t v; + intv3_t v; switch (s->type) { case MOTIONSENSE_TYPE_ACCEL: @@ -535,7 +535,7 @@ static int set_offset(const struct motion_sensor_t *s, int16_t temp) { int ret, i, val, val98; - vector_3_t v = { offset[X], offset[Y], offset[Z] }; + intv3_t v = { offset[X], offset[Y], offset[Z] }; rotate_inv(v, *s->rot_standard_ref, v); @@ -647,7 +647,7 @@ end_perform_calib: return ret; } -void normalize(const struct motion_sensor_t *s, vector_3_t v, uint8_t *data) +void normalize(const struct motion_sensor_t *s, intv3_t v, uint8_t *data) { #ifdef CONFIG_MAG_BMI160_BMM150 if (s->type == MOTIONSENSE_TYPE_MAG) @@ -1120,7 +1120,7 @@ static int irq_handler(struct motion_sensor_t *s, uint32_t *event) #endif /* CONFIG_ACCEL_INTERRUPTS */ -static int read(const struct motion_sensor_t *s, vector_3_t v) +static int read(const struct motion_sensor_t *s, intv3_t v) { uint8_t data[6]; int ret, status = 0; diff --git a/driver/accelgyro_lsm6ds0.c b/driver/accelgyro_lsm6ds0.c index 04cb7a7e78..b48e84dc0d 100644 --- a/driver/accelgyro_lsm6ds0.c +++ b/driver/accelgyro_lsm6ds0.c @@ -318,7 +318,7 @@ static int is_data_ready(const struct motion_sensor_t *s, int *ready) return EC_SUCCESS; } -static int read(const struct motion_sensor_t *s, vector_3_t v) +static int read(const struct motion_sensor_t *s, intv3_t v) { uint8_t raw[6]; uint8_t xyz_reg; diff --git a/driver/accelgyro_lsm6dsm.c b/driver/accelgyro_lsm6dsm.c index 45c76e8068..c4afa2a5e6 100644 --- a/driver/accelgyro_lsm6dsm.c +++ b/driver/accelgyro_lsm6dsm.c @@ -491,7 +491,7 @@ static int is_data_ready(const struct motion_sensor_t *s, int *ready) * and collect the FIFO, even if it has one item: we don't have to check if the * sensor is ready (minimize I2C access). */ -static int read(const struct motion_sensor_t *s, vector_3_t v) +static int read(const struct motion_sensor_t *s, intv3_t v) { uint8_t raw[OUT_XYZ_SIZE]; uint8_t xyz_reg; diff --git a/driver/als_bh1730.c b/driver/als_bh1730.c index 57db6fdba7..0f96680471 100644 --- a/driver/als_bh1730.c +++ b/driver/als_bh1730.c @@ -55,7 +55,7 @@ static int bh1730_convert_to_lux(uint32_t data0_1) /** * Read BH1730 light sensor data. */ -static int bh1730_read_lux(const struct motion_sensor_t *s, vector_3_t v) +static int bh1730_read_lux(const struct motion_sensor_t *s, intv3_t v) { struct bh1730_drv_data_t *drv_data = BH1730_GET_DATA(s); int ret; diff --git a/driver/als_opt3001.c b/driver/als_opt3001.c index af6d07b06d..fd5dded45d 100644 --- a/driver/als_opt3001.c +++ b/driver/als_opt3001.c @@ -134,7 +134,7 @@ static int opt3001_i2c_write(const int port, const int addr, const int reg, /** * Read OPT3001 light sensor data. */ -int opt3001_read_lux(const struct motion_sensor_t *s, vector_3_t v) +int opt3001_read_lux(const struct motion_sensor_t *s, intv3_t v) { struct opt3001_drv_data_t *drv_data = OPT3001_GET_DATA(s); int ret; diff --git a/driver/als_si114x.c b/driver/als_si114x.c index 567caa917c..17f178080f 100644 --- a/driver/als_si114x.c +++ b/driver/als_si114x.c @@ -242,7 +242,7 @@ static int irq_handler(struct motion_sensor_t *s, uint32_t *event) } /* Just trigger a measurement */ -static int read(const struct motion_sensor_t *s, vector_3_t v) +static int read(const struct motion_sensor_t *s, intv3_t v) { int ret = 0; uint8_t cmd; diff --git a/driver/baro_bmp280.c b/driver/baro_bmp280.c index e6220c7e35..b622535819 100644 --- a/driver/baro_bmp280.c +++ b/driver/baro_bmp280.c @@ -298,7 +298,7 @@ static int bmp280_init(const struct motion_sensor_t *s) return sensor_init_done(s); } -static int bmp280_read(const struct motion_sensor_t *s, vector_3_t v) +static int bmp280_read(const struct motion_sensor_t *s, intv3_t v) { int ret, pres; struct bmp280_drv_data_t *data = BMP280_GET_DATA(s); diff --git a/driver/gyro_l3gd20h.c b/driver/gyro_l3gd20h.c index 0a70d0b36a..2afe948f27 100644 --- a/driver/gyro_l3gd20h.c +++ b/driver/gyro_l3gd20h.c @@ -310,7 +310,7 @@ static int is_data_ready(const struct motion_sensor_t *s, int *ready) return EC_SUCCESS; } -static int read(const struct motion_sensor_t *s, vector_3_t v) +static int read(const struct motion_sensor_t *s, intv3_t v) { uint8_t raw[6]; uint8_t xyz_reg; diff --git a/driver/mag_bmm150.c b/driver/mag_bmm150.c index 014909b365..cb53641c00 100644 --- a/driver/mag_bmm150.c +++ b/driver/mag_bmm150.c @@ -140,8 +140,8 @@ int bmm150_init(const struct motion_sensor_t *s) } void bmm150_temp_compensate_xy(const struct motion_sensor_t *s, - vector_3_t raw, - vector_3_t comp, + intv3_t raw, + intv3_t comp, int r) { int inter, axis; @@ -179,8 +179,8 @@ void bmm150_temp_compensate_xy(const struct motion_sensor_t *s, } void bmm150_temp_compensate_z(const struct motion_sensor_t *s, - vector_3_t raw, - vector_3_t comp, + intv3_t raw, + intv3_t comp, int r) { int dividend, divisor; @@ -209,11 +209,11 @@ void bmm150_temp_compensate_z(const struct motion_sensor_t *s, } void bmm150_normalize(const struct motion_sensor_t *s, - vector_3_t v, + intv3_t v, uint8_t *data) { uint16_t r; - vector_3_t raw; + intv3_t raw; struct mag_cal_t *cal = BMM150_CAL(s); /* X and Y are two's complement 13 bits vectors */ @@ -235,7 +235,7 @@ void bmm150_normalize(const struct motion_sensor_t *s, } int bmm150_set_offset(const struct motion_sensor_t *s, - const vector_3_t offset) + const intv3_t offset) { struct mag_cal_t *cal = BMM150_CAL(s); cal->bias[X] = offset[X]; @@ -245,7 +245,7 @@ int bmm150_set_offset(const struct motion_sensor_t *s, } int bmm150_get_offset(const struct motion_sensor_t *s, - vector_3_t offset) + intv3_t offset) { struct mag_cal_t *cal = BMM150_CAL(s); offset[X] = cal->bias[X]; diff --git a/driver/mag_bmm150.h b/driver/mag_bmm150.h index d3c07db11b..8824872977 100644 --- a/driver/mag_bmm150.h +++ b/driver/mag_bmm150.h @@ -118,13 +118,13 @@ int bmm150_init(const struct motion_sensor_t *s); /* Command to normalize and apply temperature compensation */ void bmm150_normalize(const struct motion_sensor_t *s, - vector_3_t v, + intv3_t v, uint8_t *data); int bmm150_set_offset(const struct motion_sensor_t *s, - const vector_3_t offset); + const intv3_t offset); int bmm150_get_offset(const struct motion_sensor_t *s, - vector_3_t offset); + intv3_t offset); #endif /* __CROS_EC_MAG_BMM150_H */ diff --git a/driver/stm_mems_common.c b/driver/stm_mems_common.c index c22f0d42e5..00784fc1fc 100644 --- a/driver/stm_mems_common.c +++ b/driver/stm_mems_common.c @@ -117,7 +117,7 @@ int st_get_data_rate(const struct motion_sensor_t *s) * @v: output vector * @data: LSB raw data */ -void st_normalize(const struct motion_sensor_t *s, vector_3_t v, uint8_t *data) +void st_normalize(const struct motion_sensor_t *s, intv3_t v, uint8_t *data) { int i, range; struct stprivate_data *drvdata = s->drv_data; diff --git a/driver/stm_mems_common.h b/driver/stm_mems_common.h index 147b9f3e82..e2211480aa 100644 --- a/driver/stm_mems_common.h +++ b/driver/stm_mems_common.h @@ -109,7 +109,7 @@ int st_get_data_rate(const struct motion_sensor_t *s); * @v: vector * @data: LSB raw data */ -void st_normalize(const struct motion_sensor_t *s, vector_3_t v, uint8_t *data); +void st_normalize(const struct motion_sensor_t *s, intv3_t v, uint8_t *data); /* Internal data structure for sensors */ struct stprivate_data { diff --git a/driver/sync.c b/driver/sync.c index 0993aff402..6f994eabb2 100644 --- a/driver/sync.c +++ b/driver/sync.c @@ -40,7 +40,7 @@ struct ec_response_motion_sensor_data vector = {.flags = MOTIONSENSE_SENSOR_FLAG_WAKEUP, .data = {0, 0, 0} }; int sync_enabled; -static int sync_read(const struct motion_sensor_t *s, vector_3_t v) +static int sync_read(const struct motion_sensor_t *s, intv3_t v) { v[0] = next_event.counter; return EC_SUCCESS; |