This is an automated email from the ASF dual-hosted git repository.
lupyuen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git
The following commit(s) were added to refs/heads/master by this push:
new 9500938d4 testing/sensortest: Add support to Speed Sensors
9500938d4 is described below
commit 9500938d44e4291d3cdcfd8902696505e347c764
Author: Alan Carvalho de Assis <[email protected]>
AuthorDate: Thu Dec 19 13:22:03 2024 -0300
testing/sensortest: Add support to Speed Sensors
Signed-off-by: Alan C. Assis <[email protected]>
---
testing/sensortest/sensortest.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/testing/sensortest/sensortest.c b/testing/sensortest/sensortest.c
index ca309aa19..fb97108f3 100644
--- a/testing/sensortest/sensortest.c
+++ b/testing/sensortest/sensortest.c
@@ -68,6 +68,7 @@ static void print_valb(FAR const char *buffer, FAR const char
*name);
static void print_vali2(FAR const char *buffer, FAR const char *name);
static void print_ecg(FAR const char *buffer, FAR const char *name);
static void print_force(FAR const char *buffer, FAR const char *name);
+static void print_velocity(FAR const char *buffer, FAR const char *name);
static void print_ppgd(FAR const char *buffer, FAR const char *name);
static void print_ppgq(FAR const char *buffer, FAR const char *name);
static void print_cap(FAR const char *buffer, FAR const char *name);
@@ -113,6 +114,8 @@ static const struct sensor_info g_sensor_info[] =
{print_ppgq, sizeof(struct sensor_ppgq), "ppgq"},
{print_valf, sizeof(struct sensor_prox), "prox"},
{print_valf3, sizeof(struct sensor_rgb), "rgb"},
+ {print_velocity,
+ sizeof(struct sensor_velocity), "velocity"},
{print_valf, sizeof(struct sensor_temp), "temp"},
{print_valf, sizeof(struct sensor_tvoc), "tvoc"},
{print_valf, sizeof(struct sensor_uv), "uv"}
@@ -237,6 +240,15 @@ static void print_gnss_satellite(FAR const char *buffer,
name, event->timestamp, event->count, event->satellites);
}
+static void print_velocity(const char *buffer, const char *name)
+{
+ FAR struct sensor_velocity *event =
+ (FAR struct sensor_velocity *)buffer;
+
+ printf("%s: timestamp:%" PRIu64 " value:%.2f\n",
+ name, event->timestamp, event->velocity);
+}
+
static void usage(void)
{
printf("sensortest [arguments...] <command>\n");