mirror of
https://github.com/greatscottgadgets/hackrf.git
synced 2026-03-03 05:55:18 +01:00
Don't use doubles in firmware
The FPU supports only single-precision floats.
This commit is contained in:
@@ -39,8 +39,13 @@ radio_error_t radio_set_sample_rate(
|
||||
|
||||
radio_config_t* config = &radio->channel[chan_id].config;
|
||||
|
||||
// TODO get the actual tuned frequency from sample_rate_frac_set
|
||||
sample_rate.hz = (double) sample_rate.num / (double) sample_rate.div;
|
||||
/*
|
||||
* Store the sample rate rounded to the nearest Hz for convenience.
|
||||
*/
|
||||
if (sample_rate.div == 0) {
|
||||
return RADIO_ERR_INVALID_PARAM;
|
||||
}
|
||||
sample_rate.hz = (sample_rate.num + (sample_rate.div >> 1)) / sample_rate.div;
|
||||
|
||||
if (config->mode == TRANSCEIVER_MODE_OFF) {
|
||||
config->sample_rate[element] = sample_rate;
|
||||
|
||||
@@ -77,7 +77,7 @@ typedef enum {
|
||||
typedef struct {
|
||||
uint32_t num;
|
||||
uint32_t div;
|
||||
double hz;
|
||||
uint32_t hz;
|
||||
} radio_sample_rate_t;
|
||||
|
||||
typedef struct {
|
||||
|
||||
Reference in New Issue
Block a user