usbus/hid: uncrustify files
This commit is contained in:
parent
834ac3f5a5
commit
2c2eb88c0e
@ -34,7 +34,7 @@ extern "C" {
|
||||
/**
|
||||
* @brief USBUS HID IO RX callback function
|
||||
*/
|
||||
typedef void (*usb_hid_io_cb_t)(void*);
|
||||
typedef void (*usb_hid_io_cb_t)(void *);
|
||||
|
||||
/**
|
||||
* @brief Set USBUS HID IO RX callback
|
||||
|
||||
@ -107,9 +107,9 @@ static void _init(usbus_t *usbus, usbus_handler_t *handler)
|
||||
hid->hid_descr.arg = hid;
|
||||
|
||||
/*
|
||||
Configure Interface as USB_HID interface, choosing NONE for subclass and
|
||||
protocol in order to represent a generic I/O device
|
||||
*/
|
||||
Configure Interface as USB_HID interface, choosing NONE for subclass and
|
||||
protocol in order to represent a generic I/O device
|
||||
*/
|
||||
hid->iface.class = USB_CLASS_HID;
|
||||
hid->iface.subclass = USB_HID_SUBCLASS_NONE;
|
||||
hid->iface.protocol = USB_HID_PROTOCOL_NONE;
|
||||
@ -118,9 +118,9 @@ static void _init(usbus_t *usbus, usbus_handler_t *handler)
|
||||
|
||||
/* IN endpoint to send data to host */
|
||||
hid->ep_in = usbus_add_endpoint(usbus, &hid->iface,
|
||||
USB_EP_TYPE_INTERRUPT,
|
||||
USB_EP_DIR_IN,
|
||||
CONFIG_USBUS_HID_INTERRUPT_EP_SIZE);
|
||||
USB_EP_TYPE_INTERRUPT,
|
||||
USB_EP_DIR_IN,
|
||||
CONFIG_USBUS_HID_INTERRUPT_EP_SIZE);
|
||||
|
||||
/* interrupt endpoint polling rate in ms */
|
||||
hid->ep_in->interval = 0x05;
|
||||
@ -129,8 +129,8 @@ static void _init(usbus_t *usbus, usbus_handler_t *handler)
|
||||
|
||||
/* OUT endpoint to receive data from host */
|
||||
hid->ep_out = usbus_add_endpoint(usbus, &hid->iface,
|
||||
USB_EP_TYPE_INTERRUPT, USB_EP_DIR_OUT,
|
||||
CONFIG_USBUS_HID_INTERRUPT_EP_SIZE);
|
||||
USB_EP_TYPE_INTERRUPT, USB_EP_DIR_OUT,
|
||||
CONFIG_USBUS_HID_INTERRUPT_EP_SIZE);
|
||||
|
||||
/* interrupt endpoint polling rate in ms */
|
||||
hid->ep_out->interval = 0x05;
|
||||
@ -150,9 +150,9 @@ static void _event_handler(usbus_t *usbus, usbus_handler_t *handler,
|
||||
(void)handler;
|
||||
|
||||
switch (event) {
|
||||
default:
|
||||
DEBUG("USB HID unhandled event: 0x%x\n", event);
|
||||
break;
|
||||
default:
|
||||
DEBUG("USB HID unhandled event: 0x%x\n", event);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -167,39 +167,39 @@ static int _control_handler(usbus_t *usbus, usbus_handler_t *handler,
|
||||
|
||||
/* Requests defined in USB HID 1.11 spec section 7 */
|
||||
switch (setup->request) {
|
||||
case USB_SETUP_REQ_GET_DESCRIPTOR: {
|
||||
uint8_t desc_type = setup->value >> 8;
|
||||
if (desc_type == USB_HID_DESCR_REPORT) {
|
||||
usbus_control_slicer_put_bytes(usbus, hid->report_desc,
|
||||
hid->report_desc_size);
|
||||
}
|
||||
else if (desc_type == USB_HID_DESCR_HID) {
|
||||
_gen_hid_descriptor(usbus, NULL);
|
||||
}
|
||||
break;
|
||||
case USB_SETUP_REQ_GET_DESCRIPTOR: {
|
||||
uint8_t desc_type = setup->value >> 8;
|
||||
if (desc_type == USB_HID_DESCR_REPORT) {
|
||||
usbus_control_slicer_put_bytes(usbus, hid->report_desc,
|
||||
hid->report_desc_size);
|
||||
}
|
||||
case USB_HID_REQUEST_GET_REPORT:
|
||||
break;
|
||||
case USB_HID_REQUEST_GET_IDLE:
|
||||
break;
|
||||
case USB_HID_REQUEST_GET_PROTOCOL:
|
||||
break;
|
||||
case USB_HID_REQUEST_SET_REPORT:
|
||||
if ((state == USBUS_CONTROL_REQUEST_STATE_OUTDATA)) {
|
||||
size_t size = 0;
|
||||
uint8_t *data = usbus_control_get_out_data(usbus, &size);
|
||||
if (size > 0) {
|
||||
hid->cb(hid, data, size);
|
||||
}
|
||||
else if (desc_type == USB_HID_DESCR_HID) {
|
||||
_gen_hid_descriptor(usbus, NULL);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case USB_HID_REQUEST_GET_REPORT:
|
||||
break;
|
||||
case USB_HID_REQUEST_GET_IDLE:
|
||||
break;
|
||||
case USB_HID_REQUEST_GET_PROTOCOL:
|
||||
break;
|
||||
case USB_HID_REQUEST_SET_REPORT:
|
||||
if ((state == USBUS_CONTROL_REQUEST_STATE_OUTDATA)) {
|
||||
size_t size = 0;
|
||||
uint8_t *data = usbus_control_get_out_data(usbus, &size);
|
||||
if (size > 0) {
|
||||
hid->cb(hid, data, size);
|
||||
}
|
||||
break;
|
||||
case USB_HID_REQUEST_SET_IDLE:
|
||||
break;
|
||||
case USB_HID_REQUEST_SET_PROTOCOL:
|
||||
break;
|
||||
default:
|
||||
DEBUG("USB_HID: unknown request %d \n", setup->request);
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
case USB_HID_REQUEST_SET_IDLE:
|
||||
break;
|
||||
case USB_HID_REQUEST_SET_PROTOCOL:
|
||||
break;
|
||||
default:
|
||||
DEBUG("USB_HID: unknown request %d \n", setup->request);
|
||||
return -1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -52,8 +52,9 @@ static usbus_t usbus;
|
||||
static char _stack[USBUS_STACKSIZE];
|
||||
static char test_arg[] = { "Test argument" };
|
||||
|
||||
static void rx_cb(void* arg) {
|
||||
printf("USB_HID rx_cb: %s \n", (char*)arg);
|
||||
static void rx_cb(void *arg)
|
||||
{
|
||||
printf("USB_HID rx_cb: %s \n", (char *)arg);
|
||||
}
|
||||
|
||||
static void init(void)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user