Subversion Repositories FlightCtrl

Rev

Rev 838 | Blame | Compare with Previous | Last modification | View Log | RSS feed

#define    _B1(bit) (1 << (bit))  
#define    _B0(bit) (0 << (bit))
#define    MIN(a, b) ((a) < (b) ? (a) : (b))
#define    MAX(a, b) ((a) > (b) ? (a) : (b))

//#define  BAUDRATE 129// = 9600 baud
//#define  BAUDRATE 64// = 19200 baud
#define  BAUDRATE 32// = 38400 baud
//#define  BAUDRATE 21// = 57600 baud
//#define BAUDRATE 10// = 115200 baud

#define UBX_NOFIX 0
#define UBX_2DFIX 2
#define UBX_3DFIX 3

#define GPS_EMPTY    0
#define GPS_SYNC1    1
#define GPS_SYNC2    2
#define GPS_CLASS    3
#define GPS_LEN1     4
#define GPS_LEN2     5
#define GPS_FILLING  6
#define GPS_CKA      7
#define GPS_CKB      8

/* some uBlox UBX format defines */
#define SYNC_CHAR1   0xb5
#define SYNC_CHAR2   0x62
#define CLASS_NAV    0x01
#define MSGID_POSLLH 0x02
#define MSGID_STATUS 0x03
#define MSGID_POSUTM 0x08
#define MSGID_VELNED 0x12

typedef struct {
  long north;// in cm (+ = north)
  long east;// in cm (+ = east)
  long altitude;// in cm
  long velNorth;
  long velEast;
  long velDown;
  long groundSpeed;
  long heading;
 
  unsigned long ITOW;
  uint8_t state;// status of data: 0 = invlid; 1 = valid
  uint8_t noSV;// number of sats
} gpsInfo_t;

typedef struct {
  unsigned long ITOW;// time of week
  uint8_t GPSfix;// GPSfix Type, range 0..6
  uint8_t Flags;// Navigation Status Flags
  uint8_t DiffS;// Differential Status
  uint8_t res;// reserved
  unsigned long TTFF;// Time to first fix (millisecond time tag)
  unsigned long MSSS;// Milliseconds since Startup / Reset
  uint8_t packetStatus;
} NAV_STATUS_t;

typedef struct {
  unsigned long ITOW;// time of week
  long LON;// longitude in 1e-07 deg
  long LAT;// lattitude
  long HEIGHT;// height in mm
  long HMSL;// height above mean sea level im mm
  unsigned long Hacc;// horizontal accuracy in mm
  unsigned long Vacc;// vertical accuracy in mm
  uint8_t packetStatus;
} NAV_POSLLH_t;

typedef struct {
  unsigned long ITOW;// time of week
  long EAST; // cm  UTM Easting  
  long NORTH;  // cm  UTM Nording  
  long ALT;// cm  altitude
  uint8_t ZONE;// UTM zone number
  uint8_t HEM;// Hemisphere Indicator (0=North, 1=South)  
  uint8_t packetStatus;
} NAV_POSUTM_t;

typedef struct {
  unsigned long ITOW;  // ms  GPS Millisecond Time of Week  
  long VEL_N; // cm/s  NED north velocity  
  long VEL_E; // cm/s  NED east velocity  
  long VEL_D; // cm/s  NED down velocity  
  unsigned long Speed; // cm/s  Speed (3-D)  
  unsigned long GSpeed; // cm/s  Ground Speed (2-D)  
  long Heading; // deg (1e-05)  Heading 2-D  
  unsigned long SAcc;// cm/s  Speed Accuracy Estimate  
  unsigned long CAcc; // deg  Course / Heading Accuracy Estimate  
  uint8_t packetStatus;
} NAV_VELNED_t;