Skip to content

Commit

Permalink
GNSS: Support setInterval cycle of less than 1 second
Browse files Browse the repository at this point in the history
Add setInterval method to support cycles of less than 1 second.
The cycle can select from SpIntervalFreq enumeration type.
  • Loading branch information
SPRESENSE committed Jun 26, 2023
1 parent e7569e5 commit 10d5965
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,33 @@ int SpGnss::setInterval(long interval)
return ret;
}

/**
* @brief Set the pos interval time
* @details Set interval of POS operation.
* @param [in] Interval time[sec]
* @return 0 if success, -1 if failure
*/
int SpGnss::setInterval(SpIntervalFreq interval)
{
int ret;
struct cxd56_gnss_ope_mode_param_s setdata;

/* Set parameter. */

setdata.mode = 1;
setdata.cycle = (uint32_t)interval;

/* Call ioctl. */

ret = ioctl(fd_, CXD56_GNSS_IOCTL_SET_OPE_MODE, (unsigned long)&setdata);
if (ret < OK)
{
PRINT_E("SpGnss E: Failed to set Interval\n");
}

return ret;
}

/**
* @brief Returns whether the specified satellite system is selecting
* @return 1 use, 0 unuse
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,19 @@ enum SpSatelliteType {
UNKNOWN = 0,
};

/**
* @enum SpIntervalFreq
* @brief Interval frequency
*/
enum SpIntervalFreq {
SpInterval_10Hz = 100,
SpInterval_8Hz = 125,
SpInterval_5Hz = 200,
SpInterval_4Hz = 250,
SpInterval_2Hz = 500,
SpInterval_1Hz = 1000,
};

/**
* @class SpGnssTime
* @brief Time acquired from the satellite at the time of positioning
Expand Down Expand Up @@ -358,6 +371,14 @@ class SpGnss
*/
int setInterval(long interval = 1);

/**
* @brief Set the pos interval time
* @details Set interval of POS operation.
* @param [in] interval Interval frequency
* @return 0 if success, -1 if failure
*/
int setInterval(SpIntervalFreq interval);

/**
* @brief Returns whether the specified satellite system is selecting
* @details Returns whether satellite system specified as argument is
Expand Down

0 comments on commit 10d5965

Please sign in to comment.