/*** Callbacks ***/
+static byte usb_rx_buf[64];
+static byte usb_tx_buf[64];
+
void usb_dev_reset(struct usb *usb)
{
usb->desc_device = desc_device;
void usb_dev_configure(struct usb *usb)
{
+ usb_ep_open(usb, 0x01, USB_EP_TYPE_BULK, 64);
+ usb_ep_open(usb, 0x81, USB_EP_TYPE_BULK, 64);
+ usb_ep_receive(usb, 0x01, usb_rx_buf, 64);
}
void usb_dev_unconfigure(struct usb *usb)
{
+ usb_ep_close(usb, 0x01);
+ usb_ep_close(usb, 0x81);
}
bool usb_dev_setup_hook(struct usb *usb, struct setup_request *setup)
void usb_dev_recv_done(struct usb *usb, byte epnum)
{
+ if (epnum == 0x01)
+ {
+ usb_tx_buf[0]++;
+ usb_ep_send(usb, 0x81, usb_tx_buf, 33);
+ }
}
void usb_dev_send_done(struct usb *usb, byte epnum)
{
+ usb_ep_receive(usb, 0x01, usb_rx_buf, 64);
}