@@ -204,6 +204,8 @@ static const max2837_ft_t max2837_ft[] = {
204204 if (device->usb_api_version < version) \
205205 return HACKRF_ERROR_USB_API_VERSION;
206206
207+ #define USB_API_REQUIRED_OR (device , version ) if (device->usb_api_version < version)
208+
207209static const uint16_t hackrf_usb_vid = 0x1d50 ;
208210static const uint16_t hackrf_jawbreaker_usb_pid = 0x604b ;
209211static const uint16_t hackrf_one_usb_pid = 0x6089 ;
@@ -3738,7 +3740,11 @@ int ADDCALL hackrf_str_to_fp64(uint8_t Qn, char* str, char* endptr, uint64_t* co
37383740
37393741int ADDCALL hackrf_radio_set_frequency (hackrf_device * device , const fp_40_24_t freq_hz )
37403742{
3741- USB_API_REQUIRED (device , 0x0113 );
3743+ USB_API_REQUIRED_OR (device , 0x0113 )
3744+ {
3745+ return hackrf_set_freq (device , FP_FREQ_HZ (freq_hz ));
3746+ }
3747+
37423748 uint64_t set_freq_fp_param ;
37433749 uint8_t length ;
37443750 int result ;
@@ -3772,6 +3778,15 @@ int ADDCALL hackrf_radio_set_frequency_explicit(
37723778 const fp_40_24_t lo_freq_hz ,
37733779 const enum rf_path_filter path )
37743780{
3781+ USB_API_REQUIRED_OR (device , 0x0113 )
3782+ {
3783+ return hackrf_set_freq_explicit (
3784+ device ,
3785+ FP_FREQ_HZ (if_freq_hz ),
3786+ FP_FREQ_HZ (lo_freq_hz ),
3787+ path );
3788+ }
3789+
37753790 struct {
37763791 fp_40_24_t if_freq_hz ;
37773792 fp_40_24_t lo_freq_hz ;
@@ -3822,7 +3837,11 @@ int ADDCALL hackrf_radio_set_frequency_explicit(
38223837
38233838int ADDCALL hackrf_radio_set_sample_rate (hackrf_device * device , const fp_28_36_t freq_hz )
38243839{
3825- USB_API_REQUIRED (device , 0x0113 );
3840+ USB_API_REQUIRED_OR (device , 0x0113 )
3841+ {
3842+ return hackrf_set_sample_rate (device , (double ) freq_hz / (1ULL << 36 ));
3843+ }
3844+
38263845 uint64_t set_sr_fp_param ;
38273846 uint8_t length ;
38283847 int result ;
0 commit comments