diff options
| author | Steve Markgraf <steve@steve-m.de> | 2012-03-14 03:28:48 +0100 |
|---|---|---|
| committer | Steve Markgraf <steve@steve-m.de> | 2012-03-14 03:28:48 +0100 |
| commit | 409073b8abf3fca740b77d63e76201c772ef5479 (patch) | |
| tree | ae4f6dd930fb34c3950cac1c2175dfaef3bcec47 /src | |
| parent | 8dc13ea3ea4fb8c6f4b45b675985290bfeef1956 (diff) | |
display real sample rate with rounding error
Signed-off-by: Steve Markgraf <steve@steve-m.de>
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -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; |
