mirror of
https://github.com/apache/nuttx.git
synced 2026-05-23 14:58:13 +08:00
nuttx/uorb: Rename GPS to GNSS
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
This commit is contained in:
@@ -36,7 +36,7 @@ CONFIG_FS_PROCFS=y
|
||||
CONFIG_FS_RAMMAP=y
|
||||
CONFIG_FS_ROMFS=y
|
||||
CONFIG_GPIO_LOWER_HALF=y
|
||||
CONFIG_GPSUTILS_MINMEA_LIB=y
|
||||
CONFIG_GNSSUTILS_MINMEA_LIB=y
|
||||
CONFIG_IDLETHREAD_STACKSIZE=4096
|
||||
CONFIG_INIT_ENTRYPOINT="nsh_main"
|
||||
CONFIG_IOEXPANDER=y
|
||||
|
||||
@@ -29,11 +29,11 @@ if(CONFIG_SENSORS)
|
||||
list(APPEND SRCS sensor_rpmsg.c)
|
||||
endif()
|
||||
|
||||
if(CONFIG_SENSORS_GPS)
|
||||
if(CONFIG_SENSORS_GNSS)
|
||||
set_source_files_properties(
|
||||
gps_uorb.c DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/..
|
||||
PROPERTIES INCLUDE_DIRECTORIES ${NUTTX_DIR}/libs/libc/gpsutils)
|
||||
list(APPEND SRCS gps_uorb.c)
|
||||
gnss_uorb.c DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/..
|
||||
PROPERTIES INCLUDE_DIRECTORIES ${NUTTX_DIR}/libs/libc/gnssutils)
|
||||
list(APPEND SRCS gnss_uorb.c)
|
||||
endif()
|
||||
|
||||
if(CONFIG_SENSORS_WTGAHRS2)
|
||||
@@ -44,8 +44,8 @@ if(CONFIG_SENSORS)
|
||||
list(APPEND SRCS fakesensor_uorb.c)
|
||||
endif()
|
||||
|
||||
if(CONFIG_SENSORS_GOLDFISH_GPS)
|
||||
list(APPEND SRCS goldfish_gps_uorb.c)
|
||||
if(CONFIG_SENSORS_GOLDFISH_GNSS)
|
||||
list(APPEND SRCS goldfish_gnss_uorb.c)
|
||||
endif()
|
||||
|
||||
if(CONFIG_SENSORS_GOLDFISH_SENSOR)
|
||||
|
||||
+13
-13
@@ -24,19 +24,19 @@ config SENSORS_RPMSG
|
||||
---help---
|
||||
Allow application to read or control remote sensor device by RPMSG.
|
||||
|
||||
config SENSORS_GPS
|
||||
bool "GPS Support"
|
||||
config SENSORS_GNSS
|
||||
bool "GNSS Support"
|
||||
default n
|
||||
depends on GPSUTILS_MINMEA_LIB
|
||||
depends on GNSSUTILS_MINMEA_LIB
|
||||
---help---
|
||||
Allow application to use gps by /dev/uorb/gps or /dev/ttyGPS
|
||||
Allow application to use GNSS by /dev/uorb/gnss or /dev/ttyGNSS
|
||||
|
||||
config SENSORS_GPS_RECV_BUFFERSIZE
|
||||
int "The size of recvive buffer for nmea message in gps driver"
|
||||
config SENSORS_GNSS_RECV_BUFFERSIZE
|
||||
int "The size of recvive buffer for nmea message in GNSS driver"
|
||||
default 2048
|
||||
depends on SENSORS_GPS
|
||||
depends on SENSORS_GNSS
|
||||
---help---
|
||||
The size of recvive buffer for nmea message in gps driver, if
|
||||
The size of recvive buffer for nmea message in GNSS driver, if
|
||||
the nmea message happen overwrite when driver push, you can increase
|
||||
the size.
|
||||
|
||||
@@ -46,11 +46,11 @@ config SENSORS_WTGAHRS2
|
||||
---help---
|
||||
We can read sensor data by serial interface. It need the hardware sensor
|
||||
wtgashrs2(JY901) as data source. This sensor can generate accelerometer,
|
||||
gyroscope, magnetic, barometer and gps data.
|
||||
gyroscope, magnetic, barometer and GNSS data.
|
||||
|
||||
config SENSORS_FAKESENSOR
|
||||
bool "Fake Sensor Support"
|
||||
depends on SENSORS_GPS
|
||||
depends on SENSORS_GNSS
|
||||
default n
|
||||
---help---
|
||||
Simulate physical sensor by reading data from csv file.
|
||||
@@ -65,9 +65,9 @@ config SENSORS_FAKESENSOR
|
||||
2.1234,3.23443,2.23456
|
||||
...
|
||||
|
||||
config SENSORS_GOLDFISH_GPS
|
||||
bool "Goldfish GPS Support"
|
||||
depends on SENSORS_GPS
|
||||
config SENSORS_GOLDFISH_GNSS
|
||||
bool "Goldfish GNSS Support"
|
||||
depends on SENSORS_GNSS
|
||||
default n
|
||||
|
||||
config SENSORS_GOLDFISH_SENSOR
|
||||
|
||||
@@ -32,8 +32,8 @@ ifeq ($(CONFIG_SENSORS_RPMSG),y)
|
||||
CSRCS += sensor_rpmsg.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_SENSORS_GPS),y)
|
||||
CSRCS += gps_uorb.c
|
||||
ifeq ($(CONFIG_SENSORS_GNSS),y)
|
||||
CSRCS += gnss_uorb.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_SENSORS_WTGAHRS2),y)
|
||||
@@ -44,8 +44,8 @@ ifeq ($(CONFIG_SENSORS_FAKESENSOR),y)
|
||||
CSRCS += fakesensor_uorb.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_SENSORS_GOLDFISH_GPS),y)
|
||||
CSRCS += goldfish_gps_uorb.c
|
||||
ifeq ($(CONFIG_SENSORS_GOLDFISH_GNSS),y)
|
||||
CSRCS += goldfish_gnss_uorb.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_SENSORS_GOLDFISH_SENSOR),y)
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#include <nuttx/semaphore.h>
|
||||
#include <nuttx/sensors/fakesensor.h>
|
||||
#include <nuttx/sensors/sensor.h>
|
||||
#include <nuttx/sensors/gps.h>
|
||||
#include <nuttx/sensors/gnss.h>
|
||||
#include <nuttx/signal.h>
|
||||
#include <debug.h>
|
||||
|
||||
@@ -49,7 +49,7 @@ struct fakesensor_s
|
||||
union
|
||||
{
|
||||
struct sensor_lowerhalf_s lower;
|
||||
struct gps_lowerhalf_s gps;
|
||||
struct gnss_lowerhalf_s gnss;
|
||||
};
|
||||
|
||||
int type;
|
||||
@@ -74,11 +74,11 @@ static int fakesensor_set_interval(FAR struct sensor_lowerhalf_s *lower,
|
||||
static int fakesensor_batch(FAR struct sensor_lowerhalf_s *lower,
|
||||
FAR struct file *filep,
|
||||
FAR uint32_t *latency_us);
|
||||
static int fakegps_activate(FAR struct gps_lowerhalf_s *lower,
|
||||
FAR struct file *filep, bool sw);
|
||||
static int fakegps_set_interval(FAR struct gps_lowerhalf_s *lower,
|
||||
FAR struct file *filep,
|
||||
FAR uint32_t *period_us);
|
||||
static int fakegnss_activate(FAR struct gnss_lowerhalf_s *lower,
|
||||
FAR struct file *filep, bool sw);
|
||||
static int fakegnss_set_interval(FAR struct gnss_lowerhalf_s *lower,
|
||||
FAR struct file *filep,
|
||||
FAR uint32_t *period_us);
|
||||
static void fakesensor_push_event(FAR struct fakesensor_s *sensor,
|
||||
uint64_t event_timestamp);
|
||||
static int fakesensor_thread(int argc, char** argv);
|
||||
@@ -94,10 +94,10 @@ static struct sensor_ops_s g_fakesensor_ops =
|
||||
.batch = fakesensor_batch,
|
||||
};
|
||||
|
||||
static struct gps_ops_s g_fakegps_ops =
|
||||
static struct gnss_ops_s g_fakegnss_ops =
|
||||
{
|
||||
.activate = fakegps_activate,
|
||||
.set_interval = fakegps_set_interval,
|
||||
.activate = fakegnss_activate,
|
||||
.set_interval = fakegnss_set_interval,
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
@@ -194,7 +194,7 @@ static inline void fakesensor_read_gyro(FAR struct fakesensor_s *sensor,
|
||||
sizeof(struct sensor_gyro));
|
||||
}
|
||||
|
||||
static inline void fakesensor_read_gps(FAR struct fakesensor_s *sensor)
|
||||
static inline void fakesensor_read_gnss(FAR struct fakesensor_s *sensor)
|
||||
{
|
||||
char raw[150];
|
||||
|
||||
@@ -202,8 +202,8 @@ static inline void fakesensor_read_gps(FAR struct fakesensor_s *sensor)
|
||||
{
|
||||
fakesensor_read_csv_line(&sensor->data, raw,
|
||||
sizeof(raw), sensor->raw_start);
|
||||
sensor->gps.push_data(sensor->gps.priv, raw,
|
||||
strlen(raw), true);
|
||||
sensor->gnss.push_data(sensor->gnss.priv, raw,
|
||||
strlen(raw), true);
|
||||
if (strstr(raw, "GGA") != NULL)
|
||||
{
|
||||
break;
|
||||
@@ -232,8 +232,8 @@ static int fakesensor_activate(FAR struct sensor_lowerhalf_s *lower,
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int fakegps_activate(FAR struct gps_lowerhalf_s *lower,
|
||||
FAR struct file *filep, bool enable)
|
||||
static int fakegnss_activate(FAR struct gnss_lowerhalf_s *lower,
|
||||
FAR struct file *filep, bool enable)
|
||||
{
|
||||
return fakesensor_activate((FAR void *)lower, filep, enable);
|
||||
}
|
||||
@@ -248,9 +248,9 @@ static int fakesensor_set_interval(FAR struct sensor_lowerhalf_s *lower,
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int fakegps_set_interval(FAR struct gps_lowerhalf_s *lower,
|
||||
FAR struct file *filep,
|
||||
FAR uint32_t *period_us)
|
||||
static int fakegnss_set_interval(FAR struct gnss_lowerhalf_s *lower,
|
||||
FAR struct file *filep,
|
||||
FAR uint32_t *period_us)
|
||||
{
|
||||
return fakesensor_set_interval((FAR void *)lower, filep, period_us);
|
||||
}
|
||||
@@ -292,9 +292,9 @@ void fakesensor_push_event(FAR struct fakesensor_s *sensor,
|
||||
fakesensor_read_gyro(sensor, event_timestamp);
|
||||
break;
|
||||
|
||||
case SENSOR_TYPE_GPS:
|
||||
case SENSOR_TYPE_GPS_SATELLITE:
|
||||
fakesensor_read_gps(sensor);
|
||||
case SENSOR_TYPE_GNSS:
|
||||
case SENSOR_TYPE_GNSS_SATELLITE:
|
||||
fakesensor_read_gnss(sensor);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -430,10 +430,10 @@ int fakesensor_init(int type, FAR const char *file_name,
|
||||
|
||||
/* Register sensor */
|
||||
|
||||
if (type == SENSOR_TYPE_GPS || type == SENSOR_TYPE_GPS_SATELLITE)
|
||||
if (type == SENSOR_TYPE_GNSS || type == SENSOR_TYPE_GNSS_SATELLITE)
|
||||
{
|
||||
sensor->gps.ops = &g_fakegps_ops;
|
||||
gps_register(&sensor->gps, devno, batch_number);
|
||||
sensor->gnss.ops = &g_fakegnss_ops;
|
||||
gnss_register(&sensor->gnss, devno, batch_number);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* drivers/sensors/goldfish_gps_uorb.c
|
||||
* drivers/sensors/goldfish_gnss_uorb.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
@@ -34,16 +34,16 @@
|
||||
#include <nuttx/kthread.h>
|
||||
#include <nuttx/nuttx.h>
|
||||
#include <nuttx/semaphore.h>
|
||||
#include <nuttx/sensors/goldfish_gps.h>
|
||||
#include <nuttx/sensors/gps.h>
|
||||
#include <nuttx/sensors/goldfish_gnss.h>
|
||||
#include <nuttx/sensors/gnss.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
|
||||
struct goldfish_gps_s
|
||||
struct goldfish_gnss_s
|
||||
{
|
||||
struct gps_lowerhalf_s gps;
|
||||
struct gnss_lowerhalf_s gnss;
|
||||
struct file pipe;
|
||||
volatile bool running;
|
||||
};
|
||||
@@ -52,26 +52,26 @@ struct goldfish_gps_s
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
static int goldfish_gps_activate(FAR struct gps_lowerhalf_s *lower,
|
||||
FAR struct file *filep, bool enabled);
|
||||
static int goldfish_gps_thread(int argc, FAR char** argv);
|
||||
static int goldfish_gnss_activate(FAR struct gnss_lowerhalf_s *lower,
|
||||
FAR struct file *filep, bool enabled);
|
||||
static int goldfish_gnss_thread(int argc, FAR char** argv);
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
static struct gps_ops_s g_goldfish_gps_ops =
|
||||
static struct gnss_ops_s g_goldfish_gnss_ops =
|
||||
{
|
||||
.activate = goldfish_gps_activate,
|
||||
.activate = goldfish_gnss_activate,
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
static inline int goldfish_gps_write_pipe(FAR struct file *pipe,
|
||||
FAR const void *buffer,
|
||||
size_t size)
|
||||
static inline int goldfish_gnss_write_pipe(FAR struct file *pipe,
|
||||
FAR const void *buffer,
|
||||
size_t size)
|
||||
{
|
||||
FAR const char *p = (FAR const char *)buffer;
|
||||
|
||||
@@ -90,10 +90,10 @@ static inline int goldfish_gps_write_pipe(FAR struct file *pipe,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int goldfish_gps_open_pipe(FAR struct file *filep,
|
||||
FAR const char *ns,
|
||||
FAR const char *pipe_name,
|
||||
int flags)
|
||||
static inline int goldfish_gnss_open_pipe(FAR struct file *filep,
|
||||
FAR const char *ns,
|
||||
FAR const char *pipe_name,
|
||||
int flags)
|
||||
{
|
||||
char buf[256];
|
||||
int buf_len;
|
||||
@@ -116,7 +116,7 @@ static inline int goldfish_gps_open_pipe(FAR struct file *filep,
|
||||
buf_len = snprintf(buf, sizeof(buf), "pipe:%s", pipe_name);
|
||||
}
|
||||
|
||||
ret = goldfish_gps_write_pipe(filep, buf, buf_len + 1);
|
||||
ret = goldfish_gnss_write_pipe(filep, buf, buf_len + 1);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("Could not connect to the '%s' service: %s",
|
||||
@@ -128,20 +128,20 @@ static inline int goldfish_gps_open_pipe(FAR struct file *filep,
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int goldfish_gps_activate(FAR struct gps_lowerhalf_s *gps,
|
||||
FAR struct file *filep,
|
||||
bool enabled)
|
||||
static int goldfish_gnss_activate(FAR struct gnss_lowerhalf_s *gnss,
|
||||
FAR struct file *filep,
|
||||
bool enabled)
|
||||
{
|
||||
FAR struct goldfish_gps_s *priv =
|
||||
container_of(gps, struct goldfish_gps_s, gps);
|
||||
FAR struct goldfish_gnss_s *priv =
|
||||
container_of(gnss, struct goldfish_gnss_s, gnss);
|
||||
priv->running = enabled;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int goldfish_gps_thread(int argc, FAR char** argv)
|
||||
static int goldfish_gnss_thread(int argc, FAR char** argv)
|
||||
{
|
||||
FAR struct goldfish_gps_s *priv = (FAR struct goldfish_gps_s *)
|
||||
FAR struct goldfish_gnss_s *priv = (FAR struct goldfish_gnss_s *)
|
||||
((uintptr_t)strtoul(argv[1], NULL, 16));
|
||||
ssize_t len;
|
||||
char buf[256];
|
||||
@@ -151,7 +151,7 @@ static int goldfish_gps_thread(int argc, FAR char** argv)
|
||||
len = file_read(&priv->pipe, buf, sizeof(buf));
|
||||
if (priv->running && len > 0)
|
||||
{
|
||||
priv->gps.push_data(priv->gps.priv, buf, len, true);
|
||||
priv->gnss.push_data(priv->gnss.priv, buf, len, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,10 +163,10 @@ static int goldfish_gps_thread(int argc, FAR char** argv)
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: goldfish_gps_init
|
||||
* Name: goldfish_gnss_init
|
||||
*
|
||||
* Description:
|
||||
* Goldfish GPS driver entrypoint.
|
||||
* Goldfish GNSS driver entrypoint.
|
||||
*
|
||||
* Input Parameters:
|
||||
* devno - The user specifies which device of this type, from 0.
|
||||
@@ -177,47 +177,47 @@ static int goldfish_gps_thread(int argc, FAR char** argv)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int goldfish_gps_init(int devno, uint32_t batch_number)
|
||||
int goldfish_gnss_init(int devno, uint32_t batch_number)
|
||||
{
|
||||
FAR struct goldfish_gps_s *gps;
|
||||
FAR struct goldfish_gnss_s *gnss;
|
||||
FAR char *argv[2];
|
||||
char arg1[32];
|
||||
int ret;
|
||||
|
||||
/* Alloc memory for sensor */
|
||||
|
||||
gps = kmm_zalloc(sizeof(struct goldfish_gps_s));
|
||||
if (!gps)
|
||||
gnss = kmm_zalloc(sizeof(struct goldfish_gnss_s));
|
||||
if (!gnss)
|
||||
{
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
ret = goldfish_gps_open_pipe(&gps->pipe, "qemud", "gps",
|
||||
O_RDWR | O_CLOEXEC);
|
||||
ret = goldfish_gnss_open_pipe(&gnss->pipe, "qemud", "gps",
|
||||
O_RDWR | O_CLOEXEC);
|
||||
if (ret < 0)
|
||||
{
|
||||
kmm_free(gps);
|
||||
kmm_free(gnss);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Create thread for sensor */
|
||||
|
||||
snprintf(arg1, 32, "%p", gps);
|
||||
snprintf(arg1, 32, "%p", gnss);
|
||||
argv[0] = arg1;
|
||||
argv[1] = NULL;
|
||||
ret = kthread_create("goldfish_gps_thread", SCHED_PRIORITY_DEFAULT,
|
||||
ret = kthread_create("goldfish_gnss_thread", SCHED_PRIORITY_DEFAULT,
|
||||
CONFIG_DEFAULT_TASK_STACKSIZE,
|
||||
goldfish_gps_thread, argv);
|
||||
goldfish_gnss_thread, argv);
|
||||
if (ret < 0)
|
||||
{
|
||||
file_close(&gps->pipe);
|
||||
kmm_free(gps);
|
||||
file_close(&gnss->pipe);
|
||||
kmm_free(gnss);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Register sensor */
|
||||
|
||||
gps->gps.ops = &g_goldfish_gps_ops;
|
||||
gnss->gnss.ops = &g_goldfish_gnss_ops;
|
||||
|
||||
return gps_register(&gps->gps, devno, batch_number);
|
||||
return gnss_register(&gnss->gnss, devno, batch_number);
|
||||
}
|
||||
@@ -170,7 +170,6 @@ static const struct sensor_meta_s g_sensor_meta[] =
|
||||
{sizeof(struct sensor_rgb), "rgb"},
|
||||
{sizeof(struct sensor_hall), "hall"},
|
||||
{sizeof(struct sensor_ir), "ir"},
|
||||
{sizeof(struct sensor_gps), "gps"},
|
||||
{sizeof(struct sensor_uv), "uv"},
|
||||
{sizeof(struct sensor_noise), "noise"},
|
||||
{sizeof(struct sensor_pm25), "pm25"},
|
||||
@@ -188,11 +187,12 @@ static const struct sensor_meta_s g_sensor_meta[] =
|
||||
{sizeof(struct sensor_ppgq), "ppgq"},
|
||||
{sizeof(struct sensor_impd), "impd"},
|
||||
{sizeof(struct sensor_ots), "ots"},
|
||||
{sizeof(struct sensor_gps_satellite), "gps_satellite"},
|
||||
{sizeof(struct sensor_wake_gesture), "wake_gesture"},
|
||||
{sizeof(struct sensor_cap), "cap"},
|
||||
{sizeof(struct sensor_gas), "gas"},
|
||||
{sizeof(struct sensor_force), "force"},
|
||||
{sizeof(struct sensor_gnss), "gnss"},
|
||||
{sizeof(struct sensor_gnss_satellite), "gnss_satellite"},
|
||||
};
|
||||
|
||||
static const struct file_operations g_sensor_fops =
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* drivers/sensors/wtgahrs2_uorb.c
|
||||
* Driver for the Wit-Motion WTGAHRS2 accelerometer, gyroscope, magnetic,
|
||||
* angle, barometer, temperature, gps sensors by serial interface with host
|
||||
* angle, barometer, temperature, GNSS sensors by serial interface with host
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
@@ -47,21 +47,21 @@
|
||||
#define WTGAHRS2_GYRO_IDX 1
|
||||
#define WTGAHRS2_MAG_IDX 2
|
||||
#define WTGAHRS2_BARO_IDX 3
|
||||
#define WTGAHRS2_GPS_IDX 4
|
||||
#define WTGAHRS2_GNSS_IDX 4
|
||||
#define WTGAHRS2_MAX_IDX 5
|
||||
|
||||
#define WTGAHRS2_GPS0_MASK (1 << 0) /* Time */
|
||||
#define WTGAHRS2_GPS1_MASK (1 << 1) /* Longitude, Latitude */
|
||||
#define WTGAHRS2_GPS2_MASK (1 << 2) /* Ground speed, Height, Yaw */
|
||||
#define WTGAHRS2_GPS_MASK (7 << 0)
|
||||
#define WTGAHRS2_GNSS0_MASK (1 << 0) /* Time */
|
||||
#define WTGAHRS2_GNSS1_MASK (1 << 1) /* Longitude, Latitude */
|
||||
#define WTGAHRS2_GNSS2_MASK (1 << 2) /* Ground speed, Height, Yaw */
|
||||
#define WTGAHRS2_GNSS_MASK (7 << 0)
|
||||
|
||||
#define WTGAHRS2_GPS0_INFO 0x50
|
||||
#define WTGAHRS2_GNSS0_INFO 0x50
|
||||
#define WTGAHRS2_ACCEL_INFO 0x51
|
||||
#define WTGAHRS2_GYRO_INFO 0x52
|
||||
#define WTGAHRS2_MAG_INFO 0x54
|
||||
#define WTGAHRS2_BARO_INFO 0x56
|
||||
#define WTGAHRS2_GPS1_INFO 0x57
|
||||
#define WTGAHRS2_GPS2_INFO 0x58
|
||||
#define WTGAHRS2_GNSS1_INFO 0x57
|
||||
#define WTGAHRS2_GNSS2_INFO 0x58
|
||||
|
||||
#define WTGAHRS2_RSP_HEADER 0x55
|
||||
#define WTGAHRS2_RSP_LENGTH 11
|
||||
@@ -84,8 +84,8 @@ struct wtgahrs2_dev_s
|
||||
struct wtgahrs2_sensor_s dev[WTGAHRS2_MAX_IDX];
|
||||
struct file file;
|
||||
|
||||
struct sensor_gps gps;
|
||||
unsigned char gps_mask;
|
||||
struct sensor_gnss gnss;
|
||||
unsigned char gnss_mask;
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
@@ -287,10 +287,10 @@ static void wtgahrs2_baro_data(FAR struct wtgahrs2_dev_s *rtdata,
|
||||
sninfo("Pressure : %.3fhPa\n", baro.pressure);
|
||||
}
|
||||
|
||||
static void wtgahrs2_gps_data(FAR struct wtgahrs2_dev_s *rtdata,
|
||||
FAR unsigned char *buffer, int info_type)
|
||||
static void wtgahrs2_gnss_data(FAR struct wtgahrs2_dev_s *rtdata,
|
||||
FAR unsigned char *buffer, int info_type)
|
||||
{
|
||||
FAR struct wtgahrs2_sensor_s *dev = &rtdata->dev[WTGAHRS2_GPS_IDX];
|
||||
FAR struct wtgahrs2_sensor_s *dev = &rtdata->dev[WTGAHRS2_GNSS_IDX];
|
||||
FAR struct sensor_lowerhalf_s *lower = &dev->lower;
|
||||
uint64_t now = sensor_get_timestamp();
|
||||
|
||||
@@ -299,47 +299,47 @@ static void wtgahrs2_gps_data(FAR struct wtgahrs2_dev_s *rtdata,
|
||||
return;
|
||||
}
|
||||
|
||||
if (rtdata->gps_mask == 0)
|
||||
if (rtdata->gnss_mask == 0)
|
||||
{
|
||||
dev->last_update = now;
|
||||
}
|
||||
|
||||
switch (info_type)
|
||||
{
|
||||
case WTGAHRS2_GPS0_INFO:
|
||||
rtdata->gps_mask |= WTGAHRS2_GPS0_MASK;
|
||||
case WTGAHRS2_GNSS0_INFO:
|
||||
rtdata->gnss_mask |= WTGAHRS2_GNSS0_MASK;
|
||||
break;
|
||||
|
||||
case WTGAHRS2_GPS1_INFO:
|
||||
rtdata->gps_mask |= WTGAHRS2_GPS1_MASK;
|
||||
rtdata->gps.longitude = (buffer[3] << 8
|
||||
| buffer[2] << 8
|
||||
| buffer[1] << 8
|
||||
| buffer[0]) / 10000000.0f;
|
||||
rtdata->gps.latitude = (buffer[7] << 8
|
||||
| buffer[6] << 8
|
||||
| buffer[5] << 8
|
||||
| buffer[4]) / 10000000.0f;
|
||||
case WTGAHRS2_GNSS1_INFO:
|
||||
rtdata->gnss_mask |= WTGAHRS2_GNSS1_MASK;
|
||||
rtdata->gnss.longitude = (buffer[3] << 8
|
||||
| buffer[2] << 8
|
||||
| buffer[1] << 8
|
||||
| buffer[0]) / 10000000.0f;
|
||||
rtdata->gnss.latitude = (buffer[7] << 8
|
||||
| buffer[6] << 8
|
||||
| buffer[5] << 8
|
||||
| buffer[4]) / 10000000.0f;
|
||||
break;
|
||||
|
||||
case WTGAHRS2_GPS2_INFO:
|
||||
rtdata->gps_mask |= WTGAHRS2_GPS2_MASK;
|
||||
rtdata->gps.altitude = (float)(buffer[1] << 8 | buffer[0]) / 10.0f;
|
||||
rtdata->gps.ground_speed = (float)(buffer[7] << 8 | buffer[6] << 8
|
||||
| buffer[5] << 8 | buffer[4]) / 3600.0f;
|
||||
case WTGAHRS2_GNSS2_INFO:
|
||||
rtdata->gnss_mask |= WTGAHRS2_GNSS2_MASK;
|
||||
rtdata->gnss.altitude = (float)(buffer[1] << 8 | buffer[0]) / 10.0f;
|
||||
rtdata->gnss.ground_speed = (float)(buffer[7] << 8 | buffer[6] << 8
|
||||
| buffer[5] << 8 | buffer[4]) / 3600.0f;
|
||||
break;
|
||||
}
|
||||
|
||||
if (rtdata->gps_mask == WTGAHRS2_GPS_MASK)
|
||||
if (rtdata->gnss_mask == WTGAHRS2_GNSS_MASK)
|
||||
{
|
||||
rtdata->gps_mask = 0;
|
||||
lower->push_event(lower->priv, &rtdata->gps, sizeof(rtdata->gps));
|
||||
rtdata->gnss_mask = 0;
|
||||
lower->push_event(lower->priv, &rtdata->gnss, sizeof(rtdata->gnss));
|
||||
sninfo("Time : %" PRIu64 " utc_time: %" PRIu64 "\n",
|
||||
rtdata->gps.timestamp, rtdata->gps.time_utc);
|
||||
sninfo("GPS longitude : %fdegree, latitude:%fdegree\n",
|
||||
rtdata->gps.longitude, rtdata->gps.latitude);
|
||||
sninfo("GPS speed: %fm/s, altitude: %fm\n",
|
||||
rtdata->gps.ground_speed, rtdata->gps.altitude);
|
||||
rtdata->gnss.timestamp, rtdata->gnss.time_utc);
|
||||
sninfo("GNSS longitude : %fdegree, latitude:%fdegree\n",
|
||||
rtdata->gnss.longitude, rtdata->gnss.latitude);
|
||||
sninfo("GNSS speed: %fm/s, altitude: %fm\n",
|
||||
rtdata->gnss.ground_speed, rtdata->gnss.altitude);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -379,10 +379,10 @@ static bool wtgahrs2_process_data(FAR struct wtgahrs2_dev_s *rtdata,
|
||||
wtgahrs2_baro_data(rtdata, &buffer[2]);
|
||||
break;
|
||||
|
||||
case WTGAHRS2_GPS0_INFO:
|
||||
case WTGAHRS2_GPS1_INFO:
|
||||
case WTGAHRS2_GPS2_INFO:
|
||||
wtgahrs2_gps_data(rtdata, &buffer[2], buffer[1]);
|
||||
case WTGAHRS2_GNSS0_INFO:
|
||||
case WTGAHRS2_GNSS1_INFO:
|
||||
case WTGAHRS2_GNSS2_INFO:
|
||||
wtgahrs2_gnss_data(rtdata, &buffer[2], buffer[1]);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -519,16 +519,16 @@ int wtgahrs2_initialize(FAR const char *path, int devno)
|
||||
goto baro_err;
|
||||
}
|
||||
|
||||
/* GPS register */
|
||||
/* GNSS register */
|
||||
|
||||
tmp = &rtdata->dev[WTGAHRS2_GPS_IDX];
|
||||
tmp = &rtdata->dev[WTGAHRS2_GNSS_IDX];
|
||||
tmp->lower.ops = &g_wtgahrs2_ops;
|
||||
tmp->lower.type = SENSOR_TYPE_GPS;
|
||||
tmp->lower.type = SENSOR_TYPE_GNSS;
|
||||
tmp->lower.nbuffer = 1;
|
||||
ret = sensor_register(&tmp->lower, devno);
|
||||
if (ret < 0)
|
||||
{
|
||||
goto gps_err;
|
||||
goto gnss_err;
|
||||
}
|
||||
|
||||
/* Set sensor default attributes and enter unlock mode */
|
||||
@@ -558,8 +558,8 @@ int wtgahrs2_initialize(FAR const char *path, int devno)
|
||||
return ret;
|
||||
|
||||
thr_err:
|
||||
sensor_unregister(&rtdata->dev[WTGAHRS2_GPS_IDX].lower, devno);
|
||||
gps_err:
|
||||
sensor_unregister(&rtdata->dev[WTGAHRS2_GNSS_IDX].lower, devno);
|
||||
gnss_err:
|
||||
sensor_unregister(&rtdata->dev[WTGAHRS2_BARO_IDX].lower, devno);
|
||||
baro_err:
|
||||
sensor_unregister(&rtdata->dev[WTGAHRS2_MAG_IDX].lower, devno);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* include/nuttx/sensors/gps.h
|
||||
* include/nuttx/sensors/gnss.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
@@ -18,8 +18,8 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __INCLUDE_NUTTX_SENSORS_GPS_H
|
||||
#define __INCLUDE_NUTTX_SENSORS_GPS_H
|
||||
#ifndef __INCLUDE_NUTTX_SENSORS_GNSS_H
|
||||
#define __INCLUDE_NUTTX_SENSORS_GNSS_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
@@ -35,22 +35,22 @@
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/* The gps lower half driver interface */
|
||||
/* The GNSS lower half driver interface */
|
||||
|
||||
struct gps_lowerhalf_s;
|
||||
struct gps_ops_s
|
||||
struct gnss_lowerhalf_s;
|
||||
struct gnss_ops_s
|
||||
{
|
||||
/**************************************************************************
|
||||
* Name: activate
|
||||
*
|
||||
* Description:
|
||||
* Enable or disable gps device. when enable gps, gps will
|
||||
* Enable or disable GNSS device. when enable GNSS, GNSS will
|
||||
* work in current mode(if not set, use default mode). when disable
|
||||
* gps, it will disable sense path and stop work.
|
||||
* GNSS, it will disable sense path and stop work.
|
||||
*
|
||||
* Input Parameters:
|
||||
* lower - The instance of lower half gps driver
|
||||
* filep - The pointer of file, represents each user using the gps.
|
||||
* lower - The instance of lower half GNSS driver
|
||||
* filep - The pointer of file, represents each user using the GNSS.
|
||||
* enable - true(enable) and false(disable)
|
||||
*
|
||||
* Returned Value:
|
||||
@@ -58,14 +58,14 @@ struct gps_ops_s
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
CODE int (*activate)(FAR struct gps_lowerhalf_s *lower,
|
||||
CODE int (*activate)(FAR struct gnss_lowerhalf_s *lower,
|
||||
FAR struct file *filep, bool enable);
|
||||
|
||||
/**************************************************************************
|
||||
* Name: set_interval
|
||||
*
|
||||
* Description:
|
||||
* Set the gps output data period in microseconds for a given gps.
|
||||
* Set the GNSS output data period in microseconds for a given GNSS.
|
||||
* If *period_us > max_delay it will be truncated to max_delay and if
|
||||
* *period_us < min_delay it will be replaced by min_delay.
|
||||
*
|
||||
@@ -76,8 +76,8 @@ struct gps_ops_s
|
||||
* ensure that they are not lost.
|
||||
*
|
||||
* Input Parameters:
|
||||
* lower - The instance of lower half gps driver.
|
||||
* filep - The pointer of file, represents each user using gps.
|
||||
* lower - The instance of lower half GNSS driver.
|
||||
* filep - The pointer of file, represents each user using GNSS.
|
||||
* period_us - the time between samples, in us, it may be overwrite by
|
||||
* lower half driver.
|
||||
*
|
||||
@@ -86,21 +86,21 @@ struct gps_ops_s
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
CODE int (*set_interval)(FAR struct gps_lowerhalf_s *lower,
|
||||
CODE int (*set_interval)(FAR struct gnss_lowerhalf_s *lower,
|
||||
FAR struct file *filep,
|
||||
FAR uint32_t *period_us);
|
||||
|
||||
/**************************************************************************
|
||||
* Name: control
|
||||
*
|
||||
* With this method, the user can set some special config for the gps,
|
||||
* With this method, the user can set some special config for the GNSS,
|
||||
* such as changing the custom mode, setting the custom resolution, reset,
|
||||
* etc, which are all parsed and implemented by lower half driver.
|
||||
*
|
||||
* Input Parameters:
|
||||
* lower - The instance of lower half gps driver.
|
||||
* filep - The pointer of file, represents each user using gps.
|
||||
* cmd - The special cmd for gps.
|
||||
* lower - The instance of lower half GNSS driver.
|
||||
* filep - The pointer of file, represents each user using GNSS.
|
||||
* cmd - The special cmd for GNSS.
|
||||
* arg - The parameters associated with cmd.
|
||||
*
|
||||
* Returned Value:
|
||||
@@ -109,19 +109,19 @@ struct gps_ops_s
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
CODE int (*control)(FAR struct gps_lowerhalf_s *lower,
|
||||
CODE int (*control)(FAR struct gnss_lowerhalf_s *lower,
|
||||
FAR struct file *filep,
|
||||
int cmd, unsigned long arg);
|
||||
|
||||
/**************************************************************************
|
||||
* Name: inject_data
|
||||
*
|
||||
* With this method, the user can inject some data to gps driver,
|
||||
* With this method, the user can inject some data to GNSS driver,
|
||||
* such as inject lto data, utc data, etc.
|
||||
*
|
||||
* Input Parameters:
|
||||
* lower - The instance of lower half gps driver.
|
||||
* filep - The pointer of file, represents each user using gps.
|
||||
* lower - The instance of lower half GNSS driver.
|
||||
* filep - The pointer of file, represents each user using GNSS.
|
||||
* buffer - The buffer of inject data.
|
||||
* buflen - The length of buffer.
|
||||
*
|
||||
@@ -131,41 +131,41 @@ struct gps_ops_s
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
CODE ssize_t (*inject_data)(FAR struct gps_lowerhalf_s *lower,
|
||||
CODE ssize_t (*inject_data)(FAR struct gnss_lowerhalf_s *lower,
|
||||
FAR struct file *filep,
|
||||
FAR const void *buffer, size_t buflen);
|
||||
};
|
||||
|
||||
/* This structure is the generic form of state structure used by lower half
|
||||
* gps driver.
|
||||
* GNSS driver.
|
||||
*/
|
||||
|
||||
typedef CODE void (*gps_push_data_t)(FAR void *priv, FAR const void *data,
|
||||
size_t bytes, bool is_nmea);
|
||||
typedef CODE void (*gnss_push_data_t)(FAR void *priv, FAR const void *data,
|
||||
size_t bytes, bool is_nmea);
|
||||
|
||||
typedef CODE void (*gps_push_event_t)(FAR void *priv, FAR const void *data,
|
||||
size_t bytes, int type);
|
||||
typedef CODE void (*gnss_push_event_t)(FAR void *priv, FAR const void *data,
|
||||
size_t bytes, int type);
|
||||
|
||||
struct gps_lowerhalf_s
|
||||
struct gnss_lowerhalf_s
|
||||
{
|
||||
/* The lower half gps driver operations */
|
||||
/* The lower half GNSS driver operations */
|
||||
|
||||
FAR const struct gps_ops_s *ops;
|
||||
FAR const struct gnss_ops_s *ops;
|
||||
|
||||
/* Lower half driver pushes raw data by calling this function.
|
||||
* It is provided by upper half driver to lower half driver,
|
||||
* if paramenter is_nmea is true, the data includes nmea message.
|
||||
*/
|
||||
|
||||
gps_push_data_t push_data;
|
||||
gnss_push_data_t push_data;
|
||||
|
||||
/* Lower half driver pushes gps event by calling this function.
|
||||
/* Lower half driver pushes GNSS event by calling this function.
|
||||
* It is provided by upper half driver to lower half driver.
|
||||
* lower half can use type to description the data type, eg:
|
||||
* SENSOR_TYPE_GPS, SENSOR_TYPE_GPS_SATELLITE
|
||||
* SENSOR_TYPE_GNSS, SENSOR_TYPE_GNSS_SATELLITE
|
||||
*/
|
||||
|
||||
gps_push_event_t push_event;
|
||||
gnss_push_event_t push_event;
|
||||
|
||||
/* The private opaque pointer to be passed to upper-layer during callback */
|
||||
|
||||
@@ -185,16 +185,16 @@ extern "C"
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: gps_register
|
||||
* Name: gnss_register
|
||||
*
|
||||
* Description:
|
||||
* This function binds an instance of a "lower half" gps driver with the
|
||||
* "upper half" gps device and registers that device so that can be used
|
||||
* This function binds an instance of a "lower half" GNSS driver with the
|
||||
* "upper half" GNSS device and registers that device so that can be used
|
||||
* by application code.
|
||||
*
|
||||
* Input Parameters:
|
||||
* dev - A pointer to an instance of lower half gps driver. This
|
||||
* instance is bound to the gps driver and must persist as long
|
||||
* dev - A pointer to an instance of lower half GNSS driver. This
|
||||
* instance is bound to the GNSS driver and must persist as long
|
||||
* as the driver persists.
|
||||
* devno - The user specifies which device of this type, from 0. If the
|
||||
* devno alerady exists, -EEXIST will be returned.
|
||||
@@ -206,28 +206,28 @@ extern "C"
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int gps_register(FAR struct gps_lowerhalf_s *dev, int devno,
|
||||
uint32_t nbuffer);
|
||||
int gnss_register(FAR struct gnss_lowerhalf_s *dev, int devno,
|
||||
uint32_t nbuffer);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: gps_unregister
|
||||
* Name: gnss_unregister
|
||||
*
|
||||
* Description:
|
||||
* This function unregisters character node and releases all resource from
|
||||
* upper half driver. This API corresponds to the gps_register.
|
||||
* upper half driver. This API corresponds to the gnss_register.
|
||||
*
|
||||
* Input Parameters:
|
||||
* dev - A pointer to an instance of lower half gps driver. This
|
||||
* instance is bound to the gps driver and must persists as long
|
||||
* dev - A pointer to an instance of lower half GNSS driver. This
|
||||
* instance is bound to the GNSS driver and must persists as long
|
||||
* as the driver persists.
|
||||
* devno - The user specifies which device of this type, from 0.
|
||||
****************************************************************************/
|
||||
|
||||
void gps_unregister(FAR struct gps_lowerhalf_s *dev, int devno);
|
||||
void gnss_unregister(FAR struct gnss_lowerhalf_s *dev, int devno);
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __INCLUDE_NUTTX_SENSORS_GPS_H */
|
||||
#endif /* __INCLUDE_NUTTX_SENSORS_GNSS_H */
|
||||
@@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* include/nuttx/sensors/goldfish_gps.h
|
||||
* include/nuttx/sensors/goldfish_gnss.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
@@ -18,8 +18,8 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __INCLUDE_NUTTX_SENSORS_GOLDFISH_GPS_H
|
||||
#define __INCLUDE_NUTTX_SENSORS_GOLDFISH_GPS_H
|
||||
#ifndef __INCLUDE_NUTTX_SENSORS_GOLDFISH_GNSS_H
|
||||
#define __INCLUDE_NUTTX_SENSORS_GOLDFISH_GNSS_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
@@ -37,10 +37,10 @@ extern "C"
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: goldfish_gps_init
|
||||
* Name: goldfish_gnss_init
|
||||
*
|
||||
* Description:
|
||||
* Goldfish GPS driver entrypoint.
|
||||
* Goldfish GNSS driver entrypoint.
|
||||
*
|
||||
* Input Parameters:
|
||||
* devno - The user specifies which device of this type, from 0.
|
||||
@@ -51,7 +51,7 @@ extern "C"
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int goldfish_gps_init(int devno, uint32_t batch_number);
|
||||
int goldfish_gnss_init(int devno, uint32_t batch_number);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* include/nuttx/sensors/wtgahrs2.h
|
||||
* Driver for the Wit-Motion WTGAHRS2 accelerometer, gyroscope, magnetic,
|
||||
* angle, barometer, temperature, gps sensors by serial interface with host
|
||||
* angle, barometer, temperature, GNSS sensors by serial interface with host
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
@@ -45,7 +45,7 @@ extern "C"
|
||||
*
|
||||
* Description:
|
||||
* Initialize wrgahrs2 sensor module, it will create accelerometer,
|
||||
* gyroscope, magnetic, barometer, gps character device.
|
||||
* gyroscope, magnetic, barometer, GNSS character device.
|
||||
*
|
||||
* Input Parameters:
|
||||
* devpath - The full path to the driver to read data source by serial tty.
|
||||
|
||||
+73
-73
@@ -124,68 +124,60 @@
|
||||
|
||||
#define SENSOR_TYPE_IR 11
|
||||
|
||||
/* GPS
|
||||
* A sensor of this type returns gps data. Include latitude, longitude,
|
||||
* altitude, horizontal position accuracy, vertical position accuracy,
|
||||
* horizontal dilution of precision, vertical dilution of precision...
|
||||
*/
|
||||
|
||||
#define SENSOR_TYPE_GPS 12
|
||||
|
||||
/* Ultraviolet light sensor
|
||||
* This sensor can identify the UV index in ambient light help people
|
||||
* to effectively protect themselves from sunburns, cancer or eye damage.
|
||||
* This value range is 0 - 15.
|
||||
*/
|
||||
#define SENSOR_TYPE_ULTRAVIOLET 13
|
||||
#define SENSOR_TYPE_ULTRAVIOLET 12
|
||||
|
||||
/* Noise Loudness
|
||||
* A sensor of this type returns the loudness of noise in SI units (db)
|
||||
*/
|
||||
|
||||
#define SENSOR_TYPE_NOISE 14
|
||||
#define SENSOR_TYPE_NOISE 13
|
||||
|
||||
/* PM25
|
||||
* A sensor of this type returns the content of pm2.5 in the air
|
||||
* This value is in SI units (ug/m^3)
|
||||
*/
|
||||
|
||||
#define SENSOR_TYPE_PM25 15
|
||||
#define SENSOR_TYPE_PM25 14
|
||||
|
||||
/* PM1P0
|
||||
* A sensor of this type returns the content of pm1.0 in the air
|
||||
* This value is in SI units (ug/m^3)
|
||||
*/
|
||||
|
||||
#define SENSOR_TYPE_PM1P0 16
|
||||
#define SENSOR_TYPE_PM1P0 15
|
||||
|
||||
/* PM10
|
||||
* A sensor of this type returns the content of pm10 in the air
|
||||
* This value is in SI units (ug/m^3)
|
||||
*/
|
||||
|
||||
#define SENSOR_TYPE_PM10 17
|
||||
#define SENSOR_TYPE_PM10 16
|
||||
|
||||
/* CO2
|
||||
* A sensor of this type returns the content of CO2 in the air
|
||||
* This value is in units (ppm-part per million).
|
||||
*/
|
||||
|
||||
#define SENSOR_TYPE_CO2 18
|
||||
#define SENSOR_TYPE_CO2 17
|
||||
|
||||
/* HCHO
|
||||
* The HCHO pollution is an important indicator of household air
|
||||
* pollution. This value is in units (ppm-part per million).
|
||||
*/
|
||||
|
||||
#define SENSOR_TYPE_HCHO 19
|
||||
#define SENSOR_TYPE_HCHO 18
|
||||
|
||||
/* TVOC (total volatile organic compounds)
|
||||
* The indoor TVOC is cause indoor air pollution is one of the
|
||||
* main reasons why. This value is in units (ppb-part per billion).
|
||||
*/
|
||||
|
||||
#define SENSOR_TYPE_TVOC 20
|
||||
#define SENSOR_TYPE_TVOC 19
|
||||
|
||||
/* PH
|
||||
* The acid-base degree describes the strength of the aqueous
|
||||
@@ -194,21 +186,21 @@
|
||||
* pH<7 is acidic, and pH>7 is alkaline.
|
||||
*/
|
||||
|
||||
#define SENSOR_TYPE_PH 21
|
||||
#define SENSOR_TYPE_PH 20
|
||||
|
||||
/* Dust
|
||||
* A sensor of this type returns the content of dust in the air
|
||||
* values is in ug/m^3.
|
||||
*/
|
||||
|
||||
#define SENSOR_TYPE_DUST 22
|
||||
#define SENSOR_TYPE_DUST 21
|
||||
|
||||
/* Heart Rate
|
||||
* A sensor of this type returns the current heart rate.
|
||||
* Current heart rate is in beats per minute (BPM).
|
||||
*/
|
||||
|
||||
#define SENSOR_TYPE_HEART_RATE 23
|
||||
#define SENSOR_TYPE_HEART_RATE 22
|
||||
|
||||
/* Heart Beat
|
||||
* A sensor of this type returns an event evetytime
|
||||
@@ -216,7 +208,7 @@
|
||||
* to the positive peak in the QRS complex of and ECG signal.
|
||||
*/
|
||||
|
||||
#define SENSOR_TYPE_HEART_BEAT 24
|
||||
#define SENSOR_TYPE_HEART_BEAT 23
|
||||
|
||||
/* ECG (Electrocardiogram)
|
||||
* A sensor of this type returns the ECG voltage in μV. Sensors may amplify
|
||||
@@ -224,7 +216,7 @@
|
||||
* voltage.
|
||||
*/
|
||||
|
||||
#define SENSOR_TYPE_ECG 25
|
||||
#define SENSOR_TYPE_ECG 24
|
||||
|
||||
/* PPG Dual (2-channel photoplethysmography)
|
||||
* A sensor of this type returns the 2 channels PPG measurements in ADC
|
||||
@@ -235,7 +227,7 @@
|
||||
* measurements. The ADC gains are multipled on the output and affect SNR.
|
||||
*/
|
||||
|
||||
#define SENSOR_TYPE_PPGD 26
|
||||
#define SENSOR_TYPE_PPGD 25
|
||||
|
||||
/* PPG Quad (4-channel photoplethysmography)
|
||||
* A sensor of this type returns the 4 channels PPG measurements in ADC
|
||||
@@ -246,7 +238,7 @@
|
||||
* measurements. The ADC gains are multipled on the output and affect SNR.
|
||||
*/
|
||||
|
||||
#define SENSOR_TYPE_PPGQ 27
|
||||
#define SENSOR_TYPE_PPGQ 26
|
||||
|
||||
/* Imdepance
|
||||
* A sensor of this type returns the impedance measurements. An impedance
|
||||
@@ -254,7 +246,7 @@
|
||||
* imaginary part(reactance). Both of them are in uint Ohm(Ω).
|
||||
*/
|
||||
|
||||
#define SENSOR_TYPE_IMPEDANCE 28
|
||||
#define SENSOR_TYPE_IMPEDANCE 27
|
||||
|
||||
/* OTS (Optical tracking sensor)
|
||||
* A sensor of this type returns the OTS measurements in counts. It
|
||||
@@ -263,13 +255,7 @@
|
||||
* design flexibility into a compact device.
|
||||
*/
|
||||
|
||||
#define SENSOR_TYPE_OTS 29
|
||||
|
||||
/* Sensor of gps satellite
|
||||
* A sensor of this type returns the gps satellite information.
|
||||
*/
|
||||
|
||||
#define SENSOR_TYPE_GPS_SATELLITE 30
|
||||
#define SENSOR_TYPE_OTS 28
|
||||
|
||||
/* Wake gesture
|
||||
* A sensor enabling waking up the device based on a device specific
|
||||
@@ -278,7 +264,7 @@
|
||||
* uncalibrated topics.
|
||||
*/
|
||||
|
||||
#define SENSOR_TYPE_WAKE_GESTURE 31
|
||||
#define SENSOR_TYPE_WAKE_GESTURE 29
|
||||
|
||||
/* CAP (Capacitive proximity sensor)
|
||||
* The purpose of the proximity sensing interface is to detect when a
|
||||
@@ -286,14 +272,14 @@
|
||||
* is in the proximity of the system.
|
||||
*/
|
||||
|
||||
#define SENSOR_TYPE_CAP 32
|
||||
#define SENSOR_TYPE_CAP 30
|
||||
|
||||
/* Gas sensor
|
||||
* This sensor measures the gas resistance, indicating the presence
|
||||
* of volatile organic compounds in the air.
|
||||
*/
|
||||
|
||||
#define SENSOR_TYPE_GAS 33
|
||||
#define SENSOR_TYPE_GAS 31
|
||||
|
||||
/* Force
|
||||
* A sensor of this type measures the force on it, and additionally
|
||||
@@ -303,7 +289,21 @@
|
||||
* some given threshold, a corresponding event is reported.
|
||||
*/
|
||||
|
||||
#define SENSOR_TYPE_FORCE 34
|
||||
#define SENSOR_TYPE_FORCE 32
|
||||
|
||||
/* GNSS
|
||||
* A sensor of this type returns GNSS data. Include latitude, longitude,
|
||||
* altitude, horizontal position accuracy, vertical position accuracy,
|
||||
* horizontal dilution of precision, vertical dilution of precision...
|
||||
*/
|
||||
|
||||
#define SENSOR_TYPE_GNSS 33
|
||||
|
||||
/* Sensor of GNSS satellite
|
||||
* A sensor of this type returns the GNSS satellite information.
|
||||
*/
|
||||
|
||||
#define SENSOR_TYPE_GNSS_SATELLITE 34
|
||||
|
||||
/* The total number of sensor */
|
||||
|
||||
@@ -314,9 +314,9 @@
|
||||
#define SENSOR_REMOTE (1u << 31)
|
||||
#define SENSOR_PERSIST (1u << 30)
|
||||
|
||||
/* GPS satellite info slots */
|
||||
/* GNSS satellite info slots */
|
||||
|
||||
#define SENSOR_GPS_SAT_INFO_MAX 4
|
||||
#define SENSOR_GNSS_SAT_INFO_MAX 4
|
||||
|
||||
/* Maximum length of sensor device information name and path name. */
|
||||
|
||||
@@ -415,40 +415,6 @@ struct sensor_ir /* Type: Infrared Ray */
|
||||
float ir; /* in SI units lux */
|
||||
};
|
||||
|
||||
struct sensor_gps /* Type: Gps */
|
||||
{
|
||||
uint64_t timestamp; /* Time since system start, Units is microseconds */
|
||||
|
||||
/* This is the timestamp which comes from the gps module. It might be
|
||||
* unavailable right after cold start, indicated by a value of 0,
|
||||
* Units is microseconds
|
||||
*/
|
||||
|
||||
uint64_t time_utc;
|
||||
|
||||
float latitude; /* Unit is degrees */
|
||||
float longitude; /* Unit is degrees */
|
||||
float altitude; /* Altitude above MSL(mean seal level), Unit is SI m */
|
||||
float altitude_ellipsoid; /* Altitude bove Ellipsoid, Unit is SI m */
|
||||
|
||||
float eph; /* GPS horizontal position accuracy (metres) */
|
||||
float epv; /* GPS vertical position accuracy (metres) */
|
||||
|
||||
float hdop; /* Horizontal dilution of precision */
|
||||
float pdop; /* Position dilution of precision */
|
||||
float vdop; /* Vertical dilution of precision */
|
||||
|
||||
float ground_speed; /* GPS ground speed, Unit is m/s */
|
||||
|
||||
/* Course over ground (NOT heading, but direction of movement),
|
||||
* Unit is Si degrees
|
||||
*/
|
||||
|
||||
float course;
|
||||
|
||||
uint32_t satellites_used; /* Number of satellites used */
|
||||
};
|
||||
|
||||
struct sensor_uv /* Type: Ultraviolet Light */
|
||||
{
|
||||
uint64_t timestamp; /* Units is microseconds */
|
||||
@@ -558,7 +524,41 @@ struct sensor_ots /* Type: OTS */
|
||||
int32_t y; /* Axis Y in counts */
|
||||
};
|
||||
|
||||
struct sensor_gps_satellite
|
||||
struct sensor_gnss /* Type: GNSS */
|
||||
{
|
||||
uint64_t timestamp; /* Time since system start, Units is microseconds */
|
||||
|
||||
/* This is the timestamp which comes from the GNSS module. It might be
|
||||
* unavailable right after cold start, indicated by a value of 0,
|
||||
* Units is microseconds
|
||||
*/
|
||||
|
||||
uint64_t time_utc;
|
||||
|
||||
float latitude; /* Unit is degrees */
|
||||
float longitude; /* Unit is degrees */
|
||||
float altitude; /* Altitude above MSL(mean seal level), Unit is SI m */
|
||||
float altitude_ellipsoid; /* Altitude bove Ellipsoid, Unit is SI m */
|
||||
|
||||
float eph; /* GNSS horizontal position accuracy (metres) */
|
||||
float epv; /* GNSS vertical position accuracy (metres) */
|
||||
|
||||
float hdop; /* Horizontal dilution of precision */
|
||||
float pdop; /* Position dilution of precision */
|
||||
float vdop; /* Vertical dilution of precision */
|
||||
|
||||
float ground_speed; /* GNSS ground speed, Unit is m/s */
|
||||
|
||||
/* Course over ground (NOT heading, but direction of movement),
|
||||
* Unit is Si degrees
|
||||
*/
|
||||
|
||||
float course;
|
||||
|
||||
uint32_t satellites_used; /* Number of satellites used */
|
||||
};
|
||||
|
||||
struct sensor_gnss_satellite
|
||||
{
|
||||
uint64_t timestamp; /* Time since system start, Units is microseconds */
|
||||
uint32_t count; /* Total number of messages of satellites visible */
|
||||
@@ -584,7 +584,7 @@ struct sensor_gps_satellite
|
||||
|
||||
uint32_t snr;
|
||||
}
|
||||
info[SENSOR_GPS_SAT_INFO_MAX];
|
||||
info[SENSOR_GNSS_SAT_INFO_MAX];
|
||||
};
|
||||
|
||||
struct sensor_wake_gesture /* Type: Wake gesture */
|
||||
|
||||
+1
-1
@@ -31,6 +31,6 @@ source "libs/libc/builtin/Kconfig"
|
||||
source "libs/libc/symtab/Kconfig"
|
||||
source "libs/libc/stream/Kconfig"
|
||||
source "libs/libc/regex/Kconfig"
|
||||
source "libs/libc/gpsutils/Kconfig"
|
||||
source "libs/libc/gnssutils/Kconfig"
|
||||
source "libs/libc/fdt/Kconfig"
|
||||
source "libs/libc/queue/Kconfig"
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ include eventfd/Make.defs
|
||||
include fixedmath/Make.defs
|
||||
include gdbstub/Make.defs
|
||||
include grp/Make.defs
|
||||
include gpsutils/Make.defs
|
||||
include gnssutils/Make.defs
|
||||
include hex2bin/Make.defs
|
||||
include inttypes/Make.defs
|
||||
include libgen/Make.defs
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# ##############################################################################
|
||||
# libs/libc/gpsutils/CMakeLists.txt
|
||||
# libs/libc/gnssutils/CMakeLists.txt
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more contributor
|
||||
# license agreements. See the NOTICE file distributed with this work for
|
||||
@@ -17,7 +17,7 @@
|
||||
# the License.
|
||||
#
|
||||
# ##############################################################################
|
||||
if(CONFIG_GPSUTILS_MINMEA_LIB)
|
||||
if(CONFIG_GNSSUTILS_MINMEA_LIB)
|
||||
|
||||
if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/minmea)
|
||||
|
||||
@@ -30,7 +30,7 @@ if(CONFIG_GPSUTILS_MINMEA_LIB)
|
||||
SOURCE_DIR
|
||||
${CMAKE_CURRENT_LIST_DIR}/minmea
|
||||
BINARY_DIR
|
||||
${CMAKE_BINARY_DIR}/libs/libc/gpsutils/minmea
|
||||
${CMAKE_BINARY_DIR}/libs/libc/gnssutils/minmea
|
||||
CONFIGURE_COMMAND
|
||||
""
|
||||
BUILD_COMMAND
|
||||
@@ -3,7 +3,7 @@
|
||||
# see the file kconfig-language.txt in the NuttX tools repository.
|
||||
#
|
||||
|
||||
config GPSUTILS_MINMEA_LIB
|
||||
config GNSSUTILS_MINMEA_LIB
|
||||
bool "MINMEA NMEA Library"
|
||||
default n
|
||||
---help---
|
||||
@@ -1,5 +1,5 @@
|
||||
############################################################################
|
||||
# libs/libc/gpsutils/Make.defs
|
||||
# libs/libc/gnssutils/Make.defs
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
@@ -18,12 +18,12 @@
|
||||
#
|
||||
############################################################################
|
||||
|
||||
ifneq ($(CONFIG_GPSUTILS_MINMEA_LIB),)
|
||||
ifneq ($(CONFIG_GNSSUTILS_MINMEA_LIB),)
|
||||
|
||||
MINMEA_URL ?= "https://github.com/kosma/minmea/archive"
|
||||
MINMEA_VERSION ?= db46128e73cee26d6a6eb0482dcba544ee1ea9f5
|
||||
|
||||
MINMEA_UNPACKNAME = gpsutils/minmea
|
||||
MINMEA_UNPACKNAME = gnssutils/minmea
|
||||
|
||||
$(MINMEA_UNPACKNAME):
|
||||
@echo "Downloading: $(MINMEA_UNPACKNAME)"
|
||||
@@ -32,7 +32,7 @@ $(MINMEA_UNPACKNAME):
|
||||
$(Q) unzip -o -j $(MINMEA_VERSION).zip -d $(MINMEA_UNPACKNAME)
|
||||
$(call DELFILE, $(MINMEA_VERSION).zip)
|
||||
$(Q) mkdir -p $(TOPDIR)$(DELIM)include$(DELIM)minmea$(DELIM)
|
||||
$(Q) cp gpsutils/minmea/minmea.h $(TOPDIR)$(DELIM)include$(DELIM)minmea$(DELIM)
|
||||
$(Q) cp gnssutils/minmea/minmea.h $(TOPDIR)$(DELIM)include$(DELIM)minmea$(DELIM)
|
||||
|
||||
# Files
|
||||
|
||||
@@ -52,12 +52,12 @@ distclean::
|
||||
else
|
||||
context::
|
||||
$(Q) mkdir -p $(TOPDIR)$(DELIM)include$(DELIM)minmea$(DELIM)
|
||||
$(Q) cp gpsutils/minmea/minmea.h $(TOPDIR)$(DELIM)include$(DELIM)minmea$(DELIM)
|
||||
$(Q) cp gnssutils/minmea/minmea.h $(TOPDIR)$(DELIM)include$(DELIM)minmea$(DELIM)
|
||||
|
||||
distclean::
|
||||
$(call DELDIR, $(TOPDIR)$(DELIM)include$(DELIM)minmea$(DELIM))
|
||||
endif
|
||||
|
||||
DEPPATH += --dep-path gpsutils/minmea
|
||||
VPATH += :gpsutils/minmea
|
||||
DEPPATH += --dep-path gnssutils/minmea
|
||||
VPATH += :gnssutils/minmea
|
||||
endif
|
||||
Reference in New Issue
Block a user