fix: sensor: add sensor type of cap

Increase the type of cap sensor, including
raw data and detection status.

Signed-off-by: xiatian6 <xiatian6@xiaomi.com>
This commit is contained in:
xiatian6 2022-03-02 16:22:16 +08:00 committed by Petro Karashchenko
parent 06754940c5
commit 491f549d1c

View File

@ -64,6 +64,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_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);
static void print_gps(FAR const char *buffer, FAR const char *name);
static void print_gps_satellite(FAR const char *buffer,
FAR const char *name);
@ -105,6 +106,7 @@ static const struct sensor_info g_sensor_info[] =
{print_ppgq, sizeof(struct sensor_ppgq), "ppgq"},
{print_valf2, sizeof(struct sensor_impd), "impd"},
{print_vali2, sizeof(struct sensor_ots), "ots"},
{print_cap, sizeof(struct sensor_cap), "cap"},
{print_gps_satellite, sizeof(struct sensor_gps_satellite),
"gps_satellite"}
};
@ -178,6 +180,16 @@ static void print_ppgq(const char *buffer, const char *name)
event->gain[2], event->gain[3]);
}
static void print_cap(FAR const char *buffer, FAR const char *name)
{
struct sensor_cap *event = (struct sensor_cap *)buffer;
printf("%s: timestamp:%" PRIu64 " status:%" PRIu32 " "
"rawdata0:%" PRIu32 " rawdata1:%" PRIu32 " rawdata2:%" PRIu32 " "
"rawdata3:%" PRIu32 "\n",
name, event->timestamp, event->status, event->rawdata[0],
event->rawdata[1], event->rawdata[2], event->rawdata[3]);
}
static void print_gps(const char *buffer, const char *name)
{
struct sensor_gps *event = (struct sensor_gps *)buffer;