testing/sensortest: Add FAR for pointer type

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2022-08-14 10:41:46 +08:00 committed by Petro Karashchenko
parent 491f549d1c
commit 3021b8d11e

View File

@ -45,6 +45,7 @@
****************************************************************************/
typedef void (*data_print)(FAR const char *buffer, FAR const char *name);
struct sensor_info
{
data_print print;
@ -117,7 +118,7 @@ static const struct sensor_info g_sensor_info[] =
static void print_vec3(const char *buffer, const char *name)
{
struct sensor_accel *event = (struct sensor_accel *)buffer;
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,
@ -126,42 +127,42 @@ static void print_vec3(const char *buffer, const char *name)
static void print_valb(const char *buffer, const char *name)
{
struct sensor_hall *event = (struct sensor_hall *)buffer;
FAR struct sensor_hall *event = (FAR struct sensor_hall *)buffer;
printf("%s: timestamp:%" PRIu64 " value:%d\n",
name, event->timestamp, event->hall);
}
static void print_vali2(const char *buffer, const char *name)
{
struct sensor_ots *event = (struct sensor_ots *)buffer;
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)
{
struct sensor_prox *event = (struct sensor_prox *)buffer;
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)
{
struct sensor_baro *event = (struct sensor_baro *)buffer;
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)
{
struct sensor_rgb *event = (struct sensor_rgb *)buffer;
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_ppgd(const char *buffer, const char *name)
{
struct sensor_ppgd *event = (struct sensor_ppgd *)buffer;
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],
@ -170,7 +171,7 @@ static void print_ppgd(const char *buffer, const char *name)
static void print_ppgq(const char *buffer, const char *name)
{
struct sensor_ppgq *event = (struct sensor_ppgq *)buffer;
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 " "
@ -182,7 +183,7 @@ static void print_ppgq(const char *buffer, const char *name)
static void print_cap(FAR const char *buffer, FAR const char *name)
{
struct sensor_cap *event = (struct sensor_cap *)buffer;
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",
@ -192,7 +193,7 @@ static void print_cap(FAR const char *buffer, FAR const char *name)
static void print_gps(const char *buffer, const char *name)
{
struct sensor_gps *event = (struct sensor_gps *)buffer;
FAR struct sensor_gps *event = (FAR struct sensor_gps *)buffer;
printf("%s: timestamp:%" PRIu64 " time_utc: %" PRIu64 " latitude: %f "
"longitude: %f altitude: %f altitude_ellipsoid: %f eph: %f epv: %f "
@ -206,8 +207,8 @@ static void print_gps(const char *buffer, const char *name)
static void print_gps_satellite(FAR const char *buffer, FAR const char *name)
{
FAR struct sensor_gps_satellite *event =
(struct sensor_gps_satellite *)buffer;
FAR FAR struct sensor_gps_satellite *event =
(FAR struct sensor_gps_satellite *)buffer;
printf("%s: timestamp: %" PRIu64 " count: %" PRIu32
" satellites: %" PRIu32 "\n",