fix: sensor: support ECG event lead info

Lead info is added into sensor_ecg event struct. Uorb and sensortest shall be modified.

Signed-off-by: liucheng5 <liucheng5@xiaomi.com>
This commit is contained in:
liucheng5 2022-09-28 11:06:27 +08:00 committed by GUIDINGLI
parent 57af6174f0
commit bf140bcaae
2 changed files with 12 additions and 3 deletions

View File

@ -35,9 +35,10 @@ static void print_sensor_ecg_message(FAR const struct orb_metadata *meta,
FAR const struct sensor_ecg *message = buffer;
const orb_abstime now = orb_absolute_time();
uorbinfo_raw("%s:\ttimestamp: %" PRIu64 " (%" PRIu64 " us ago) ecg: %.4f",
uorbinfo_raw("%s:\ttimestamp: %" PRIu64 " (%" PRIu64 " us ago) ecg: %.4f "
"status:0x%" PRIx32 "",
meta->o_name, message->timestamp, now - message->timestamp,
message->ecg);
message->ecg, message->status);
}
#endif

View File

@ -63,6 +63,7 @@ static void print_valf2(FAR const char *buffer, FAR const char *name);
static void print_valf(FAR const char *buffer, FAR const char *name);
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_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);
@ -83,7 +84,7 @@ static const struct sensor_info g_sensor_info[] =
{print_cap, sizeof(struct sensor_cap), "cap"},
{print_valf, sizeof(struct sensor_co2), "co2"},
{print_valf, sizeof(struct sensor_dust), "dust"},
{print_valf, sizeof(struct sensor_ecg), "ecg"},
{print_ecg, sizeof(struct sensor_ecg), "ecg"},
{print_gps, sizeof(struct sensor_gps), "gps"},
{print_gps_satellite,
sizeof(struct sensor_gps_satellite), "gps_satellite"},
@ -160,6 +161,13 @@ static void print_valf3(const char *buffer, const char *name)
name, event->timestamp, event->r, event->g, event->b);
}
static void print_ecg(const char *buffer, const char *name)
{
struct sensor_event_ecg *event = (struct sensor_event_ecg *)buffer;
printf("%s: timestamp:%" PRIu64 " ecg:%.4f status:%lx", name,
event->timestamp, event->ecg, event->status);
}
static void print_ppgd(const char *buffer, const char *name)
{
FAR struct sensor_ppgd *event = (FAR struct sensor_ppgd *)buffer;