mirror of
https://github.com/rtlsdrblog/rtl-sdr-blog.git
synced 2024-11-10 04:37:37 +01:00
add direct sampling to rtl_sdr
This commit is contained in:
parent
3662ef4324
commit
f3673e7df0
@ -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 enable direct sampling (default: off)]\n"
|
||||
"\tfilename (a '-' dumps samples to stdout)\n\n");
|
||||
exit(1);
|
||||
}
|
||||
@ -113,6 +114,7 @@ int main(int argc, char **argv)
|
||||
int r, opt;
|
||||
int gain = 0;
|
||||
int ppm_error = 0;
|
||||
int direct_sampling = 0;
|
||||
int sync_mode = 0;
|
||||
FILE *file;
|
||||
uint8_t *buffer;
|
||||
@ -122,7 +124,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:SD")) != -1) {
|
||||
switch (opt) {
|
||||
case 'd':
|
||||
dev_index = verbose_device_search(optarg);
|
||||
@ -149,6 +151,9 @@ int main(int argc, char **argv)
|
||||
case 'S':
|
||||
sync_mode = 1;
|
||||
break;
|
||||
case 'D':
|
||||
direct_sampling = 1;
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
break;
|
||||
@ -198,6 +203,11 @@ int main(int argc, char **argv)
|
||||
#else
|
||||
SetConsoleCtrlHandler( (PHANDLER_ROUTINE) sighandler, TRUE );
|
||||
#endif
|
||||
|
||||
/* Set direct sampling */
|
||||
if (direct_sampling)
|
||||
verbose_direct_sampling(dev, 2);
|
||||
|
||||
/* Set the sample rate */
|
||||
verbose_set_sample_rate(dev, samp_rate);
|
||||
|
||||
|
@ -488,9 +488,8 @@ int main(int argc, char **argv)
|
||||
#endif
|
||||
|
||||
/* Set direct sampling */
|
||||
if (direct_sampling) {
|
||||
if (direct_sampling)
|
||||
verbose_direct_sampling(dev, 2);
|
||||
}
|
||||
|
||||
/* Set the tuner error */
|
||||
verbose_ppm_set(dev, ppm_error);
|
||||
|
Loading…
Reference in New Issue
Block a user