started amp_enable in libhackrf

This commit is contained in:
Michael Ossmann
2013-03-07 16:08:44 -07:00
parent ad82f1da7c
commit 8a9664c0ad

View File

@ -45,7 +45,8 @@ typedef enum {
HACKRF_VENDOR_REQUEST_CPLD_WRITE = 13,
HACKRF_VENDOR_REQUEST_BOARD_ID_READ = 14,
HACKRF_VENDOR_REQUEST_VERSION_STRING_READ = 15,
HACKRF_VENDOR_REQUEST_SET_FREQ = 16
HACKRF_VENDOR_REQUEST_SET_FREQ = 16,
HACKRF_VENDOR_REQUEST_AMP_ENABLE = 17
} hackrf_vendor_request;
typedef enum {
@ -570,6 +571,26 @@ int hackrf_version_string_read(hackrf_device* device, char* version,
}
}
static int hackrf_set_amp_enable(hackrf_device* device, uint8_t value)
{
int result = libusb_control_transfer(
device->usb_device,
LIBUSB_ENDPOINT_OUT | LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE,
HACKRF_VENDOR_REQUEST_AMP_ENABLE,
value,
0,
NULL,
0,
0
);
if (result != 0) {
return HACKRF_ERROR_LIBUSB;
} else {
return HACKRF_SUCCESS;
}
}
typedef struct {
uint32_t freq_mhz; /* From 30 to 6000MHz */
uint32_t freq_hz; /* From 0 to 999999Hz */