Adafruit_GPS Class

Adafruit_GPS Class

Description
A class used to configure GPS module settings on Ameba.

Syntax
class Adafruit_GPS

Members

Public Constructors 
Adafruit_GPS::Adafruit_GPSConstructs an Adafruit_GPS object.
Public Methods 
Adafruit_GPS::beginInitialize serial communication.
*Adafruit_GPS::lastNMEAGet the last National Marine Electronics Association (NMEA) line received and set the received flag to false.
Adafruit_GPS::newNMEAreceivedCheck to see if a new NMEA line has been received.
Adafruit_GPS::common_initInitialization code used by all constructor types.
Adafruit_GPS::sendCommandSend a command to the GPS device.
Adafruit_GPS::pausePause/ resume receiving new data.
Adafruit_GPS::parseHexRead a Hexadecimal value and convert into decimal value.
Adafruit_GPS::readRead one character from the GPS device.
Adafruit_GPS::parseParse data such as latitude, longitude, speed, angle, etc.
Adafruit_GPS::wakeupWake the sensor up.
Adafruit_GPS::standbyStandby mode switches.
Adafruit_GPS::waitForSentenceWait for a specified sentence from the device.
Adafruit_GPS::LOCUS_StartLoggerStart the LOCUS logger.
Adafruit_GPS::LOCUS_StopLoggerStop the LOCUS logger.
Adafruit_GPS::LOCUS_ReadStatusRead the LOCUS logger status.

Adafruit_GPS::Adafruit_GPS

Description
Constructs an Adafruit_GPS object and initialize serial using a SoftwareSerial object.

Syntax
Adafruit_GPS(SoftwareSerial *ser);
Adafruit_GPS(HardwareSerial *ser);

Parameters
ser: a Serial instance.

Returns
NA

Example Code
Example: Adafruit_GPS_parsing
(https://github.com/ambiot/ambd_arduino/blob/dev/Arduino_package/hardware/libraries/SoftwareSerial/examples/Adafruit_GPS_parsing/Adafruit_GPS_parsing.ino)
This example code from Adafruit demonstrates GPS modules using MTK3329/MTK3339 driver. This code shows how to listen to the GPS module in an interrupt which allows the program to have more ‘freedom’ – just parse when a new NMEA sentence is available! Then access data when desired.

Notes and Warnings
IMPORTANT: SoftSerial is using hardware serial so pin mapping cannot be altered.
“Adafruit_GPS.h” must be included to use the class function.

Adafruit_GPS::begin

Description
Initialize baud rate for gps serial communication.

Syntax
void begin(uint16_t baud);

Parameters
Initialize baud rate for gps serial communication.

Returns
NA

Example Code
Example: Adafruit_GPS_parsing
(https://github.com/ambiot/ambd_arduino/blob/dev/Arduino_package/hardware/libraries/SoftwareSerial/examples/Adafruit_GPS_parsing/Adafruit_GPS_parsing.ino)

Notes and Warnings
“Adafruit_GPS.h” must be included to use the class function.

*Adafruit_GPS::lastNMEA

Description
Get the last National Marine Electronics Association (NMEA) line received and set the received flag to false.

Syntax
char *lastNMEA(void);

Parameters
NA

Returns
This function returns a pointer to the last line of the string.

Example Code
Example: Adafruit_GPS_parsing
(https://github.com/ambiot/ambd_arduino/blob/dev/Arduino_package/hardware/libraries/SoftwareSerial/examples/Adafruit_GPS_parsing/Adafruit_GPS_parsing.ino)

Notes and Warnings
“Adafruit_GPS.h” must be included to use the class function.

Adafruit_GPS::newNMEAreceived

Description
Check if a new NMEA line has been received.

Syntax
boolean newNMEAreceived(void);

Parameters
NA

Returns
This function returns “true” if a new NMEA line has been received. Otherwise, returns “false”.

Example Code
Example: Adafruit_GPS_parsing
(https://github.com/ambiot/ambd_arduino/blob/dev/Arduino_package/hardware/libraries/SoftwareSerial/examples/Adafruit_GPS_parsing/Adafruit_GPS_parsing.ino)

Notes and Warnings
“Adafruit_GPS.h” must be included to use the class function.

Adafruit_GPS::common_init

Description
Initialization code used by all constructor types.

Syntax
void common_init(void);

Parameters
NA

Returns
NA

Example Code
NA

Notes and Warnings
“Adafruit_GPS.h” must be included to use the class function.

Adafruit_GPS::sendCommand

Description
Send a command to the GPS device via GPS serial communication.

Syntax
void sendCommand(const char *str);

Parameters
str: Pointer to a string holding the command to send.

Returns
NA

Example Code
Example: Adafruit_GPS_parsing
(https://github.com/ambiot/ambd_arduino/blob/dev/Arduino_package/hardware/libraries/SoftwareSerial/examples/Adafruit_GPS_parsing/Adafruit_GPS_parsing.ino)

Notes and Warnings
“Adafruit_GPS.h” must be included to use the class function.

Adafruit_GPS::pause

Description
Pause/ resume receiving new data.

Syntax
void pause(boolean p);

Parameters
p: True = pause, False = resume.

Returns
NA

Example Code
NA

Notes and Warnings
“Adafruit_GPS.h” must be included to use the class function.

Adafruit_GPS::parseHex

Description
Read a Hexadecimal value and convert into a decimal value.

Syntax
uint8_t parseHex(char c);

Parameters
c: Hexadecimal value

Returns
This function returns the decimal equivalent of the Hexadecimal value.

Example Code
NA

Notes and Warnings
“Adafruit_GPS.h” must be included to use the class function.

Adafruit_GPS::read

Description
Read one character from the GPS device.

Syntax
char read(void);

Parameters
NA

Returns
The function returns the character that we received or returns 0 if nothing was received.

Example Code
Example: Adafruit_GPS_parsing
(https://github.com/ambiot/ambd_arduino/blob/dev/Arduino_package/hardware/libraries/SoftwareSerial/examples/Adafruit_GPS_parsing/Adafruit_GPS_parsing.ino)

Notes and Warnings
“Adafruit_GPS.h” must be included to use the class function.

Adafruit_GPS::parse

Description
Parse data such as latitude, longitude, speed, angle, etc.

Syntax
boolean parse(char *nmea);

Parameters
nmea: an NMEA string

Returns
This function returns “true” if there are valid data to be parsed, “false” if it has invalid data.

Example Code
Example: Adafruit_GPS_parsing
(https://github.com/ambiot/ambd_arduino/blob/dev/Arduino_package/hardware/libraries/SoftwareSerial/examples/Adafruit_GPS_parsing/Adafruit_GPS_parsing.ino)

Notes and Warnings
“Adafruit_GPS.h” must be included to use the class function.

Adafruit_GPS::wakeup

Description
Wake the sensor by disabling the GPS sensor stand by mode.

Syntax
boolean wakeup(void);

Parameters
NA

Returns
This function returns “true” if the sensor is awake, otherwise return “false” if the sensor is not on standby or failed to wake.

Example Code
NA

Notes and Warnings
“Adafruit_GPS.h” must be included to use the class function.

Adafruit_GPS::standby

Description
Standby mode switches.

Syntax
boolean standby(void);

Parameters
NA

Returns
This function returns “false” if it is already in standby mode so that no commands need to be sent to the GPS to wake it up. Otherwise, returns “true” if it entered standby mode.

Example Code
NA

Notes and Warnings
“Adafruit_GPS.h” must be included to use the class function.

Adafruit_GPS::waitForSentence

Description
Wait for a specified NEMA sentence from the device.

Syntax
boolean waitForSentence(const char *wait4me, uint8_t max);

Parameters
wait4me: Pointer to a string holding the desired response.
max: maximum duration to wait for the sentence, default value: 5.

Returns
This function returns “true” if we the sentence is received, otherwise returns “false”.

Example Code
NA

Notes and Warnings
“Adafruit_GPS.h” must be included to use the class function.

Adafruit_GPS::LOCUS_StartLogger

Description
Start the LOCUS logger.

Syntax
boolean LOCUS_StartLogger(void);

Parameters
NA

Returns
This function returns “true” if the logger starts successfully. Otherwise, returns “false”.

Example Code
NA

Notes and Warnings
“Adafruit_GPS.h” must be included to use the class function.

Adafruit_GPS::LOCUS_StopLogger

Description
Stop the LOCUS logger.

Syntax
boolean LOCUS_StopLogger(void);

Parameters
NA

Returns
This function returns “true” if the logger stops successfully. Otherwise, returns “false”.

Example Code
NA

Notes and Warnings
“Adafruit_GPS.h” must be included to use the class function.

Adafruit_GPS::LOCUS_ReadStatus

Description
Read the LOCUS logger status

Syntax
boolean LOCUS_ReadStatus(void);

Parameters
NA

Returns
This function returns “true” if the logger reads the status successfully. Otherwise, returns “false” if there was no response.

Example Code
NA

Notes and Warnings
“Adafruit_GPS.h” must be included to use the class function.

Please confirm that QQ communication software is installed