Add ppm setting

This commit is contained in:
F5OEO 2019-01-08 15:07:50 +00:00
parent 01e7aaa248
commit 3457b0c0e3
1 changed files with 11 additions and 3 deletions

View File

@ -18,6 +18,7 @@ fprintf(stderr,\
Usage:\ntune [-f Frequency] [-h] \n\ Usage:\ntune [-f Frequency] [-h] \n\
-f float frequency carrier Hz(50 kHz to 1500 MHz),\n\ -f float frequency carrier Hz(50 kHz to 1500 MHz),\n\
-e exit immediately without killing the carrier,\n\ -e exit immediately without killing the carrier,\n\
-p set clock ppm instead of ntp adjust\n\
-h help (this help).\n\ -h help (this help).\n\
\n",\ \n",\
PROGRAM_VERSION); PROGRAM_VERSION);
@ -37,11 +38,12 @@ int main(int argc, char* argv[])
int a; int a;
int anyargs = 0; int anyargs = 0;
float SetFrequency=434e6; float SetFrequency=434e6;
dbg_setlevel(1);
bool NotKill=false; bool NotKill=false;
float ppm=1000.0;
while(1) while(1)
{ {
a = getopt(argc, argv, "f:eh"); a = getopt(argc, argv, "f:ehp:");
if(a == -1) if(a == -1)
{ {
@ -55,9 +57,12 @@ int main(int argc, char* argv[])
case 'f': // Frequency case 'f': // Frequency
SetFrequency = atof(optarg); SetFrequency = atof(optarg);
break; break;
case 'e': // SampleRate (Only needeed in IQ mode) case 'e': //End immediately
NotKill=true; NotKill=true;
break; break;
case 'p': //ppm
ppm=atof(optarg);
break;
case 'h': // help case 'h': // help
print_usage(); print_usage();
exit(1); exit(1);
@ -100,9 +105,12 @@ int main(int argc, char* argv[])
pad.setlevel(7); pad.setlevel(7);
clkgpio *clk=new clkgpio; clkgpio *clk=new clkgpio;
clk->SetAdvancedPllMode(true); clk->SetAdvancedPllMode(true);
if(ppm!=1000) //ppm is set else use ntp
clk->Setppm(ppm);
clk->SetCenterFrequency(SetFrequency,10); clk->SetCenterFrequency(SetFrequency,10);
clk->SetFrequency(000); clk->SetFrequency(000);
clk->enableclk(4); clk->enableclk(4);
//clk->enableclk(6);//CLK2 : experimental //clk->enableclk(6);//CLK2 : experimental
//clk->enableclk(20);//CLK1 duplicate on GPIO20 for more power ? //clk->enableclk(20);//CLK1 duplicate on GPIO20 for more power ?
if(!NotKill) if(!NotKill)