http://www.rcgroups.com/forums/showthread.php?t=1995704
Use the following image to get GPS signal and supply:
Diff: NazaDecoderLib.h
- Revision:
- 1:4eadcb718c8b
- Parent:
- 0:b0ba4e08a18c
- Child:
- 2:de84f8a0a706
--- a/NazaDecoderLib.h Tue Nov 18 16:39:57 2014 +0000 +++ b/NazaDecoderLib.h Fri Nov 28 17:39:38 2014 +0000 @@ -4,49 +4,89 @@ Not for commercial use Refer to naza_decoder_wiring.jpg diagram for proper connection + http://www.rcgroups.com/forums/showthread.php?t=1995704 - The RC PWM input code taken from https://www.instructables.com/id/RC-Quadrotor-Helicopter/step12/Arduino-Demo-PWM-Input/ */ #ifndef __NAZA_DECODER_LIB_H__ #define __NAZA_DECODER_LIB_H__ -//#include "Arduino.h" #include "stdint.h" #define NAZA_MESSAGE_NONE 0x00 #define NAZA_MESSAGE_GPS 0x10 #define NAZA_MESSAGE_COMPASS 0x20 +/** Naza Decoder Class(es) + */ class NazaDecoderLib { public: typedef enum { NO_FIX = 0, FIX_2D = 2, FIX_3D = 3, FIX_DGPS = 4 } fixType_t; + /** Create a NazaDecoderLib object receiving serial data byte + */ NazaDecoderLib(); - uint8_t decode(int input); + uint8_t decode(uint8_t input); + void getDebug(RawSerial &s, char* buf); + /** Return the latitude GPS position + */ double getLat(); + /** Return the longitude GPS position + */ double getLon(); + /** Return the altitude GPS elevation + */ double getGpsAlt(); + /** Return the GPS speed + */ double getSpeed(); + /** Return the GPS fix mode NO_FIX = 0, 2D = 2, 3D = 3, DGPS = 4 + */ fixType_t getFixType(); + /** Return the GPS number of satellites + */ uint8_t getNumSat(); + /** heading (not tilt compensated in degrees) + */ double getHeadingNc(); + /** course over ground + */ double getCog(); + /** vertical speed indicator (from GPS) in m/s (a.k.a. climb speed) + */ double getGpsVsi(); + /** horizontal dilution of precision + */ double getHdop(); + /** vertical dilution of precision + */ double getVdop(); + /** Return the GPS Year time + */ uint8_t getYear(); + /** Return the GPS Month time + */ uint8_t getMonth(); + /** Return the GPS Day time + */ uint8_t getDay(); - uint8_t getHour(); // Note that for time between 16:00 and 23:59 the hour returned from GPS module is actually 00:00 - 7:59. + /** Return the GPS Hour time + * Note that for time between 16:00 and 23:59 the hour returned from GPS module is actually 00:00 - 7:59. + */ + uint8_t getHour(); + /** Return the GPS Minute time + */ uint8_t getMinute(); + /** Return the GPS Second time + */ uint8_t getSecond(); private: int gpsPayload[58]; int seq; + int syncError; int cnt; int msgId; int msgLen; @@ -63,7 +103,7 @@ double spd; // speed in m/s fixType_t fix; // fix type uint8_t sat; // number of satellites - double headingNc;// heading (not tilt compensated in degrees + double headingNc;// heading (not tilt compensated in degrees) double cog; // course over ground double gpsVsi; // vertical speed indicator (from GPS) in m/s (a.k.a. climb speed) double hdop; // horizontal dilution of precision @@ -77,7 +117,7 @@ int32_t decodeLong(uint8_t idx, uint8_t mask); int16_t decodeShort(uint8_t idx, uint8_t mask); - void updateCS(int input); + void updateCS(uint8_t input); };