mirror of
https://github.com/apache/nuttx.git
synced 2026-06-02 17:48:54 +08:00
drivers/sensor: add new sensot type to align android sensor type
new sensor type: SENSOR_TEMPERATURE SENSOR_TYPE_ACCELEROMETER_UNCALIBRATED SENSOR_TYPE_GYROSCOPE_UNCALIBRATED SENSOR_TYPE_MAGNETIC_FILED_UNCALIBRATED refs: https://cs.android.com/android/_/android/platform/hardware/libhardware/+/ 0e67aa0caee9500b61b9c1c8b6e5cab18301364c:include_all/hardware/sensors-base.h Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
This commit is contained in:
@@ -735,8 +735,7 @@ static int bmi088_register_accel(int devno,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
priv->lower.ops = &g_bmi088_accel_ops;
|
priv->lower.ops = &g_bmi088_accel_ops;
|
||||||
priv->lower.type = SENSOR_TYPE_ACCELEROMETER;
|
priv->lower.type = SENSOR_TYPE_ACCELEROMETER_UNCALIBRATED;
|
||||||
priv->lower.uncalibrated = true;
|
|
||||||
priv->interval = BMI088_DEFAULT_INTERVAL;
|
priv->interval = BMI088_DEFAULT_INTERVAL;
|
||||||
priv->lower.nbuffer = 1;
|
priv->lower.nbuffer = 1;
|
||||||
|
|
||||||
@@ -818,8 +817,7 @@ static int bmi088_register_gyro(int devno,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
priv->lower.ops = &g_bmi088_gyro_ops;
|
priv->lower.ops = &g_bmi088_gyro_ops;
|
||||||
priv->lower.type = SENSOR_TYPE_GYROSCOPE;
|
priv->lower.type = SENSOR_TYPE_GYROSCOPE_UNCALIBRATED;
|
||||||
priv->lower.uncalibrated = true;
|
|
||||||
priv->interval = BMI088_DEFAULT_INTERVAL;
|
priv->interval = BMI088_DEFAULT_INTERVAL;
|
||||||
priv->lower.nbuffer = 1;
|
priv->lower.nbuffer = 1;
|
||||||
|
|
||||||
|
|||||||
@@ -602,8 +602,7 @@ static int bmi160_register_accel(int devno,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
priv->lower.ops = &g_bmi160_accel_ops;
|
priv->lower.ops = &g_bmi160_accel_ops;
|
||||||
priv->lower.type = SENSOR_TYPE_ACCELEROMETER;
|
priv->lower.type = SENSOR_TYPE_ACCELEROMETER_UNCALIBRATED;
|
||||||
priv->lower.uncalibrated = true;
|
|
||||||
priv->interval = BMI160_DEFAULT_INTERVAL;
|
priv->interval = BMI160_DEFAULT_INTERVAL;
|
||||||
priv->lower.nbuffer = 1;
|
priv->lower.nbuffer = 1;
|
||||||
|
|
||||||
@@ -687,8 +686,7 @@ static int bmi160_register_gyro(int devno,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
priv->lower.ops = &g_bmi160_gyro_ops;
|
priv->lower.ops = &g_bmi160_gyro_ops;
|
||||||
priv->lower.type = SENSOR_TYPE_GYROSCOPE;
|
priv->lower.type = SENSOR_TYPE_GYROSCOPE_UNCALIBRATED;
|
||||||
priv->lower.uncalibrated = true;
|
|
||||||
priv->interval = BMI160_DEFAULT_INTERVAL;
|
priv->interval = BMI160_DEFAULT_INTERVAL;
|
||||||
priv->lower.nbuffer = 1;
|
priv->lower.nbuffer = 1;
|
||||||
|
|
||||||
|
|||||||
@@ -973,7 +973,6 @@ int ds18b20_register(int devno, FAR struct onewire_master_s *onewire,
|
|||||||
#endif
|
#endif
|
||||||
tmp->lower.ops = &g_ds18b20_ops;
|
tmp->lower.ops = &g_ds18b20_ops;
|
||||||
tmp->lower.type = SENSOR_TYPE_AMBIENT_TEMPERATURE;
|
tmp->lower.type = SENSOR_TYPE_AMBIENT_TEMPERATURE;
|
||||||
tmp->lower.uncalibrated = false;
|
|
||||||
tmp->lower.nbuffer = 1;
|
tmp->lower.nbuffer = 1;
|
||||||
ret = sensor_register(&tmp->lower, devno);
|
ret = sensor_register(&tmp->lower, devno);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
|
|||||||
@@ -52,7 +52,7 @@
|
|||||||
#define GOLDFISH_PRESSURE 7
|
#define GOLDFISH_PRESSURE 7
|
||||||
#define GOLDFISH_RELATIVE_HUMIDITY 8
|
#define GOLDFISH_RELATIVE_HUMIDITY 8
|
||||||
#define GOLDFISH_MAGNETIC_FIELD_UNCALIBRATED 9
|
#define GOLDFISH_MAGNETIC_FIELD_UNCALIBRATED 9
|
||||||
#define GOLDFISH_GYROSCOPE_FIELD_UNCALIBRATED 10
|
#define GOLDFISH_GYROSCOPE_UNCALIBRATED 10
|
||||||
#define GOLDFISH_HINGE_ANGLE0 11
|
#define GOLDFISH_HINGE_ANGLE0 11
|
||||||
#define GOLDFISH_HINGE_ANGLE1 12
|
#define GOLDFISH_HINGE_ANGLE1 12
|
||||||
#define GOLDFISH_HINGE_ANGLE2 13
|
#define GOLDFISH_HINGE_ANGLE2 13
|
||||||
@@ -620,45 +620,27 @@ static int goldfish_get_priv(FAR struct sensor_lowerhalf_s *lower,
|
|||||||
{
|
{
|
||||||
switch (lower->type)
|
switch (lower->type)
|
||||||
{
|
{
|
||||||
|
case SENSOR_TYPE_ACCELEROMETER_UNCALIBRATED:
|
||||||
|
priv = container_of(lower, struct goldfish_sensor_s,
|
||||||
|
lower_accel_uncalibrated);
|
||||||
|
return GOLDFISH_ACCELERATION_UNCALIBRATED;
|
||||||
case SENSOR_TYPE_ACCELEROMETER:
|
case SENSOR_TYPE_ACCELEROMETER:
|
||||||
if (lower->uncalibrated)
|
priv = container_of(lower, struct goldfish_sensor_s, lower_accel);
|
||||||
{
|
return GOLDFISH_ACCELERATION;
|
||||||
*priv = container_of(lower, struct goldfish_sensor_s,
|
case SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED:
|
||||||
lower_accel_uncalibrated);
|
priv = container_of(lower, struct goldfish_sensor_s,
|
||||||
return GOLDFISH_ACCELERATION_UNCALIBRATED;
|
lower_mag_uncalibrated);
|
||||||
}
|
return GOLDFISH_MAGNETIC_FIELD_UNCALIBRATED;
|
||||||
else
|
|
||||||
{
|
|
||||||
*priv = container_of(lower, struct goldfish_sensor_s, lower_accel);
|
|
||||||
return GOLDFISH_ACCELERATION;
|
|
||||||
}
|
|
||||||
|
|
||||||
case SENSOR_TYPE_MAGNETIC_FIELD:
|
case SENSOR_TYPE_MAGNETIC_FIELD:
|
||||||
if (lower->uncalibrated)
|
priv = container_of(lower, struct goldfish_sensor_s, lower_mag);
|
||||||
{
|
return GOLDFISH_MAGNETIC_FIELD;
|
||||||
*priv = container_of(lower, struct goldfish_sensor_s,
|
case SENSOR_TYPE_GYROSCOPE_UNCALIBRATED:
|
||||||
lower_mag_uncalibrated);
|
priv = container_of(lower, struct goldfish_sensor_s,
|
||||||
return GOLDFISH_MAGNETIC_FIELD_UNCALIBRATED;
|
lower_gyro_uncalibrated);
|
||||||
}
|
return GOLDFISH_GYROSCOPE_UNCALIBRATED;
|
||||||
else
|
|
||||||
{
|
|
||||||
*priv = container_of(lower, struct goldfish_sensor_s, lower_mag);
|
|
||||||
return GOLDFISH_MAGNETIC_FIELD;
|
|
||||||
}
|
|
||||||
|
|
||||||
case SENSOR_TYPE_GYROSCOPE:
|
case SENSOR_TYPE_GYROSCOPE:
|
||||||
if (lower->uncalibrated)
|
priv = container_of(lower, struct goldfish_sensor_s, lower_gyro);
|
||||||
{
|
return GOLDFISH_GYROSCOPE;
|
||||||
*priv = container_of(lower, struct goldfish_sensor_s,
|
|
||||||
lower_gyro_uncalibrated);
|
|
||||||
return GOLDFISH_GYROSCOPE_FIELD_UNCALIBRATED;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
*priv = container_of(lower, struct goldfish_sensor_s, lower_gyro);
|
|
||||||
return GOLDFISH_GYROSCOPE;
|
|
||||||
}
|
|
||||||
|
|
||||||
case SENSOR_TYPE_PROXIMITY:
|
case SENSOR_TYPE_PROXIMITY:
|
||||||
*priv = container_of(lower, struct goldfish_sensor_s, lower_prox);
|
*priv = container_of(lower, struct goldfish_sensor_s, lower_prox);
|
||||||
return GOLDFISH_PROXIMITY;
|
return GOLDFISH_PROXIMITY;
|
||||||
@@ -868,20 +850,20 @@ int goldfish_sensor_init(int devno, uint32_t batch_number)
|
|||||||
sensor->lower_gyro.ops = &g_goldfish_sensor_ops;
|
sensor->lower_gyro.ops = &g_goldfish_sensor_ops;
|
||||||
sensor->lower_gyro.nbuffer = batch_number;
|
sensor->lower_gyro.nbuffer = batch_number;
|
||||||
|
|
||||||
sensor->lower_accel_uncalibrated.type = SENSOR_TYPE_ACCELEROMETER;
|
sensor->lower_accel_uncalibrated.type =
|
||||||
|
SENSOR_TYPE_ACCELEROMETER_UNCALIBRATED;
|
||||||
sensor->lower_accel_uncalibrated.ops = &g_goldfish_sensor_ops;
|
sensor->lower_accel_uncalibrated.ops = &g_goldfish_sensor_ops;
|
||||||
sensor->lower_accel_uncalibrated.nbuffer = batch_number;
|
sensor->lower_accel_uncalibrated.nbuffer = batch_number;
|
||||||
sensor->lower_accel_uncalibrated.uncalibrated = true;
|
|
||||||
|
|
||||||
sensor->lower_mag_uncalibrated.type = SENSOR_TYPE_MAGNETIC_FIELD;
|
sensor->lower_mag_uncalibrated.type =
|
||||||
|
SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED;
|
||||||
sensor->lower_mag_uncalibrated.ops = &g_goldfish_sensor_ops;
|
sensor->lower_mag_uncalibrated.ops = &g_goldfish_sensor_ops;
|
||||||
sensor->lower_mag_uncalibrated.nbuffer = batch_number;
|
sensor->lower_mag_uncalibrated.nbuffer = batch_number;
|
||||||
sensor->lower_mag_uncalibrated.uncalibrated = true;
|
|
||||||
|
|
||||||
sensor->lower_gyro_uncalibrated.type = SENSOR_TYPE_GYROSCOPE;
|
sensor->lower_gyro_uncalibrated.type =
|
||||||
|
SENSOR_TYPE_GYROSCOPE_UNCALIBRATED;
|
||||||
sensor->lower_gyro_uncalibrated.ops = &g_goldfish_sensor_ops;
|
sensor->lower_gyro_uncalibrated.ops = &g_goldfish_sensor_ops;
|
||||||
sensor->lower_gyro_uncalibrated.nbuffer = batch_number;
|
sensor->lower_gyro_uncalibrated.nbuffer = batch_number;
|
||||||
sensor->lower_gyro_uncalibrated.uncalibrated = true;
|
|
||||||
|
|
||||||
sensor->lower_prox.type = SENSOR_TYPE_PROXIMITY;
|
sensor->lower_prox.type = SENSOR_TYPE_PROXIMITY;
|
||||||
sensor->lower_prox.ops = &g_goldfish_sensor_ops;
|
sensor->lower_prox.ops = &g_goldfish_sensor_ops;
|
||||||
|
|||||||
@@ -942,7 +942,6 @@ int hyt271_register(int devno, FAR struct i2c_master_s *i2c, uint8_t addr,
|
|||||||
tmp->buffer_size = sizeof(struct sensor_humi);
|
tmp->buffer_size = sizeof(struct sensor_humi);
|
||||||
tmp->lower.ops = &g_hyt271_ops;
|
tmp->lower.ops = &g_hyt271_ops;
|
||||||
tmp->lower.type = SENSOR_TYPE_RELATIVE_HUMIDITY;
|
tmp->lower.type = SENSOR_TYPE_RELATIVE_HUMIDITY;
|
||||||
tmp->lower.uncalibrated = false;
|
|
||||||
tmp->lower.nbuffer = 1;
|
tmp->lower.nbuffer = 1;
|
||||||
ret = sensor_register(&tmp->lower, devno);
|
ret = sensor_register(&tmp->lower, devno);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
@@ -960,7 +959,6 @@ int hyt271_register(int devno, FAR struct i2c_master_s *i2c, uint8_t addr,
|
|||||||
tmp->buffer_size = sizeof(struct sensor_temp);
|
tmp->buffer_size = sizeof(struct sensor_temp);
|
||||||
tmp->lower.ops = &g_hyt271_ops;
|
tmp->lower.ops = &g_hyt271_ops;
|
||||||
tmp->lower.type = SENSOR_TYPE_AMBIENT_TEMPERATURE;
|
tmp->lower.type = SENSOR_TYPE_AMBIENT_TEMPERATURE;
|
||||||
tmp->lower.uncalibrated = false;
|
|
||||||
tmp->lower.nbuffer = 1;
|
tmp->lower.nbuffer = 1;
|
||||||
ret = sensor_register(&tmp->lower, devno);
|
ret = sensor_register(&tmp->lower, devno);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
|
|||||||
@@ -562,10 +562,9 @@ int l3gd20_register(int devno, FAR struct spi_dev_s *spi,
|
|||||||
#endif
|
#endif
|
||||||
priv->timestamp = 0;
|
priv->timestamp = 0;
|
||||||
|
|
||||||
priv->lower.type = SENSOR_TYPE_GYROSCOPE;
|
priv->lower.type = SENSOR_TYPE_GYROSCOPE_UNCALIBRATED;
|
||||||
priv->lower.nbuffer = CONFIG_SENSORS_L3GD20_BUFFER_SIZE;
|
priv->lower.nbuffer = CONFIG_SENSORS_L3GD20_BUFFER_SIZE;
|
||||||
priv->lower.ops = &g_l2gd20_ops;
|
priv->lower.ops = &g_l2gd20_ops;
|
||||||
priv->lower.uncalibrated = true;
|
|
||||||
|
|
||||||
/* Setup SPI frequency and mode */
|
/* Setup SPI frequency and mode */
|
||||||
|
|
||||||
|
|||||||
@@ -50,8 +50,7 @@
|
|||||||
/* Device naming ************************************************************/
|
/* Device naming ************************************************************/
|
||||||
|
|
||||||
#define ROUND_DOWN(x, y) (((x) / (y)) * (y))
|
#define ROUND_DOWN(x, y) (((x) / (y)) * (y))
|
||||||
#define DEVNAME_FMT "/dev/uorb/sensor_%s%s%d"
|
#define DEVNAME_FMT "/dev/uorb/sensor_%s%d"
|
||||||
#define DEVNAME_UNCAL "_uncal"
|
|
||||||
#define TIMING_BUF_ESIZE (sizeof(uint32_t))
|
#define TIMING_BUF_ESIZE (sizeof(uint32_t))
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -168,16 +167,16 @@ static const struct sensor_meta_s g_sensor_meta[] =
|
|||||||
{sizeof(struct sensor_gyro), "gyro"},
|
{sizeof(struct sensor_gyro), "gyro"},
|
||||||
{sizeof(struct sensor_light), "light"},
|
{sizeof(struct sensor_light), "light"},
|
||||||
{sizeof(struct sensor_baro), "baro"},
|
{sizeof(struct sensor_baro), "baro"},
|
||||||
{sizeof(struct sensor_noise), "noise"},
|
{sizeof(struct sensor_temp), "temp"},
|
||||||
{sizeof(struct sensor_prox), "prox"},
|
{sizeof(struct sensor_prox), "prox"},
|
||||||
{sizeof(struct sensor_rgb), "rgb"},
|
{sizeof(struct sensor_rgb), "rgb"},
|
||||||
{sizeof(struct sensor_accel), "linear_accel"},
|
{sizeof(struct sensor_accel), "linear_accel"},
|
||||||
{sizeof(struct sensor_rotation), "rotation"},
|
{sizeof(struct sensor_rotation), "rotation"},
|
||||||
{sizeof(struct sensor_humi), "humi"},
|
{sizeof(struct sensor_humi), "humi"},
|
||||||
{sizeof(struct sensor_temp), "temp"},
|
{sizeof(struct sensor_temp), "ambient_temp"},
|
||||||
{sizeof(struct sensor_pm25), "pm25"},
|
{sizeof(struct sensor_mag), "mag_uncal"},
|
||||||
{sizeof(struct sensor_pm1p0), "pm1p0"},
|
{sizeof(struct sensor_pm1p0), "pm1p0"},
|
||||||
{sizeof(struct sensor_pm10), "pm10"},
|
{sizeof(struct sensor_gyro), "gyro_uncal"},
|
||||||
{sizeof(struct sensor_event), "motion_detect"},
|
{sizeof(struct sensor_event), "motion_detect"},
|
||||||
{sizeof(struct sensor_event), "step_detector"},
|
{sizeof(struct sensor_event), "step_detector"},
|
||||||
{sizeof(struct sensor_step_counter), "step_counter"},
|
{sizeof(struct sensor_step_counter), "step_counter"},
|
||||||
@@ -196,7 +195,7 @@ static const struct sensor_meta_s g_sensor_meta[] =
|
|||||||
{sizeof(struct sensor_force), "force"},
|
{sizeof(struct sensor_force), "force"},
|
||||||
{sizeof(struct sensor_hall), "hall"},
|
{sizeof(struct sensor_hall), "hall"},
|
||||||
{sizeof(struct sensor_event), "offbody_detector"},
|
{sizeof(struct sensor_event), "offbody_detector"},
|
||||||
{sizeof(struct sensor_uv), "uv"},
|
{sizeof(struct sensor_accel), "accel_uncal"},
|
||||||
{sizeof(struct sensor_angle), "hinge_angle"},
|
{sizeof(struct sensor_angle), "hinge_angle"},
|
||||||
{sizeof(struct sensor_ir), "ir"},
|
{sizeof(struct sensor_ir), "ir"},
|
||||||
{sizeof(struct sensor_hcho), "hcho"},
|
{sizeof(struct sensor_hcho), "hcho"},
|
||||||
@@ -215,6 +214,10 @@ static const struct sensor_meta_s g_sensor_meta[] =
|
|||||||
{sizeof(struct sensor_gnss_clock), "gnss_clock"},
|
{sizeof(struct sensor_gnss_clock), "gnss_clock"},
|
||||||
{sizeof(struct sensor_gnss_geofence_event), "gnss_geofence_event"},
|
{sizeof(struct sensor_gnss_geofence_event), "gnss_geofence_event"},
|
||||||
{sizeof(struct sensor_velocity), "velocity"},
|
{sizeof(struct sensor_velocity), "velocity"},
|
||||||
|
{sizeof(struct sensor_noise), "noise"},
|
||||||
|
{sizeof(struct sensor_pm25), "pm25"},
|
||||||
|
{sizeof(struct sensor_pm10), "pm10"},
|
||||||
|
{sizeof(struct sensor_uv), "uv"},
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct file_operations g_sensor_fops =
|
static const struct file_operations g_sensor_fops =
|
||||||
@@ -1255,7 +1258,6 @@ int sensor_register(FAR struct sensor_lowerhalf_s *lower, int devno)
|
|||||||
|
|
||||||
snprintf(path, PATH_MAX, DEVNAME_FMT,
|
snprintf(path, PATH_MAX, DEVNAME_FMT,
|
||||||
g_sensor_meta[lower->type].name,
|
g_sensor_meta[lower->type].name,
|
||||||
lower->uncalibrated ? DEVNAME_UNCAL : "",
|
|
||||||
devno);
|
devno);
|
||||||
ret = sensor_custom_register(lower, path,
|
ret = sensor_custom_register(lower, path,
|
||||||
g_sensor_meta[lower->type].esize);
|
g_sensor_meta[lower->type].esize);
|
||||||
@@ -1403,7 +1405,6 @@ void sensor_unregister(FAR struct sensor_lowerhalf_s *lower, int devno)
|
|||||||
|
|
||||||
snprintf(path, PATH_MAX, DEVNAME_FMT,
|
snprintf(path, PATH_MAX, DEVNAME_FMT,
|
||||||
g_sensor_meta[lower->type].name,
|
g_sensor_meta[lower->type].name,
|
||||||
lower->uncalibrated ? DEVNAME_UNCAL : "",
|
|
||||||
devno);
|
devno);
|
||||||
sensor_custom_unregister(lower, path);
|
sensor_custom_unregister(lower, path);
|
||||||
lib_put_pathbuffer(path);
|
lib_put_pathbuffer(path);
|
||||||
|
|||||||
@@ -875,7 +875,6 @@ int sht4x_register(FAR struct i2c_master_s *i2c, int devno, uint8_t addr)
|
|||||||
|
|
||||||
priv->hum.sensor_lower.ops = &g_sensor_ops;
|
priv->hum.sensor_lower.ops = &g_sensor_ops;
|
||||||
priv->hum.sensor_lower.type = SENSOR_TYPE_RELATIVE_HUMIDITY;
|
priv->hum.sensor_lower.type = SENSOR_TYPE_RELATIVE_HUMIDITY;
|
||||||
priv->hum.sensor_lower.uncalibrated = false;
|
|
||||||
priv->hum.enabled = false;
|
priv->hum.enabled = false;
|
||||||
priv->hum.dev = priv;
|
priv->hum.dev = priv;
|
||||||
|
|
||||||
@@ -895,7 +894,6 @@ int sht4x_register(FAR struct i2c_master_s *i2c, int devno, uint8_t addr)
|
|||||||
|
|
||||||
priv->temp.sensor_lower.ops = &g_sensor_ops;
|
priv->temp.sensor_lower.ops = &g_sensor_ops;
|
||||||
priv->temp.sensor_lower.type = SENSOR_TYPE_AMBIENT_TEMPERATURE;
|
priv->temp.sensor_lower.type = SENSOR_TYPE_AMBIENT_TEMPERATURE;
|
||||||
priv->temp.sensor_lower.uncalibrated = false;
|
|
||||||
priv->temp.enabled = false;
|
priv->temp.enabled = false;
|
||||||
priv->temp.dev = priv;
|
priv->temp.dev = priv;
|
||||||
|
|
||||||
|
|||||||
@@ -532,13 +532,6 @@ struct sensor_lowerhalf_s
|
|||||||
|
|
||||||
uint32_t nbuffer;
|
uint32_t nbuffer;
|
||||||
|
|
||||||
/* The uncalibrated use to describe whether the sensor event is
|
|
||||||
* uncalibrated. True is uncalibrated data, false is calibrated data,
|
|
||||||
* default false.
|
|
||||||
*/
|
|
||||||
|
|
||||||
bool uncalibrated;
|
|
||||||
|
|
||||||
/* The lower half sensor driver operations */
|
/* The lower half sensor driver operations */
|
||||||
|
|
||||||
FAR const struct sensor_ops_s *ops;
|
FAR const struct sensor_ops_s *ops;
|
||||||
|
|||||||
+54
-17
@@ -42,6 +42,14 @@
|
|||||||
|
|
||||||
/* sensor type definition */
|
/* sensor type definition */
|
||||||
|
|
||||||
|
/* Note: Some of the types of these sensors are aligned with Android, and
|
||||||
|
* the refs link is https://cs.android.com/android/_/android/platform/\
|
||||||
|
* hardware/libhardware/+/0e67aa0caee9500b61b9c1c8b6e5cab18301364c:\
|
||||||
|
* include_all/hardware/sensors-base.h.
|
||||||
|
*
|
||||||
|
* If you need to make modifications, please align with Android standards
|
||||||
|
*/
|
||||||
|
|
||||||
/* Custom Sensor
|
/* Custom Sensor
|
||||||
* Some special sensor whose event size is not fixed or dynamically change,
|
* Some special sensor whose event size is not fixed or dynamically change,
|
||||||
* are called sensor of custom type. You should treat its events as byte
|
* are called sensor of custom type. You should treat its events as byte
|
||||||
@@ -99,11 +107,12 @@
|
|||||||
|
|
||||||
#define SENSOR_TYPE_BAROMETER 6
|
#define SENSOR_TYPE_BAROMETER 6
|
||||||
|
|
||||||
/* Noise Loudness
|
/* Temperature
|
||||||
* A sensor of this type returns the loudness of noise in SI units (db)
|
* A sensor of this type returns the measurement temperature in degree
|
||||||
|
* Celsius.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define SENSOR_TYPE_NOISE 7
|
#define SENSOR_TYPE_TEMPERAUTRE 7
|
||||||
|
|
||||||
/* Proximity
|
/* Proximity
|
||||||
* The values correspond to the distance to the nearest
|
* The values correspond to the distance to the nearest
|
||||||
@@ -153,12 +162,12 @@
|
|||||||
|
|
||||||
#define SENSOR_TYPE_AMBIENT_TEMPERATURE 13
|
#define SENSOR_TYPE_AMBIENT_TEMPERATURE 13
|
||||||
|
|
||||||
/* PM25
|
/* Magneric Field Uncalibrated
|
||||||
* A sensor of this type returns the content of pm2.5 in the air
|
* Similar to MAGNETIC_FIELD, all values are in micro-Tesla (uT)
|
||||||
* This value is in SI units (ug/m^3)
|
* and measure the geomagnetic field in X, Y and Z axis.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define SENSOR_TYPE_PM25 14
|
#define SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED 14
|
||||||
|
|
||||||
/* PM1P0
|
/* PM1P0
|
||||||
* A sensor of this type returns the content of pm1.0 in the air
|
* A sensor of this type returns the content of pm1.0 in the air
|
||||||
@@ -167,12 +176,12 @@
|
|||||||
|
|
||||||
#define SENSOR_TYPE_PM1P0 15
|
#define SENSOR_TYPE_PM1P0 15
|
||||||
|
|
||||||
/* PM10
|
/* Gyroscope Uncalibrated
|
||||||
* A sensor of this type returns the content of pm10 in the air
|
* All values are in radians/second and measure the rate of rotation around
|
||||||
* This value is in SI units (ug/m^3)
|
* the X, Y and Z axis.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define SENSOR_TYPE_PM10 16
|
#define SENSOR_TYPE_GYROSCOPE_UNCALIBRATED 16
|
||||||
|
|
||||||
/* Significant motion
|
/* Significant motion
|
||||||
* A significant motion detector triggers when detecting a significant
|
* A significant motion detector triggers when detecting a significant
|
||||||
@@ -335,12 +344,12 @@
|
|||||||
|
|
||||||
#define SENSOR_TYPE_LOW_LATENCY_OFFBODY_DETECT 34
|
#define SENSOR_TYPE_LOW_LATENCY_OFFBODY_DETECT 34
|
||||||
|
|
||||||
/* Ultraviolet light sensor
|
/* Accelerometer Uncalibrate
|
||||||
* This sensor can identify the UV index in ambient light help people
|
* All values are in SI units (m/s^2), and measure the acceleration of the
|
||||||
* to effectively protect themselves from sunburns, cancer or eye damage.
|
* device minus the acceleration dut to gravity.
|
||||||
* This value range is 0 - 15.
|
|
||||||
*/
|
*/
|
||||||
#define SENSOR_TYPE_ULTRAVIOLET 35
|
|
||||||
|
#define SENSOR_TYPE_ACCELEROMETER_UNCALIBRATED 35
|
||||||
|
|
||||||
/* Hinge angle
|
/* Hinge angle
|
||||||
* A hinge angle sensor measures the angle, in degrees, between two integral
|
* A hinge angle sensor measures the angle, in degrees, between two integral
|
||||||
@@ -474,11 +483,39 @@
|
|||||||
|
|
||||||
#define SENSOR_TYPE_VELOCITY 53
|
#define SENSOR_TYPE_VELOCITY 53
|
||||||
|
|
||||||
|
/* Noise Loudness
|
||||||
|
* A sensor of this type returns the loudness of noise in SI units (db)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define SENSOR_TYPE_NOISE 54
|
||||||
|
|
||||||
|
/* PM25
|
||||||
|
* A sensor of this type returns the content of pm2.5 in the air
|
||||||
|
* This value is in SI units (ug/m^3)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define SENSOR_TYPE_PM25 55
|
||||||
|
|
||||||
|
/* PM10
|
||||||
|
* A sensor of this type returns the content of pm10 in the air
|
||||||
|
* This value is in SI units (ug/m^3)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define SENSOR_TYPE_PM10 56
|
||||||
|
|
||||||
|
/* Ultraviolet light sensor
|
||||||
|
* This sensor can identify the UV index in ambient light help people
|
||||||
|
* to effectively protect themselves from sunburns, cancer or eye damage.
|
||||||
|
* This value range is 0 - 15.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define SENSOR_TYPE_ULTRAVIOLET 57
|
||||||
|
|
||||||
/* The total number of sensor
|
/* The total number of sensor
|
||||||
* please increase it if you added a new sensor type!
|
* please increase it if you added a new sensor type!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define SENSOR_TYPE_COUNT 54
|
#define SENSOR_TYPE_COUNT 58
|
||||||
|
|
||||||
/* The additional sensor open flags */
|
/* The additional sensor open flags */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user