Skip to content

jmcglad/libgps

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GPS Library

A small GPS library written in C and designed for use in embedded systems. The goal of this project is to produce a minimal library for both decoding and encoding NMEA strings quickly on systems which lack a floating point coprocessor. This library was also designed to be fast and safe. It's fast in the sense that the decoder functions try and execute as few instructions as possible when parsing a NMEA sentence. It's safe in the sense that all received input is validated against some hard-coded regular expressions.

Features

Here are the major features which this library provides.

Decoder

The decoder is the main feature of this library. It takes in a complete NMEA sentence (dollar sign, checksum, CRLF, and all) and decodes the sentence into a time-position-velocity record. You may then check to see if the values stored are valid and, if they are, you may proceed to make use of the data.

Encoder

This is a utility function. Use it to compose commands intended for sending to a GPS device as valid NMEA sentences.

Installation

This library is composed of only two files: gps.c and gps.h. Feel free to copy those source files directly into your project.

For users who want to generate a static or shared libgps library, API documentation, example programs, or unit tests, then use CMake. The following Boolean variables can be switched on or off in order to control what gets built.

  • BUILD_EXAMPLES
  • BUILD_DOCUMENTATION
  • BUILD_UNIT_TESTS
  • BUILD_STATIC_LIB

Note, building the documentation requires Doxygen and building the unit tests requires cmocka.

Simple API

The entire public API is made up of only four functions. Please refer to the Doxygen documentation for more detailed information on how to use the API.

  • gps_init_tpv()
  • gps_encode()
  • gps_decode()
  • gps_error_string()

Embedded System Notes

This code was written with embedded systems in mind. There is no use of dynamic memory (i.e. malloc) in this library. The only external dependancy which this library has is on the C standard library. All real number data values stored in this library are scaled up by some factor to maintain a certain level of accuracy. This way, the use of floating point data types is avoided.

About

A small GPS library designed for use in embedded systems

Topics

Resources

License

Stars

11 stars

Watchers

3 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors