]> git.friedersdorff.com Git - max/tmk_keyboard.git/commitdiff
Fiexed AT90USB162 compatibility.(different number of endpoint)
authortmk <nobody@nowhere>
Sat, 3 Mar 2012 16:12:35 +0000 (01:12 +0900)
committertmk <nobody@nowhere>
Sat, 3 Mar 2012 16:23:44 +0000 (01:23 +0900)
pjrc/usb.c
pjrc/usb.h

index 20afc1b8834a22fd00b6fc46c15d923bc7311794..2b69b6a7fac7930eaa0f5f10c60af7f0c96efe65 100644 (file)
@@ -785,7 +785,7 @@ ISR(USB_COM_vect)
                        usb_configuration = wValue;
                        usb_send_in();
                        cfg = endpoint_config_table;
-                       for (i=1; i<=6; i++) {
+                       for (i=1; i<=MAX_ENDPOINT; i++) {
                                UENUM = i;
                                en = pgm_read_byte(cfg++);
                                 if (en) {
@@ -796,7 +796,7 @@ ISR(USB_COM_vect)
                                     UECONX = 0;
                                }
                        }
-                       UERST = 0x7E;
+                       UERST = UERST_MASK;
                        UERST = 0;
                        return;
                }
index 82e18f176342bdc620a140f7e88f09dc65798067..0eb58fc3955c73879ba3a400966e247ff95e515b 100644 (file)
@@ -53,7 +53,13 @@ void usb_remote_wakeup(void);
                        ((s) == 16 ? 0x10 :     \
                                     0x00)))
 
-#define MAX_ENDPOINT           4
+#if defined (__AVR_AT90USB162__) || defined (__AVR_AT90USB82__)
+#   define MAX_ENDPOINT     4
+#   define UERST_MASK       0x1E
+#else
+#   define MAX_ENDPOINT     6
+#   define UERST_MASK       0x7E
+#endif
 
 #define LSB(n) (n & 255)
 #define MSB(n) ((n >> 8) & 255)