digistump / DigisparkArduinoIntegration

DEPRECATED - REPLACED BY: https://github.com/digistump/DigistumpArduino
275 stars 331 forks source link

Separate the USB init process from the object initialization #7

Closed jorgerivera closed 9 years ago

jorgerivera commented 10 years ago

The USB library triggers the enumeration using the commands usbDisconnect(), usbConnect().

If the USB library doesn't initialize correctly, it does not retry automatically, so if the USB host gives up in the enumeration (common in some embedded hosts) it will not be enumerated.

With a separate init() one could test if the device fails to communicate via USB and re-trigger the enumeration by re-calling init().

jorgerivera commented 10 years ago

I think that's a good suggestion, i'll add that and rollback the change to the example to keep it closer to the original