mirror of
https://github.com/rtlsdrblog/rtl-sdr-blog.git
synced 2024-12-26 19:08:29 +01:00
display real sample rate with rounding error
Signed-off-by: Steve Markgraf <steve@steve-m.de>
This commit is contained in:
parent
8dc13ea3ea
commit
409073b8ab
@ -221,15 +221,18 @@ void set_samp_rate(uint32_t samp_rate)
|
||||
{
|
||||
uint16_t tmp;
|
||||
uint32_t rsamp_ratio;
|
||||
double real_rate;
|
||||
|
||||
/* check for the maximum rate the resampler supports */
|
||||
if (samp_rate > 3200000)
|
||||
samp_rate = 3200000;
|
||||
|
||||
printf("Setting sample rate: %i Hz\n", samp_rate);
|
||||
rsamp_ratio = (CRYSTAL_FREQ * pow(2, 22)) / samp_rate;
|
||||
|
||||
rsamp_ratio &= ~3;
|
||||
|
||||
real_rate = (CRYSTAL_FREQ * pow(2, 22)) / rsamp_ratio;
|
||||
printf("Setting sample rate: %.3f Hz\n", real_rate);
|
||||
|
||||
tmp = (rsamp_ratio >> 16);
|
||||
demod_write_reg(1, 0x9f, tmp, 2);
|
||||
tmp = rsamp_ratio & 0xffff;
|
||||
|
Loading…
Reference in New Issue
Block a user