#ifndef __USB_IF_H__ #define __USB_IF_H__ #include #include #include #include #define USB_CDC_DATA_SIZE 0x40 struct usb_state { struct usb_cdc_line_coding line; usbd_device usb_dev; uint32_t usb_buf[0x20]; uint8_t usb_pkbuf[USB_CDC_DATA_SIZE]; struct cobs_decode_state cobs_state; bool cobs_synchronized; bool connected; ErrorCode error; uint64_t last_error; uint8_t txbuf[USB_CDC_DATA_SIZE]; size_t txpos; }; extern struct usb_state st_usb; void usb_init(void); extern void handle_usb_packet(void *packet, size_t len); ErrorCode usb_write_response(void *data, size_t len); #endif /* __USB_IF_H__ */