mirror of
https://github.com/im-tomu/foboot.git
synced 2024-09-20 02:40:09 +00:00
sw: usb: set the usb address
When we get a SET_ADDRESS command, set the USB address. Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
parent
90bb71a77e
commit
b95791dd23
@ -1,6 +1,8 @@
|
||||
#ifndef __USB_H
|
||||
#define __USB_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@ -22,6 +24,7 @@ void usb_err(void);
|
||||
int usb_recv(void *buffer, unsigned int buffer_len);
|
||||
void usb_poll(void);
|
||||
void usb_wait_for_send_done(void);
|
||||
void usb_set_address(uint8_t new_address);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <system.h>
|
||||
|
||||
#include <usb-desc.h>
|
||||
#include <generated/csr.h>
|
||||
|
||||
static uint8_t reply_buffer[8];
|
||||
static uint8_t usb_configuration = 0;
|
||||
@ -20,6 +21,9 @@ void usb_setup(const struct usb_setup_request *setup)
|
||||
switch (setup->wRequestAndType)
|
||||
{
|
||||
case 0x0500: // SET_ADDRESS
|
||||
usb_set_address(((uint8_t *)setup)[2]);
|
||||
break;
|
||||
|
||||
case 0x0b01: // SET_INTERFACE
|
||||
dfu_clrstatus();
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user