lib: if freq
This commit is contained in:
@ -64,6 +64,7 @@ typedef enum {
|
|||||||
HACKRF_VENDOR_REQUEST_SET_LNA_GAIN = 19,
|
HACKRF_VENDOR_REQUEST_SET_LNA_GAIN = 19,
|
||||||
HACKRF_VENDOR_REQUEST_SET_VGA_GAIN = 20,
|
HACKRF_VENDOR_REQUEST_SET_VGA_GAIN = 20,
|
||||||
HACKRF_VENDOR_REQUEST_SET_TXVGA_GAIN = 21,
|
HACKRF_VENDOR_REQUEST_SET_TXVGA_GAIN = 21,
|
||||||
|
HACKRF_VENDOR_REQUEST_SET_IF_FREQ = 22,
|
||||||
} hackrf_vendor_request;
|
} hackrf_vendor_request;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
@ -958,6 +959,34 @@ int ADDCALL hackrf_set_txvga_gain(hackrf_device* device, uint32_t value)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ADDCALL hackrf_set_if_freq(hackrf_device* device, const uint32_t freq_mhz)
|
||||||
|
{
|
||||||
|
int result;
|
||||||
|
|
||||||
|
if(freq_mhz < 2300 || freq_mhz > 2700)
|
||||||
|
{
|
||||||
|
return HACKRF_ERROR_INVALID_PARAM;
|
||||||
|
}
|
||||||
|
|
||||||
|
result = libusb_control_transfer(
|
||||||
|
device->usb_device,
|
||||||
|
LIBUSB_ENDPOINT_OUT | LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE,
|
||||||
|
HACKRF_VENDOR_REQUEST_SET_IF_FREQ,
|
||||||
|
0,
|
||||||
|
freq_mhz,
|
||||||
|
NULL,
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
);
|
||||||
|
|
||||||
|
if( result != 0 )
|
||||||
|
{
|
||||||
|
return HACKRF_ERROR_LIBUSB;
|
||||||
|
} else {
|
||||||
|
return HACKRF_SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void* transfer_threadproc(void* arg)
|
static void* transfer_threadproc(void* arg)
|
||||||
{
|
{
|
||||||
hackrf_device* device = (hackrf_device*)arg;
|
hackrf_device* device = (hackrf_device*)arg;
|
||||||
|
@ -128,6 +128,7 @@ extern ADDAPI int ADDCALL hackrf_board_id_read(hackrf_device* device, uint8_t* v
|
|||||||
extern ADDAPI int ADDCALL hackrf_version_string_read(hackrf_device* device, char* version, uint8_t length);
|
extern ADDAPI int ADDCALL hackrf_version_string_read(hackrf_device* device, char* version, uint8_t length);
|
||||||
|
|
||||||
extern ADDAPI int ADDCALL hackrf_set_freq(hackrf_device* device, const uint64_t freq_hz);
|
extern ADDAPI int ADDCALL hackrf_set_freq(hackrf_device* device, const uint64_t freq_hz);
|
||||||
|
extern ADDAPI int ADDCALL hackrf_set_if_freq(hackrf_device* device, const uint32_t freq_mhz);
|
||||||
|
|
||||||
/* currently 8-20Mhz - either as a fraction, i.e. freq 20000000hz divider 2 -> 10Mhz or as plain old 10000000hz (double)
|
/* currently 8-20Mhz - either as a fraction, i.e. freq 20000000hz divider 2 -> 10Mhz or as plain old 10000000hz (double)
|
||||||
preferred rates are 8, 10, 12.5, 16, 20Mhz due to less jitter */
|
preferred rates are 8, 10, 12.5, 16, 20Mhz due to less jitter */
|
||||||
|
Reference in New Issue
Block a user