Commit faa40074 authored by Lucas Russo's avatar Lucas Russo

sm_io/*/sm_ch_si57x.c: fix frequency calculation

RFREQ is a 38-bit number, with the 10 MSB
the integer part and the 28 LSB the fractional
part. So, we need to divide RFEQ by 2^28 prior
to the calculation.
parent c29f4bed
......@@ -214,7 +214,7 @@ smch_err_e smch_si57x_get_freq (smch_si57x_t *self, double *freq)
"frequency\n");
/* rfreq is usually a large value. So we divide it first */
frequency = (double) self->rfreq / (self->hs_div * self->n1);
frequency = ((double) self->rfreq / POW_2_28) / (self->hs_div * self->n1);
frequency *= self->fxtal;
*freq = frequency;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment