📄 gpsnav.h
字号:
#ifndef _GPSNAV_H
#define _GPSNAV_H
#define CH_OFFSET 0 // offset of channal allocation
// if this value is changed, firmware should be changed accordingly
#define ENABLE_6CH 0x7f // value written to reset_cntl, if you change
// CH_OFFSET , you should change this value accordingly
#include <fstream.h>
#include <ostream>
#include <math.h>
#include "gbl_var.h"
#include "navthread.h"
#include "Gps_interface.h"
class GPS_Nav{
private:
#ifdef GPS_NAV_DBG
ofstream debugfile;
#endif
#if GPS_NAV_RAW_DATA > 0
ofstream ch_accum_mis_file;
ofstream ch_rawdata_file[CH_NUM];
#endif
/* GPS function related constants */
static const int prn_code[38];
static const short bit_pat[12];
static const short ch_ready_mask[12];
static const int carrier_ref=0x01f7b1b9,code_ref=0x016ea4a8;
// ^^^^^ 1.405396826MHz, ^^^^ 1.022999968MHz
static const int cc_scale=3080;
static const int NAG_PREAM = 0x22c00000;
static const int pb1=0xbb1f3480,pb2=0x5d8f9a40,pb3=0xaec7cd00;
static const int pb4=0x5763e680,pb5=0x6bb1f340,pb6=0x8b7a89c0;
static const double pull_code_d ,pull_code_k,pull_carrier_d,pull_carrier_k;
static const double trk_code_d ,trk_code_k,trk_carrier_d,trk_carrier_k;
unsigned short ch_status;
channel ch[ CH_NUM ];
int data_count[ CH_NUM ];
/* end of GPS function related constants */
unsigned short count, TIC_count;
unsigned char count1, epoch_chk;
NavThread *navthrd;
bool thrdtermed, newfrmflag;
int newfrmcount;
IoInterface *IoHandle;
gp2021_regs GpsNav_gp2021_regs;
one_frame_data frm_4ms_6ch; // contain 3.6ms , 6 channel data per ms
gp2021_regs gp2021_wr_data;
void add_one_reg( unsigned char add,
unsigned char hi,
unsigned char lo);
void clear_all_reg();
void search_pream( int );
public:
GPS_Nav(IoInterface*);
~GPS_Nav();
int InitProc();
void PrintDbgInfo(char*);
void Get_oneframedata();
int ProcessData();
void CreateNavThrd();
void ResumeThrd();
void SuspendThrd();
void TerminateThrd();
bool NavThrdIsTermed();
void SetThrdStatus(bool);
void SetPrn(int*);
/* GP2021 related function *********/
void ch_cntl(char ch, unsigned short data);
void ch_code( char ch,unsigned int freq);
void ch_carrier(char ch,unsigned int freq);
void ch_epoch_load(char ch,unsigned short data);
void ch_on(char ch);
void ch_off(char ch);
void set_ch_onoff(void);
void system_setup(unsigned short data);
void test_control(unsigned short data);
void io_config(unsigned short data);
void reset_cntl(unsigned short data);
void program_TIC(unsigned int data);
void ch_accum_reset(char ch);
void ch_code_slew(char ch,unsigned short data);
void init_gp2021(void);
void test_data(unsigned short data);
void get_newaccumdata(void);
void process_channel( int );
void ch_acq(int);
void ch_confirm(int);
void ch_pullin(int);
void ch_track(int);
/* end of GP2021 related function **/
void get_rawdata( PT_allch_rawdata_disp );
void get_trkloop(PT_channel_disp);
};
const int GPS_Nav::prn_code[38] = {0x0,0x3f6,0x3ec,0x3d8,0x3b0,0x04b,0x096,0x2cb,0x196,0x32c,
0x3ba,0x374,0x1d0,0x3a0,0x340,0x280,0x100,0x113,0x226,
0x04c,0x098,0x130,0x260,0x267,0x338,0x270,0x0e0,0x1c0,
0x380,0x22b,0x056,0x0ac,0x158,0x02b0,0x058,0x18b,0x316,0x058};
const short GPS_Nav::bit_pat[12] = {0x2,0x4,0x8,0x10,0x20,0x40,0x80,0x100,0x200,0x400,0x800,0x1000};
const short GPS_Nav::ch_ready_mask[12] ={0x1,0x2,0x4,0x8,0x10,0x20,0x40,0x80,0x100,0x200,0x400,0x800};
const double GPS_Nav::pull_code_d = 7.0;
const double GPS_Nav::pull_code_k=111.0;
const double GPS_Nav::pull_carrier_d=30.8;//17.8;
const double GPS_Nav::pull_carrier_k=1.2;//43.2;
const double GPS_Nav::trk_code_d = 3.0;
const double GPS_Nav::trk_code_k=55.0;
const double GPS_Nav::trk_carrier_d=170.;//170;
const double GPS_Nav::trk_carrier_k=4.;//5;
static int sign(double);
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -