From 2c2eb88c0e8fbe24c26e5cd17f882bf98e4f1677 Mon Sep 17 00:00:00 2001 From: Ollrogge Date: Tue, 3 Aug 2021 17:46:43 +0200 Subject: [PATCH] usbus/hid: uncrustify files --- sys/include/usb/usbus/hid_io.h | 2 +- sys/usb/usbus/hid/hid.c | 84 +++++++++++++++++----------------- tests/usbus_hid/main.c | 5 +- 3 files changed, 46 insertions(+), 45 deletions(-) diff --git a/sys/include/usb/usbus/hid_io.h b/sys/include/usb/usbus/hid_io.h index 9c271ddb57..a436343c66 100644 --- a/sys/include/usb/usbus/hid_io.h +++ b/sys/include/usb/usbus/hid_io.h @@ -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 diff --git a/sys/usb/usbus/hid/hid.c b/sys/usb/usbus/hid/hid.c index 6ec479d748..32ac60f285 100644 --- a/sys/usb/usbus/hid/hid.c +++ b/sys/usb/usbus/hid/hid.c @@ -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; } diff --git a/tests/usbus_hid/main.c b/tests/usbus_hid/main.c index 79276bc216..d8c39ffeef 100644 --- a/tests/usbus_hid/main.c +++ b/tests/usbus_hid/main.c @@ -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)