Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testing/sensortest: Add support to Velocity Sensors #2908

Merged
merged 1 commit into from
Dec 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions testing/sensortest/sensortest.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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"}
Expand Down Expand Up @@ -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");
Expand Down
Loading