mirror of
https://github.com/apache/nuttx.git
synced 2026-05-20 04:16:35 +08:00
drivers/sensors: Remove the uncalibrated member of the sensor
lowerhalf layer. The uncalibrated type is passed in with type. The driver defaults to the calibrated type. Signed-off-by: likun17 <likun17@xiaomi.com>
This commit is contained in:
@@ -465,7 +465,7 @@ static int bmi160_accel_activate(FAR struct sensor_lowerhalf_s *lower,
|
||||
static void bmi160_accel_worker(FAR void *arg)
|
||||
{
|
||||
FAR struct bmi160_dev_uorb_s *priv = arg;
|
||||
struct sensor_accel accel;
|
||||
struct sensor_accel_uncal accel;
|
||||
struct accel_t p;
|
||||
uint32_t time;
|
||||
|
||||
@@ -512,7 +512,7 @@ static void bmi160_accel_worker(FAR void *arg)
|
||||
static void bmi160_gyro_worker(FAR void *arg)
|
||||
{
|
||||
FAR struct bmi160_dev_uorb_s *priv = arg;
|
||||
struct sensor_gyro gyro;
|
||||
struct sensor_gyro_uncal gyro;
|
||||
struct gyro_t p;
|
||||
uint32_t time;
|
||||
|
||||
|
||||
@@ -608,7 +608,7 @@ static void goldfish_sensor_parse_event(FAR struct goldfish_sensor_s *sensor)
|
||||
else if ((value = goldfish_sensor_match(
|
||||
buf, "magnetic-uncalibrated:")) != NULL)
|
||||
{
|
||||
struct sensor_mag mag;
|
||||
struct sensor_mag_uncal mag;
|
||||
if (sscanf(value, "%f:%f:%f",
|
||||
&mag.x, &mag.y, &mag.z) == 3)
|
||||
{
|
||||
@@ -616,13 +616,13 @@ static void goldfish_sensor_parse_event(FAR struct goldfish_sensor_s *sensor)
|
||||
mag.timestamp = now_ns + sensor->time_bias_ns;
|
||||
sensor->lower_mag_uncalibrated.lower.push_event(
|
||||
sensor->lower_mag_uncalibrated.lower.priv,
|
||||
&mag, sizeof(struct sensor_mag));
|
||||
&mag, sizeof(struct sensor_mag_uncal));
|
||||
}
|
||||
}
|
||||
else if ((value = goldfish_sensor_match(
|
||||
buf, "gyroscope-uncalibrated:")) != NULL)
|
||||
{
|
||||
struct sensor_gyro gyro;
|
||||
struct sensor_gyro_uncal gyro;
|
||||
if (sscanf(value, "%f:%f:%f",
|
||||
&gyro.x, &gyro.y, &gyro.z) == 3)
|
||||
{
|
||||
@@ -630,7 +630,7 @@ static void goldfish_sensor_parse_event(FAR struct goldfish_sensor_s *sensor)
|
||||
gyro.timestamp = now_ns + sensor->time_bias_ns;
|
||||
sensor->lower_gyro_uncalibrated.lower.push_event(
|
||||
sensor->lower_gyro_uncalibrated.lower.priv,
|
||||
&gyro, sizeof(struct sensor_gyro));
|
||||
&gyro, sizeof(struct sensor_gyro_uncal));
|
||||
}
|
||||
}
|
||||
else if ((value = goldfish_sensor_match(buf, "hinge-angle0")) != NULL)
|
||||
@@ -691,7 +691,7 @@ static void goldfish_sensor_parse_event(FAR struct goldfish_sensor_s *sensor)
|
||||
else if ((value = goldfish_sensor_match(
|
||||
buf, "acceleration-uncalibrated:")) != NULL)
|
||||
{
|
||||
struct sensor_accel accel;
|
||||
struct sensor_accel_uncal accel;
|
||||
if (sscanf(value, "%f:%f:%f",
|
||||
&accel.x, &accel.y, &accel.z) == 3)
|
||||
{
|
||||
@@ -699,7 +699,7 @@ static void goldfish_sensor_parse_event(FAR struct goldfish_sensor_s *sensor)
|
||||
accel.timestamp = now_ns + sensor->time_bias_ns;
|
||||
sensor->lower_accel_uncalibrated.lower.push_event(
|
||||
sensor->lower_accel_uncalibrated.lower.priv,
|
||||
&accel, sizeof(struct sensor_accel));
|
||||
&accel, sizeof(struct sensor_accel_uncal));
|
||||
}
|
||||
}
|
||||
else if ((value = goldfish_sensor_match(buf, "guest-sync:")) != NULL)
|
||||
|
||||
@@ -80,7 +80,7 @@ static void l3gd20_write_register(FAR struct l3gd20_dev_s *dev,
|
||||
uint8_t const reg_data);
|
||||
static void l3gd20_reset(FAR struct l3gd20_dev_s *dev);
|
||||
static void l3gd20_read_measurement_data(FAR struct l3gd20_dev_s *dev,
|
||||
FAR struct sensor_gyro *data);
|
||||
FAR struct sensor_gyro_uncal *data);
|
||||
static void l3gd20_read_gyroscope_data(FAR struct l3gd20_dev_s *dev,
|
||||
uint16_t *x_gyr, uint16_t *y_gyr,
|
||||
uint16_t *z_gyr);
|
||||
@@ -216,7 +216,7 @@ static void l3gd20_reset(FAR struct l3gd20_dev_s *dev)
|
||||
****************************************************************************/
|
||||
|
||||
static void l3gd20_read_measurement_data(FAR struct l3gd20_dev_s *dev,
|
||||
FAR struct sensor_gyro *data)
|
||||
FAR struct sensor_gyro_uncal *data)
|
||||
{
|
||||
uint16_t x_gyr = 0;
|
||||
uint16_t y_gyr = 0;
|
||||
@@ -380,7 +380,7 @@ static int l3gd20_interrupt_handler(int irq, FAR void *context,
|
||||
|
||||
static void l3gd20_worker(FAR void *arg)
|
||||
{
|
||||
struct sensor_gyro temp;
|
||||
struct sensor_gyro_uncal temp;
|
||||
|
||||
FAR struct l3gd20_dev_s *priv = (FAR struct l3gd20_dev_s *)(arg);
|
||||
DEBUGASSERT(priv != NULL);
|
||||
@@ -392,7 +392,7 @@ static void l3gd20_worker(FAR void *arg)
|
||||
/* push data to upper half driver */
|
||||
|
||||
priv->lower.push_event(priv->lower.priv, &temp,
|
||||
sizeof(struct sensor_gyro));
|
||||
sizeof(struct sensor_gyro_uncal));
|
||||
}
|
||||
|
||||
#else
|
||||
@@ -409,16 +409,16 @@ static int l3gd20_fetch(FAR struct sensor_lowerhalf_s *lower,
|
||||
FAR struct l3gd20_dev_s,
|
||||
lower);
|
||||
|
||||
if (buflen != sizeof(struct sensor_gyro))
|
||||
if (buflen != sizeof(struct sensor_gyro_uncal))
|
||||
return 0;
|
||||
|
||||
DEBUGASSERT(priv != NULL);
|
||||
|
||||
/* Read out the latest sensor data */
|
||||
|
||||
l3gd20_read_measurement_data(priv, (FAR struct sensor_gyro *)buffer);
|
||||
l3gd20_read_measurement_data(priv, (FAR struct sensor_gyro_uncal *)buffer);
|
||||
|
||||
return sizeof(struct sensor_gyro);
|
||||
return sizeof(struct sensor_gyro_uncal);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -432,7 +432,7 @@ static int l3gd20_activate(FAR struct sensor_lowerhalf_s *lower,
|
||||
FAR struct l3gd20_dev_s *priv = container_of(lower,
|
||||
FAR struct l3gd20_dev_s,
|
||||
lower);
|
||||
struct sensor_gyro temp;
|
||||
struct sensor_gyro_uncal temp;
|
||||
|
||||
#ifdef CONFIG_DEBUG_SENSORS_INFO
|
||||
uint8_t reg_content;
|
||||
|
||||
@@ -174,9 +174,9 @@ static const struct sensor_meta_s g_sensor_meta[] =
|
||||
{sizeof(struct sensor_rotation), "rotation"},
|
||||
{sizeof(struct sensor_humi), "humi"},
|
||||
{sizeof(struct sensor_temp), "ambient_temp"},
|
||||
{sizeof(struct sensor_mag), "mag_uncal"},
|
||||
{sizeof(struct sensor_mag_uncal), "mag_uncal"},
|
||||
{sizeof(struct sensor_pm1p0), "pm1p0"},
|
||||
{sizeof(struct sensor_gyro), "gyro_uncal"},
|
||||
{sizeof(struct sensor_gyro_uncal), "gyro_uncal"},
|
||||
{sizeof(struct sensor_event), "motion_detect"},
|
||||
{sizeof(struct sensor_event), "step_detector"},
|
||||
{sizeof(struct sensor_step_counter), "step_counter"},
|
||||
@@ -195,7 +195,7 @@ static const struct sensor_meta_s g_sensor_meta[] =
|
||||
{sizeof(struct sensor_force), "force"},
|
||||
{sizeof(struct sensor_hall), "hall"},
|
||||
{sizeof(struct sensor_event), "offbody_detector"},
|
||||
{sizeof(struct sensor_accel), "accel_uncal"},
|
||||
{sizeof(struct sensor_accel_uncal), "accel_uncal"},
|
||||
{sizeof(struct sensor_angle), "hinge_angle"},
|
||||
{sizeof(struct sensor_ir), "ir"},
|
||||
{sizeof(struct sensor_hcho), "hcho"},
|
||||
|
||||
Reference in New Issue
Block a user