A driver for the MAX8U GPS by uBlox. Provides core functionality. Communicates through I2C.

Embed: (wiki syntax)

« Back to documentation index

MAX8U Class Reference

Class to use the MAX8U. More...

#include <MAX8U.h>

Data Structures

struct  SatelliteInfo
 Info about each sattelite, obtained from getSatelliteInfo() More...

Public Types

enum  GPSFix
 

U-Blox GPS Fix Values.

More...
enum  GNSSID
 

U-Blox GNSS identifier.

More...
enum  AntennaPowerStatus
 

Used for AntennaPowerStatus, in the UBX_MON_HW message.

More...

Public Member Functions

 MAX8U (Serial *debugPort, PinName user_SDApin, PinName user_SCLpin, PinName user_RSTPin, uint8_t i2cAddress=MAX8U_I2C_DEF_ADDRESS, int i2cPortSpeed=100000)
 Construct a MAX8U, providing pins and parameters.
bool begin ()
 resets the GPS.
char const * getLastMessageBuffer ()
 Get the last message recieved from the GPS.
bool update ()
 If there is data to be read, then the function will read all queued data.
bool configure ()
 Configure the GPS with the appropriate communications and message settings for this driver.
AntennaPowerStatus antennaPowerStatus ()
 Receives a single MON_HW message and returns the power status.
void readGNSSConfig ()
 Reads and prints the current enabled GNSS Constellations and prints out the IDS for them.
ssize_t readSatelliteInfo (SatelliteInfo *satelliteInfos, size_t infoLen)
 Reads information from the GPS about all the satellites it can see and fills it into the given array.
bool configureTimePulse (bool enabled, uint8_t timepulseId, uint32_t freq, uint32_t pulseLenRatio)
 Configures the time pulse.

Data Fields

double latitude = 0
 Current latitude in decimal degrees.
double longitude = 0
 Current longitude in decimal degrees.
float height = 0
 Current height above earths surface (above ellipsoid) in meters.
GPSFix fixQuality = GPSFix::NONE
 Quality of the current fix.
float posAccuracy = 0
 Estimate of the accuracy of the current position in meters.
uint8_t numSatellites = 0
 current number of sats used for navigation
int32_t northVel = 0
 North Velocity Solution in NED, units: cm/s.
int32_t eastVel = 0
 East Velocity Solution in NED, units: cm/s.
int32_t downVel = 0
 Down Velocity Solution in NED, units: cm/s.
uint32_t speed3D = 0
 3D Speed Solution in NED, units: cm/s
uint8_t month
 Month: time as of the last message.
uint8_t day
 Day: time as of the last message.
uint8_t hour
 Hour: time as of the last message.
uint8_t minute
 Minute: time as of the last message.
uint8_t second
 Second: time as of the last message.
uint16_t year
 Year: time as of the last message.
bool isNMEASentence
 is true, if the last msg was following the NMEA protocol, otherwise UBX

Detailed Description

Class to use the MAX8U.

Definition at line 14 of file MAX8U.h.


Member Enumeration Documentation

Used for AntennaPowerStatus, in the UBX_MON_HW message.

Definition at line 48 of file MAX8U.h.

enum GNSSID

U-Blox GNSS identifier.

Definition at line 34 of file MAX8U.h.

enum GPSFix

U-Blox GPS Fix Values.

Definition at line 21 of file MAX8U.h.


Constructor & Destructor Documentation

MAX8U ( Serial *  debugPort,
PinName  user_SDApin,
PinName  user_SCLpin,
PinName  user_RSTPin,
uint8_t  i2cAddress = MAX8U_I2C_DEF_ADDRESS,
int  i2cPortSpeed = 100000 
)

Construct a MAX8U, providing pins and parameters.

This doesn't actually initialize the chip, you will need to call begin() for that.

Parameters:
debugPortDebugPort used to output debug information. Pass nullpntr otherwise.
user_SDApinHardware I2C SDA pin connected to the MAX8
user_SCLpinHardware I2C SCL pin connected to the MAX8
user_RSTPinOutput pin connected to NRST
i2cAddressI2C address. The MAX8 defaults to 0x42
i2cPortSpeedI2C frequency.

Definition at line 24 of file MAX8U.cpp.


Member Function Documentation

MAX8U::AntennaPowerStatus antennaPowerStatus (  )

Receives a single MON_HW message and returns the power status.

Returns:
the status of the power of the antenna

Definition at line 135 of file MAX8U.cpp.

bool begin (  )

resets the GPS.

Configures the basic i2c settings. TODO: Verifies that it's connected, and reads out its version

Returns:
whether or not initialization was successful

Definition at line 45 of file MAX8U.cpp.

bool configure (  )

Configure the GPS with the appropriate communications and message settings for this driver.

Unless the driver has changed, you only need to call this once for each new GPS (the config will be saved on the GPS)

Returns:

Definition at line 84 of file MAX8U.cpp.

bool configureTimePulse ( bool  enabled,
uint8_t  timepulseId,
uint32_t  freq,
uint32_t  pulseLenRatio 
)

Configures the time pulse.

If enabled, it will send a pulse at the frequncy

Parameters:
timepulseId,0= timepulse, 1 = timepulse2
pulseLenRatioduty cycle.
Returns:
char const* getLastMessageBuffer (  )

Get the last message recieved from the GPS.

Could be binary or a string depending on the protocol in use.

Returns:

Definition at line 219 of file MAX8U.h.

void readGNSSConfig (  )

Reads and prints the current enabled GNSS Constellations and prints out the IDS for them.

Definition at line 526 of file MAX8U.cpp.

ssize_t readSatelliteInfo ( MAX8U::SatelliteInfo satelliteInfos,
size_t  infoLen 
)

Reads information from the GPS about all the satellites it can see and fills it into the given array.

Parameters:
satelliteInfosArray of SatelliteInfos that the caller allocates.
infoLenLength of the info struct array.
Returns:
The number of satellites the GPS returned info about. If negative, there was an error. If <= the size of the array, then it's the number of valid array entries. If greater than the size of the array, then the max number of array elements were filled in.

Definition at line 148 of file MAX8U.cpp.

bool update (  )

If there is data to be read, then the function will read all queued data.

New data will be store in buffer array

Returns:
true if got new data, false if there was an error or stream was empty

Definition at line 69 of file MAX8U.cpp.


Field Documentation

uint8_t day

Day: time as of the last message.

Definition at line 171 of file MAX8U.h.

int32_t downVel = 0

Down Velocity Solution in NED, units: cm/s.

Definition at line 160 of file MAX8U.h.

int32_t eastVel = 0

East Velocity Solution in NED, units: cm/s.

Definition at line 157 of file MAX8U.h.

GPSFix fixQuality = GPSFix::NONE

Quality of the current fix.

Definition at line 143 of file MAX8U.h.

float height = 0

Current height above earths surface (above ellipsoid) in meters.

Definition at line 140 of file MAX8U.h.

uint8_t hour

Hour: time as of the last message.

Definition at line 174 of file MAX8U.h.

is true, if the last msg was following the NMEA protocol, otherwise UBX

Definition at line 186 of file MAX8U.h.

double latitude = 0

Current latitude in decimal degrees.

Definition at line 134 of file MAX8U.h.

double longitude = 0

Current longitude in decimal degrees.

Definition at line 137 of file MAX8U.h.

uint8_t minute

Minute: time as of the last message.

Definition at line 177 of file MAX8U.h.

uint8_t month

Month: time as of the last message.

Definition at line 168 of file MAX8U.h.

int32_t northVel = 0

North Velocity Solution in NED, units: cm/s.

Definition at line 154 of file MAX8U.h.

uint8_t numSatellites = 0

current number of sats used for navigation

Definition at line 149 of file MAX8U.h.

float posAccuracy = 0

Estimate of the accuracy of the current position in meters.

Definition at line 146 of file MAX8U.h.

uint8_t second

Second: time as of the last message.

Definition at line 180 of file MAX8U.h.

uint32_t speed3D = 0

3D Speed Solution in NED, units: cm/s

Definition at line 163 of file MAX8U.h.

uint16_t year

Year: time as of the last message.

Definition at line 183 of file MAX8U.h.