Subversion Repositories NaviCtrl

Rev

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

#ifndef __GPSUART_H
#define __GPSUART_H

struct str_ubx_nav_sol
{
    u16  Header;                  // 0xB5  0x62
        u16  ID;                          // 0x01  0x06
        u16  Length;         // 58 Bytes (+ Header - ohne ChkSum)       Total: 60 Bytes
  // ----- start of data -----
    u32  GPS_time;      
    s32  Time2;
    s16  GPS_week;
    u8   Nav_mode;        // 0x00=no fix, 0x03=3d fix
    u8   Flags;           // 0x01=GPS_ok
    s32  X_Pos;           // in cm  (ECEF frame)
    s32  Y_Pos;
    s32  Z_Pos;
    u32  Pos_Accuracy;
    s32  X_Speed;           // in cm/s  
    s32  Y_Speed;
    s32  Z_Speed;
    u32  Speed_Accuracy;
        u16  PDOP;                              // Scaling: 0.01
        u8   Reserved1;
        u8   Number_SV;
        u32  Reserved2;
  // ------ end of data -------
        u8   CK_A;
    u8   CK_B;
} __attribute__((packed));


struct str_ubx_nav_velned
{
    u16  Header;                  // 0xB5  0x62
        u16  ID;                          // 0x01  0x12
        u16  Length;          // 42 Bytes (+ Header  - ohne ChkSum) Total: 44 Bytes
  // ----- start of data -----
        u32  GPS_time;                 
        s32      N_Speed;              
        s32      E_Speed;              
        s32      DownSpeed;    
        u32      Speed3D;              
        u32      GroundSpeed;  
        s32      Heading;          
        u32      SpeedAccuracy;
        u32      HeadingAccuracy;
  // ------ end of data -------
        u8   CK_A;
    u8   CK_B;
} __attribute__((packed));

struct str_ubx_nav_posllh
{
    u16  Header;                  // 0xB5  0x62
        u16  ID;                          // 0x01  0x02
        u16  Length;          // 42 Bytes (+ Header  - ohne ChkSum) Total: 44 Bytes
  // ----- start of data -----
    u32  GPS_time;             
        s32      Longitude;       // 1e-07 deg Longitude
        s32      Latitude;        // 1e-07 deg Latitude
    s32  Height;          // mm Height
        s32      HeightSL;        // mm Height above mean sea level
    u32  HorizontalAccuracy; // mm Horizontal Accuracy Estimate
    u32  VerticalAccuracy;   // mm Vertical Accuracy Estimate
  // ------ end of data -------
        u8   CK_A;
    u8   CK_B;
} __attribute__((packed));

struct str_ubx_nav_posutm
{
    u16  Header;                  // 0xB5  0x62
        u16  ID;                          // 0x01  0x08
        u16  Length;          // 18 Bytes (+ Header  - ohne ChkSum)
  // ----- start of data -----
        u32  GPS_time;                 
        s32      East;                        // in cm               
        s32      North;                           // in cm
        s32      Altitude;                // in cm
        s16      UTM_ZoneNumber;               
        s16      HemisphereSector;        // 0 = North, 1 = South
  // ------ end of data -------
        u8   CK_A;
    u8   CK_B;
} __attribute__((packed));


struct str_gps_nav_data
{
        s32                     Longitude;             
        s32                     Latitude;              
        s32                     TargetLongitude;               
        s32                     TargetLatitude;                
        s32                     HomeLongitude;         
        s32                     HomeLatitude;          
        s32         North2Target;
        s32         East2Target;
        s32         Distance2Target;
        s32         Angle2Target;
        s32                     Height;
        s32                     HeightSL;              
        s32         DownSpeed; 
        u32                     GPS_time;
    u16         GPS_week;
        s32                     North;         
        s32                     East;          
        s32                     N_Speed;               
        s32                     E_Speed;        
        s32                     SpeedAccuracy; 
        u32                     HorizontalAccuracy;
        u32                     VerticalAccuracy;
    u8              Flags;           // 0x01=GPS_ok
        s32         DataPerSecond;
        s32         Altitude;
        u8          Used_Sat;
} __attribute__((packed));


#define GPS_RX_SIZE  (sizeof(struct str_ubx_nav_velned) + sizeof(struct str_ubx_nav_posutm) + sizeof(struct str_ubx_nav_sol) + sizeof(struct str_ubx_nav_posllh) + 10)

// ----------------------------------------------------------------
extern u8 NewGPSDataAvail;
extern u8 NewPCTargetGPSPosition;
extern struct str_gps_nav_data   GPS_Data;

extern void GPS_UART0_Init (void);

#endif