kopia lustrzana https://github.com/keenerd/rtl-sdr
				
				
				
			utils: tejeez's no-mod direct sampling
							rodzic
							
								
									284fd4df00
								
							
						
					
					
						commit
						7d70b00792
					
				| 
						 | 
				
			
			@ -174,6 +174,8 @@ int verbose_direct_sampling(rtlsdr_dev_t *dev, int on)
 | 
			
		|||
		fprintf(stderr, "Enabled direct sampling mode, input 1/I.\n");}
 | 
			
		||||
	if (on == 2) {
 | 
			
		||||
		fprintf(stderr, "Enabled direct sampling mode, input 2/Q.\n");}
 | 
			
		||||
	if (on == 3) {
 | 
			
		||||
		fprintf(stderr, "Enabled no-mod direct sampling mode.\n");}
 | 
			
		||||
	return r;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -204,6 +204,7 @@ void usage(void)
 | 
			
		|||
		"\t    dc:     enable dc blocking filter\n"
 | 
			
		||||
		"\t    deemp:  enable de-emphasis filter\n"
 | 
			
		||||
		"\t    direct: enable direct sampling\n"
 | 
			
		||||
		"\t    no-mod: enable no-mod direct sampling\n"
 | 
			
		||||
		"\t    offset: enable offset tuning\n"
 | 
			
		||||
		"\tfilename ('-' means stdout)\n"
 | 
			
		||||
		"\t    omitting the filename also uses stdout\n\n"
 | 
			
		||||
| 
						 | 
				
			
			@ -891,7 +892,7 @@ static void *controller_thread_fn(void *arg)
 | 
			
		|||
	/* set up primary channel */
 | 
			
		||||
	optimal_settings(s->freqs[0], demod.rate_in);
 | 
			
		||||
	if (dongle.direct_sampling) {
 | 
			
		||||
		verbose_direct_sampling(dongle.dev, 1);}
 | 
			
		||||
		verbose_direct_sampling(dongle.dev, dongle.direct_sampling);}
 | 
			
		||||
	if (dongle.offset_tuning) {
 | 
			
		||||
		verbose_offset_tuning(dongle.dev);}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1104,6 +1105,8 @@ int main(int argc, char **argv)
 | 
			
		|||
				demod.deemph = 1;}
 | 
			
		||||
			if (strcmp("direct",  optarg) == 0) {
 | 
			
		||||
				dongle.direct_sampling = 1;}
 | 
			
		||||
			if (strcmp("no-mod",  optarg) == 0) {
 | 
			
		||||
				dongle.direct_sampling = 3;}
 | 
			
		||||
			if (strcmp("offset",  optarg) == 0) {
 | 
			
		||||
				dongle.offset_tuning = 1;}
 | 
			
		||||
			break;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -148,7 +148,7 @@ void usage(void)
 | 
			
		|||
		"\t  fir_size can be 0 or 9.  0 has bad roll off,\n"
 | 
			
		||||
		"\t  try with '-c 50%%')\n"
 | 
			
		||||
		"\t[-P enables peak hold (default: off)]\n"
 | 
			
		||||
		"\t[-D enable direct sampling (default: off)]\n"
 | 
			
		||||
		"\t[-D direct_sampling_mode, 0 (default/off), 1 (I), 2 (Q), 3 (no-mod)]\n"
 | 
			
		||||
		"\t[-O enable offset tuning (default: off)]\n"
 | 
			
		||||
		"\n"
 | 
			
		||||
		"CSV FFT output columns:\n"
 | 
			
		||||
| 
						 | 
				
			
			@ -781,7 +781,7 @@ int main(int argc, char **argv)
 | 
			
		|||
	double (*window_fn)(int, int) = rectangle;
 | 
			
		||||
	freq_optarg = "";
 | 
			
		||||
 | 
			
		||||
	while ((opt = getopt(argc, argv, "f:i:s:t:d:g:p:e:w:c:F:1PDOh")) != -1) {
 | 
			
		||||
	while ((opt = getopt(argc, argv, "f:i:s:t:d:g:p:e:w:c:F:1PD:Oh")) != -1) {
 | 
			
		||||
		switch (opt) {
 | 
			
		||||
		case 'f': // lower:upper:bin_size
 | 
			
		||||
			freq_optarg = strdup(optarg);
 | 
			
		||||
| 
						 | 
				
			
			@ -840,7 +840,7 @@ int main(int argc, char **argv)
 | 
			
		|||
			peak_hold = 1;
 | 
			
		||||
			break;
 | 
			
		||||
		case 'D':
 | 
			
		||||
			direct_sampling = 1;
 | 
			
		||||
			direct_sampling = atoi(optarg);
 | 
			
		||||
			break;
 | 
			
		||||
		case 'O':
 | 
			
		||||
			offset_tuning = 1;
 | 
			
		||||
| 
						 | 
				
			
			@ -908,7 +908,7 @@ int main(int argc, char **argv)
 | 
			
		|||
#endif
 | 
			
		||||
 | 
			
		||||
	if (direct_sampling) {
 | 
			
		||||
		verbose_direct_sampling(dev, 1);
 | 
			
		||||
		verbose_direct_sampling(dev, direct_sampling);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (offset_tuning) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -55,6 +55,7 @@ void usage(void)
 | 
			
		|||
		"\t[-b output_block_size (default: 16 * 16384)]\n"
 | 
			
		||||
		"\t[-n number of samples to read (default: 0, infinite)]\n"
 | 
			
		||||
		"\t[-S force sync output (default: async)]\n"
 | 
			
		||||
		"\t[-D direct_sampling_mode, 0 (default/off), 1 (I), 2 (Q), 3 (no-mod)]\n"
 | 
			
		||||
		"\tfilename (a '-' dumps samples to stdout)\n\n");
 | 
			
		||||
	exit(1);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -113,6 +114,7 @@ int main(int argc, char **argv)
 | 
			
		|||
	int gain = 0;
 | 
			
		||||
	int ppm_error = 0;
 | 
			
		||||
	int sync_mode = 0;
 | 
			
		||||
	int direct_sampling = 0;
 | 
			
		||||
	FILE *file;
 | 
			
		||||
	uint8_t *buffer;
 | 
			
		||||
	int dev_index = 0;
 | 
			
		||||
| 
						 | 
				
			
			@ -121,7 +123,7 @@ int main(int argc, char **argv)
 | 
			
		|||
	uint32_t samp_rate = DEFAULT_SAMPLE_RATE;
 | 
			
		||||
	uint32_t out_block_size = DEFAULT_BUF_LENGTH;
 | 
			
		||||
 | 
			
		||||
	while ((opt = getopt(argc, argv, "d:f:g:s:b:n:p:S")) != -1) {
 | 
			
		||||
	while ((opt = getopt(argc, argv, "d:f:g:s:b:n:p:D:S")) != -1) {
 | 
			
		||||
		switch (opt) {
 | 
			
		||||
		case 'd':
 | 
			
		||||
			dev_index = verbose_device_search(optarg);
 | 
			
		||||
| 
						 | 
				
			
			@ -148,6 +150,9 @@ int main(int argc, char **argv)
 | 
			
		|||
		case 'S':
 | 
			
		||||
			sync_mode = 1;
 | 
			
		||||
			break;
 | 
			
		||||
		case 'D':
 | 
			
		||||
			direct_sampling = atoi(optarg);
 | 
			
		||||
			break;
 | 
			
		||||
		default:
 | 
			
		||||
			usage();
 | 
			
		||||
			break;
 | 
			
		||||
| 
						 | 
				
			
			@ -197,6 +202,11 @@ int main(int argc, char **argv)
 | 
			
		|||
#else
 | 
			
		||||
	SetConsoleCtrlHandler( (PHANDLER_ROUTINE) sighandler, TRUE );
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	if (direct_sampling) {
 | 
			
		||||
		verbose_direct_sampling(dev, direct_sampling);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* Set the sample rate */
 | 
			
		||||
	verbose_set_sample_rate(dev, samp_rate);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Ładowanie…
	
		Reference in New Issue