Skip to content

Commit

Permalink
Make minmea_isfield public.
Browse files Browse the repository at this point in the history
This function is useful when writing libraries that use minmea and support NMEA
as well as other sentence types.
  • Loading branch information
ssloboda authored and kosma committed Aug 5, 2022
1 parent 0a0a14a commit 85439b9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
5 changes: 0 additions & 5 deletions minmea.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdarg.h>

#define boolstr(s) ((s) ? "true" : "false")
Expand Down Expand Up @@ -85,10 +84,6 @@ bool minmea_check(const char *sentence, bool strict)
return true;
}

static inline bool minmea_isfield(char c) {
return isprint((unsigned char) c) && c != ',' && c != '*';
}

bool minmea_scan(const char *sentence, const char *format, ...)
{
bool result = false;
Expand Down
9 changes: 9 additions & 0 deletions minmea.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
extern "C" {
#endif

#include <ctype.h>
#include <stdint.h>
#include <stdbool.h>
#include <time.h>
Expand Down Expand Up @@ -277,6 +278,14 @@ static inline float minmea_tocoord(const struct minmea_float *f)
return (float) degrees + (float) minutes / (60 * f->scale);
}

/**
* Check whether a character belongs to the set of characters allowed in a
* sentence data field.
*/
static inline bool minmea_isfield(char c) {
return isprint((unsigned char) c) && c != ',' && c != '*';
}

#ifdef __cplusplus
}
#endif
Expand Down

0 comments on commit 85439b9

Please sign in to comment.