Add a simpler way to check CLKIN status.

This commit is contained in:
Martin Ling
2022-08-05 09:17:32 +01:00
parent 01e0702013
commit ba148ee047
7 changed files with 70 additions and 5 deletions

View File

@@ -99,6 +99,7 @@ typedef enum {
HACKRF_VENDOR_REQUEST_GET_M0_STATE = 41,
HACKRF_VENDOR_REQUEST_SET_TX_UNDERRUN_LIMIT = 42,
HACKRF_VENDOR_REQUEST_SET_RX_OVERRUN_LIMIT = 43,
HACKRF_VENDOR_REQUEST_GET_CLKIN_STATUS = 44,
} hackrf_vendor_request;
#define USB_CONFIG_STANDARD 0x1
@@ -2521,6 +2522,27 @@ int ADDCALL hackrf_set_clkout_enable(hackrf_device* device, const uint8_t value)
}
}
int ADDCALL hackrf_get_clkin_status(hackrf_device* device, uint8_t* status)
{
USB_API_REQUIRED(device, 0x0106)
int result;
result = libusb_control_transfer(
device->usb_device,
LIBUSB_ENDPOINT_IN | LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE,
HACKRF_VENDOR_REQUEST_GET_CLKIN_STATUS,
0,
0,
status,
1,
0);
if (result < 1) {
last_libusb_error = result;
return HACKRF_ERROR_LIBUSB;
} else {
return HACKRF_SUCCESS;
}
}
int ADDCALL hackrf_operacake_gpio_test(
hackrf_device* device,
const uint8_t address,