summaryrefslogtreecommitdiffstats
path: root/app/dfu.c
diff options
context:
space:
mode:
Diffstat (limited to 'app/dfu.c')
-rw-r--r--app/dfu.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/app/dfu.c b/app/dfu.c
index 08e3bf9..8e72e3f 100644
--- a/app/dfu.c
+++ b/app/dfu.c
@@ -36,7 +36,7 @@ const struct usb_iface_assoc_descriptor dfu_iface_assoc = {
};
-static int
+static void
dfu_detach_complete (usbd_device *usbd_dev, struct usb_setup_data *req)
{
(void) req;
@@ -48,23 +48,21 @@ dfu_detach_complete (usbd_device *usbd_dev, struct usb_setup_data *req)
//SCB_AIRCR= SCB_AIRCR_SYSRESETREQ;
scb_reset_core();
- return 1;
}
-int
+enum usbd_request_return_codes
dfu_control_request (usbd_device *usbd_dev, struct usb_setup_data *req,
uint8_t **buf, uint16_t *len,
- usbd_control_complete_callback *complete)
-{
+ usbd_control_complete_callback *complete) {
(void) buf;
(void) len;
(void) usbd_dev;
- if ((req->bmRequestType & 0x7F) != 0x21) {
- return 0; /* Only accept class request. */
- }
+ if ((req->bmRequestType & 0x7F) != 0x21)
+ return USBD_REQ_NEXT_CALLBACK;
- switch (req->bRequest) {
+ switch (req->bRequest)
+ {
case DFU_GETSTATUS: {
(*buf) [0] = DFU_STATUS_OK;
(*buf) [1] = 0;
@@ -73,20 +71,20 @@ dfu_control_request (usbd_device *usbd_dev, struct usb_setup_data *req,
(*buf) [4] = STATE_APP_IDLE;
(*buf) [5] = 0; /* iString not used here */
*len = 6;
- return 1;
+ return USBD_REQ_HANDLED;
}
case DFU_GETSTATE:
/* Return state with no state transision. */
*buf[0] = STATE_APP_IDLE;
*len = 1;
- return 1;
+ return USBD_REQ_HANDLED;
case DFU_DETACH:
*complete = dfu_detach_complete;
- return 1;
+ return USBD_REQ_HANDLED;
}
- return 0;
+ return USBD_REQ_NEXT_CALLBACK;
}