Skip to content
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
17 changes: 16 additions & 1 deletion system/sensortest/sensortest.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ static const struct sensor_info g_sensor_info[] =
{print_valf2, sizeof(struct sensor_baro), "baro"},
{print_cap, sizeof(struct sensor_cap), "cap"},
{print_valf, sizeof(struct sensor_co2), "co2"},
{print_valf, sizeof(struct sensor_current),
"current"},
{print_valf, sizeof(struct sensor_dust), "dust"},
{print_ecg, sizeof(struct sensor_ecg), "ecg"},
{print_force, sizeof(struct sensor_force), "force"},
Expand All @@ -112,6 +114,7 @@ static const struct sensor_info g_sensor_info[] =
{print_valf, sizeof(struct sensor_pm10), "pm10"},
{print_valf, sizeof(struct sensor_pm1p0), "pm1p0"},
{print_valf, sizeof(struct sensor_pm25), "pm25"},
{print_valf, sizeof(struct sensor_power), "power"},
{print_ppgd, sizeof(struct sensor_ppgd), "ppgd"},
{print_ppgq, sizeof(struct sensor_ppgq), "ppgq"},
{print_valf, sizeof(struct sensor_prox), "prox"},
Expand All @@ -120,7 +123,9 @@ static const struct sensor_info g_sensor_info[] =
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"}
{print_valf, sizeof(struct sensor_uv), "uv"},
{print_valf, sizeof(struct sensor_voltage),
"voltage"}
};

/****************************************************************************
Expand All @@ -130,6 +135,7 @@ static const struct sensor_info g_sensor_info[] =
static void print_vec3(const char *buffer, const char *name)
{
FAR struct sensor_accel *event = (FAR struct sensor_accel *)buffer;

printf("%s: timestamp:%" PRIu64 " x:%.2f y:%.2f z:%.2f, "
"temperature:%.2f\n",
name, event->timestamp, event->x, event->y,
Expand All @@ -139,41 +145,47 @@ static void print_vec3(const char *buffer, const char *name)
static void print_valb(const char *buffer, const char *name)
{
FAR struct sensor_hall *event = (FAR struct sensor_hall *)buffer;

printf("%s: timestamp:%" PRIu64 " value:%" PRIi32 "\n",
name, event->timestamp, event->hall);
}

static void print_vali2(const char *buffer, const char *name)
{
FAR struct sensor_ots *event = (FAR struct sensor_ots *)buffer;

printf("%s: timestamp:%" PRIu64 " value1:% " PRIi32 " value2:% " PRIi32
"\n", name, event->timestamp, event->x, event->y);
}

static void print_valf(const char *buffer, const char *name)
{
FAR struct sensor_prox *event = (FAR struct sensor_prox *)buffer;

printf("%s: timestamp:%" PRIu64 " value:%.2f\n",
name, event->timestamp, event->proximity);
}

static void print_valf2(const char *buffer, const char *name)
{
FAR struct sensor_baro *event = (FAR struct sensor_baro *)buffer;

printf("%s: timestamp:%" PRIu64 " value1:%.2f value2:%.2f\n",
name, event->timestamp, event->pressure, event->temperature);
}

static void print_valf3(const char *buffer, const char *name)
{
FAR struct sensor_rgb *event = (FAR struct sensor_rgb *)buffer;

printf("%s: timestamp:%" PRIu64 " value1:%.2f value2:%.2f, value3:%.2f\n",
name, event->timestamp, event->r, event->g, event->b);
}

static void print_ecg(const char *buffer, const char *name)
{
struct sensor_ecg *event = (struct sensor_ecg *)buffer;

printf("%s: timestamp:%" PRIu64 " ecg:%.4f status:%" PRIu32,
name, event->timestamp, event->ecg, event->status);
}
Expand All @@ -189,6 +201,7 @@ static void print_force(const char *buffer, const char *name)
static void print_ppgd(const char *buffer, const char *name)
{
FAR struct sensor_ppgd *event = (FAR struct sensor_ppgd *)buffer;

printf("%s: timestamp:%" PRIu64 " ppg1:%" PRIu32 " ppg2:%" PRIu32 " "
"current:%" PRIu32 " gain1:%" PRIu16 " gain2:%" PRIu16 "\n",
name, event->timestamp, event->ppg[0], event->ppg[1],
Expand All @@ -198,6 +211,7 @@ static void print_ppgd(const char *buffer, const char *name)
static void print_ppgq(const char *buffer, const char *name)
{
FAR struct sensor_ppgq *event = (FAR struct sensor_ppgq *)buffer;

printf("%s: timestamp:%" PRIu64 " ppg1:%" PRIu32 " ppg2:%" PRIu32 " "
"ppg3:%" PRIu32 " ppg4:%" PRIu32 " current:%" PRIu32 " "
"gain1:%" PRIu16 " gain2:%" PRIu16 " gain3:%" PRIu16 " "
Expand All @@ -210,6 +224,7 @@ static void print_ppgq(const char *buffer, const char *name)
static void print_cap(FAR const char *buffer, FAR const char *name)
{
FAR struct sensor_cap *event = (FAR struct sensor_cap *)buffer;

printf("%s: timestamp:%" PRIu64 " status:%" PRIu32 " "
"rawdata0:%" PRIu32 " rawdata1:%" PRIu32 " rawdata2:%" PRIu32 " "
"rawdata3:%" PRIu32 "\n",
Expand Down
Loading