mirror of
https://github.com/greatscottgadgets/hackrf.git
synced 2026-03-13 02:38:39 +01:00
Draft in progress (not tested at all) set_freq().
This commit is contained in:
@@ -44,7 +44,8 @@ typedef enum {
|
||||
HACKRF_VENDOR_REQUEST_SPIFLASH_READ = 12,
|
||||
HACKRF_VENDOR_REQUEST_CPLD_WRITE = 13,
|
||||
HACKRF_VENDOR_REQUEST_BOARD_ID_READ = 14,
|
||||
HACKRF_VENDOR_REQUEST_VERSION_STRING_READ = 15
|
||||
HACKRF_VENDOR_REQUEST_VERSION_STRING_READ = 15,
|
||||
HACKRF_VENDOR_REQUEST_SET_FREQ = 16
|
||||
} hackrf_vendor_request;
|
||||
|
||||
typedef enum {
|
||||
@@ -569,6 +570,26 @@ int hackrf_version_string_read(hackrf_device* device, char* version,
|
||||
}
|
||||
}
|
||||
|
||||
int hackrf_set_freq(hackrf_device* device, const uint32_t freq_mhz) {
|
||||
/* TODO add freq_hz in addition from 0 to 999999Hz */
|
||||
int result = libusb_control_transfer(
|
||||
device->usb_device,
|
||||
LIBUSB_ENDPOINT_OUT | LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE,
|
||||
HACKRF_VENDOR_REQUEST_SET_FREQ,
|
||||
freq_mhz & 0xffff,
|
||||
freq_mhz >> 16,
|
||||
NULL,
|
||||
0,
|
||||
0
|
||||
);
|
||||
|
||||
if( result != 0 ) {
|
||||
return HACKRF_ERROR_LIBUSB;
|
||||
} else {
|
||||
return HACKRF_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
static void* transfer_threadproc(void* arg) {
|
||||
hackrf_device* device = (hackrf_device*)arg;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user