Skip to content

Commit

Permalink
nrf91: Update GPS to GNSS
Browse files Browse the repository at this point in the history
Related: 03f4ec7

Signed-off-by: wangjianyu3 <[email protected]>
  • Loading branch information
JianyuWang0623 committed Sep 20, 2024
1 parent e627850 commit 88e6e05
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion arch/arm/src/nrf91/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ config NRF91_MODEM_NBIOT

config NRF91_MODEM_GNSS
bool "Modem GNSS support"
depends on SENSORS_GPS
depends on SENSORS_GNSS
default y

config NRF91_MODEM_PREFERENCE
Expand Down
54 changes: 27 additions & 27 deletions arch/arm/src/nrf91/nrf91_modem_gnss.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include <string.h>
#include <time.h>

#include <nuttx/sensors/gps.h>
#include <nuttx/sensors/gnss.h>
#include <nuttx/sensors/sensor.h>

#include "nrf_modem.h"
Expand All @@ -42,8 +42,8 @@
* Pre-processor Definitions
****************************************************************************/

#ifndef CONFIG_SENSORS_GPS
# error nRF91 GNSS driver needs CONFIG_SENSORS_GPS
#ifndef CONFIG_SENSORS_GNSS
# error nRF91 GNSS driver needs CONFIG_SENSORS_GNSS
#endif

/* NMEA and AGPS not supported yet */
Expand Down Expand Up @@ -79,7 +79,7 @@ struct nrf91_gnss_s
{
/* lower must be first element */

struct gps_lowerhalf_s lower;
struct gnss_lowerhalf_s lower;
bool running;
bool singlefix;
int notime_cntr;
Expand Down Expand Up @@ -111,15 +111,15 @@ struct nrf91_gnss_s

/* GPS operations */

static int nrf91_gnss_activate(struct gps_lowerhalf_s *lower,
static int nrf91_gnss_activate(struct gnss_lowerhalf_s *lower,
struct file *filep, bool enable);
static int nrf91_gnss_set_interval(struct gps_lowerhalf_s *lower,
static int nrf91_gnss_set_interval(struct gnss_lowerhalf_s *lower,
struct file *filep,
unsigned long *period_us);
static int nrf91_gnss_control(struct gps_lowerhalf_s *lower,
static int nrf91_gnss_control(struct gnss_lowerhalf_s *lower,
struct file *filep,
int cmd, unsigned long arg);
static ssize_t nrf91_gnss_inject_data(struct gps_lowerhalf_s *lower,
static ssize_t nrf91_gnss_inject_data(struct gnss_lowerhalf_s *lower,
struct file *filep,
const void *buffer, size_t buflen);

Expand All @@ -139,7 +139,7 @@ static int nrf91_gnss_thread(int argc, char** argv);
* Private Data
****************************************************************************/

static const struct gps_ops_s g_nrf91_gnss_ops =
static const struct gnss_ops_s g_nrf91_gnss_ops =
{
.activate = nrf91_gnss_activate,
.set_interval = nrf91_gnss_set_interval,
Expand Down Expand Up @@ -268,7 +268,7 @@ static int nrf91_gnss_enable(struct nrf91_gnss_s *priv, bool enable)
* Name: nrf91_gnss_activate
****************************************************************************/

static int nrf91_gnss_activate(struct gps_lowerhalf_s *lower,
static int nrf91_gnss_activate(struct gnss_lowerhalf_s *lower,
struct file *filep, bool enable)
{
struct nrf91_gnss_s *priv = (struct nrf91_gnss_s *)lower;
Expand All @@ -280,7 +280,7 @@ static int nrf91_gnss_activate(struct gps_lowerhalf_s *lower,
* Name: nrf91_gnss_set_interval
****************************************************************************/

static int nrf91_gnss_set_interval(struct gps_lowerhalf_s *lower,
static int nrf91_gnss_set_interval(struct gnss_lowerhalf_s *lower,
struct file *filep,
unsigned long *period_us)
{
Expand Down Expand Up @@ -345,7 +345,7 @@ static int nrf91_gnss_set_interval(struct gps_lowerhalf_s *lower,
* Name: nrf91_gnss_control
****************************************************************************/

static int nrf91_gnss_control(struct gps_lowerhalf_s *lower,
static int nrf91_gnss_control(struct gnss_lowerhalf_s *lower,
struct file *filep,
int cmd, unsigned long arg)
{
Expand All @@ -358,7 +358,7 @@ static int nrf91_gnss_control(struct gps_lowerhalf_s *lower,
* Name: nrf91_gnss_inject_data
****************************************************************************/

static ssize_t nrf91_gnss_inject_data(struct gps_lowerhalf_s *lower,
static ssize_t nrf91_gnss_inject_data(struct gnss_lowerhalf_s *lower,
struct file *filep,
const void *buffer, size_t buflen)
{
Expand Down Expand Up @@ -400,14 +400,14 @@ static void nrf91_gnss_boost_prio(struct nrf91_gnss_s *priv)

static void nrf91_gnss_pvt_event(struct nrf91_gnss_s *priv)
{
struct sensor_gps gps;
struct sensor_gps_satellite sat;
struct tm tm;
uint64_t timestamp;
int i = 0;
int j = 0;
int sv = 0;
int used = 0;
struct sensor_gnss gps;
struct sensor_gnss_satellite sat;
struct tm tm;
uint64_t timestamp;
int i = 0;
int j = 0;
int sv = 0;
int used = 0;

timestamp = sensor_get_timestamp();

Expand All @@ -417,7 +417,7 @@ static void nrf91_gnss_pvt_event(struct nrf91_gnss_s *priv)
{
sv += 1;

if (j < SENSOR_GPS_SAT_INFO_MAX)
if (j < SENSOR_GNSS_SAT_INFO_MAX)
{
sat.info[j].svid = priv->pvt.sv[i].sv;
sat.info[j].elevation = priv->pvt.sv[i].elevation;
Expand Down Expand Up @@ -445,8 +445,8 @@ static void nrf91_gnss_pvt_event(struct nrf91_gnss_s *priv)

priv->lower.push_event(priv->lower.priv,
&sat,
sizeof(struct sensor_gps_satellite),
SENSOR_TYPE_GPS_SATELLITE);
sizeof(struct sensor_gnss_satellite),
SENSOR_TYPE_GNSS_SATELLITE);
}

if (priv->pvt.flags & NRF_MODEM_GNSS_PVT_FLAG_FIX_VALID)
Expand Down Expand Up @@ -480,8 +480,8 @@ static void nrf91_gnss_pvt_event(struct nrf91_gnss_s *priv)

priv->lower.push_event(priv->lower.priv,
&gps,
sizeof(struct sensor_gps),
SENSOR_TYPE_GPS);
sizeof(struct sensor_gnss),
SENSOR_TYPE_GNSS);
}

if (priv->pvt.flags & NRF_MODEM_GNSS_PVT_FLAG_SLEEP_BETWEEN_PVT)
Expand Down Expand Up @@ -728,5 +728,5 @@ int nrf91_gnss_register(int devno, uint32_t batch_number)

g_nrf91_gnss.lower.ops = &g_nrf91_gnss_ops;

return gps_register(&g_nrf91_gnss.lower, devno, batch_number);
return gnss_register(&g_nrf91_gnss.lower, devno, batch_number);
}
2 changes: 1 addition & 1 deletion boards/arm/nrf91/nrf9160-dk/configs/modem_ns/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ CONFIG_RR_INTERVAL=200
CONFIG_SCHED_LPWORK=y
CONFIG_SCHED_WAITPID=y
CONFIG_SENSORS=y
CONFIG_SENSORS_GPS=y
CONFIG_SENSORS_GNSS=y
CONFIG_STACK_COLORATION=y
CONFIG_STACK_USAGE=y
CONFIG_START_DAY=26
Expand Down

0 comments on commit 88e6e05

Please sign in to comment.