Skip to content

Commit

Permalink
fix library
Browse files Browse the repository at this point in the history
  • Loading branch information
nomad605dis committed Apr 18, 2018
1 parent 00d64bc commit 6f41fa9
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 39 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
GPS/GLONASS (Troyka-модуль)
===========================

Библиотека для Arduino, позволяющая считывать данные с [GPS/GLONASS](http://amperka.ru/product/troyka-gps-glonass) модуля.
Библиотека для Arduino, позволяющая считывать данные с GPS/GLONASS модулей:
* [GPS/GLONASS модуль со встроенной антенной.](http://amperka.ru/product/troyka-gps-glonass)
* [GPS/GLONASS модуль с выносной антенной.](http://amperka.ru/product/troyka-gps-glonass-extended-reciver)

Установка библиотеки
====================
Expand Down
6 changes: 3 additions & 3 deletions library.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name=TroykaGPS
version=1.2
author=Igor Dementiev, Amperka
version=1.0.0
author=Igor Dementiev <igor@amperka.ru>
maintainer=Amperka <amperka.ru>
sentence=Allows you to read data from the GPS/GLONASS sensor module.
paragraph=The GPS/GLONASS sensor sends data to the control board in NMEA-message format. This library parses NMEA-messages and converts them into separate values.
category=Sensors
category=Communication
url=https://github.com/amperka/TroykaGPS
architectures=*
2 changes: 1 addition & 1 deletion src/TroykaGPS.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class GPS : public GPSNAME::UARTDevice
int8_t getMonth() const { return _month; }
uint16_t getYear() const { return _year; }

private:
private:
void setHeaderState(char c, int8_t* state, char* header);
void parsingGNGGA(char* gpsBuffer, char* sat, char* altitude);
void parsingGNRMC(char* gpsBuffer, char* connectSat, char* time, char* date, char* latitude, char* longitude, char* speed);
Expand Down
65 changes: 31 additions & 34 deletions src/utility/uartDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,41 @@
#include <Arduino.h>

// miliseconds
#define DEFAULT_TIMEOUT 1000
#define DEFAULT_TIMEOUT 1000
// miliseconds
#define DEFAULT_INTERCHAR_TIMEOUT 1000
#define DEFAULT_INTERCHAR_TIMEOUT 1000

// using namespace for GPS
namespace GPSNAME {

enum dataType {
CMD = 0,
DATA = 1,
};

// abstract base class
class UARTDevice
{
public:
UARTDevice(Stream* uartDevice);
virtual ~UARTDevice() = 0;
int uartDeviceAvailable();
int uartDeviceAvailable(int waitTime);
void uartDeviceFlushSerial();
int uartDeviceReadSerial();
void uartDeviceReadBuffer(char* buffer, int count, unsigned int timeout = DEFAULT_TIMEOUT, unsigned int charTimeout = DEFAULT_INTERCHAR_TIMEOUT);
void uartDeviceCleanBuffer(char* buffer, int count);
void uartDeviceSendByte(uint8_t data);
void uartDeviceSendChar(const char c);
void uartDeviceSendCMD(const char* cmd);
void uartDeviceSendCMD(const __FlashStringHelper* cmd);
void uartDeviceSendCMDP(const char* cmd);
void uartDeviceSendAT();
void uartDeviceSendEndMark();
bool uartDeviceWaitForResp(const char* resp, dataType type, unsigned int timeout = DEFAULT_TIMEOUT, unsigned int charTimeout = DEFAULT_INTERCHAR_TIMEOUT);
bool uartDeviceCheckWithCMD(const char* cmd, const char* resp, dataType type, unsigned int timeout = DEFAULT_TIMEOUT, unsigned int charTimeout = DEFAULT_INTERCHAR_TIMEOUT);
bool uartDeviceCheckWithCMD(const __FlashStringHelper* cmd, const char* resp, dataType type, unsigned int timeout = DEFAULT_TIMEOUT, unsigned int charTimeout = DEFAULT_INTERCHAR_TIMEOUT);
private:
Stream* _uartDevice;
};

enum dataType {
CMD = 0,
DATA = 1,
};
// abstract base class
class UARTDevice
{
public:
UARTDevice(Stream* uartDevice);
virtual ~UARTDevice() = 0;
int uartDeviceAvailable();
int uartDeviceAvailable(int waitTime);
void uartDeviceFlushSerial();
int uartDeviceReadSerial();
void uartDeviceReadBuffer(char* buffer, int count, unsigned int timeout = DEFAULT_TIMEOUT, unsigned int charTimeout = DEFAULT_INTERCHAR_TIMEOUT);
void uartDeviceCleanBuffer(char* buffer, int count);
void uartDeviceSendByte(uint8_t data);
void uartDeviceSendChar(const char c);
void uartDeviceSendCMD(const char* cmd);
void uartDeviceSendCMD(const __FlashStringHelper* cmd);
void uartDeviceSendCMDP(const char* cmd);
void uartDeviceSendAT();
void uartDeviceSendEndMark();
bool uartDeviceWaitForResp(const char* resp, dataType type, unsigned int timeout = DEFAULT_TIMEOUT, unsigned int charTimeout = DEFAULT_INTERCHAR_TIMEOUT);
bool uartDeviceCheckWithCMD(const char* cmd, const char* resp, dataType type, unsigned int timeout = DEFAULT_TIMEOUT, unsigned int charTimeout = DEFAULT_INTERCHAR_TIMEOUT);
bool uartDeviceCheckWithCMD(const __FlashStringHelper* cmd, const char* resp, dataType type, unsigned int timeout = DEFAULT_TIMEOUT, unsigned int charTimeout = DEFAULT_INTERCHAR_TIMEOUT);
private:
Stream* _uartDevice;
};
}

#endif

0 comments on commit 6f41fa9

Please sign in to comment.