]> the.earth.li Git - temper-clone.git/commitdiff
Do USB disconnect/reconnect dance before initialising USB
authorJonathan McDowell <noodles@earth.li>
Thu, 10 May 2018 07:04:53 +0000 (08:04 +0100)
committerJonathan McDowell <noodles@earth.li>
Thu, 10 May 2018 07:04:53 +0000 (08:04 +0100)
According to http://vusb.wikidot.com/driver-api the initial
usbDeviceDisconnect() / usbDeviceConnect() for enumeration should
be called before doing the usbInit(). Haven't seen problems as a
result, but do so.

main.c

diff --git a/main.c b/main.c
index a75a4fcd53bd0caccf8ddbe36bdc6be45fbde988..4e3d72c3c4667e5a55a9713d8eff3466b8d9e0b8 100644 (file)
--- a/main.c
+++ b/main.c
@@ -375,17 +375,16 @@ int main(void)
        w1_setup();
        set_serial();
 
-       usbInit();
        usbDeviceDisconnect();
-
        i = 0;
        while (--i) {
                wdt_reset();
                _delay_ms(1);
        }
-
        usbDeviceConnect();
 
+       usbInit();
+
        /* PB1 as output for LED */
        DDRB |= 1 << PB1;