drivers/sensors: Add Velocity sensor type to UORB

This patch adds support for velocity measurement sensors.
I plan to use it as a generic velocity type to be used for
Renesas FS3000 (Air Velocity Flow).

Signed-off-by: Alan C. Assis <acassis@gmail.com>
This commit is contained in:
Alan Carvalho de Assis 2024-12-19 13:11:52 -03:00 committed by CeDeROM
parent 884b4604c2
commit 0e162eeb7a
2 changed files with 18 additions and 2 deletions

View file

@ -214,6 +214,7 @@ static const struct sensor_meta_s g_sensor_meta[] =
{sizeof(struct sensor_gnss_measurement), "gnss_measurement"}, {sizeof(struct sensor_gnss_measurement), "gnss_measurement"},
{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"},
}; };
static const struct file_operations g_sensor_fops = static const struct file_operations g_sensor_fops =

View file

@ -467,9 +467,18 @@
#define SENSOR_TYPE_GNSS_GEOFENCE 52 #define SENSOR_TYPE_GNSS_GEOFENCE 52
/* The total number of sensor */ /* Velocity Sensor
* A sensor of this type measures the velocity as it is moving.
* The default unit velocity is meter by seconds m/s (SI).
*/
#define SENSOR_TYPE_COUNT 53 #define SENSOR_TYPE_VELOCITY 53
/* The total number of sensor
* please increase it if you added a new sensor type!
*/
#define SENSOR_TYPE_COUNT 54
/* The additional sensor open flags */ /* The additional sensor open flags */
@ -747,6 +756,12 @@ struct sensor_force /* Type: Force */
int32_t event; /* Force event */ int32_t event; /* Force event */
}; };
struct sensor_velocity /* Type: Velocity */
{
uint64_t timestamp; /* Unit is microseconds */
float velocity; /* Velocity value, units is m/s (SI) */
};
struct sensor_hall /* Type: HALL */ struct sensor_hall /* Type: HALL */
{ {
uint64_t timestamp; /* Units is microseconds */ uint64_t timestamp; /* Units is microseconds */