]> mj.ucw.cz Git - home-hw.git/blobdiff - Inc/usb.h
Debugging...
[home-hw.git] / Inc / usb.h
index 1d8291ff61e53a580a8be62fcd66bac1e1d1d86c..e33a71f1442faf532ab1407b531633167ccbe06f 100644 (file)
--- a/Inc/usb.h
+++ b/Inc/usb.h
@@ -1,15 +1,6 @@
 #define USB_SELF_POWERED
 #define USB_NUM_CONFIGURATIONS 1
-
-typedef unsigned int uint;
-typedef uint8_t byte;
-typedef uint16_t u16;
-typedef int16_t s16;
-typedef uint32_t u32;
-typedef int32_t s32;
-
-#define MIN(x,y) ((x) < (y) ? (x) : (y))
-#define MAX(x,y) ((x) > (y) ? (x) : (y))
+#define USB_DEBUG
 
 /*** USB state structure ***/
 
@@ -39,6 +30,7 @@ struct usb {
 };
 
 void usb_init(struct usb *usb, PCD_HandleTypeDef *hpcd);
+void usb_start(struct usb *usb);
 
 enum usb_device_state {
   USB_STATE_DEFAULT,
@@ -57,6 +49,13 @@ enum usb_ep0_state {
   USB_EP0_STALL,
 };
 
+#ifdef USB_DEBUG
+#define usb_debug debug_printf
+#else
+static inline void usb_debug(char *msg, ...)
+{ }
+#endif
+
 /*** Constants from USB specs ***/
 
 #define USB_REQ_DIRECTION 0x80