Merge pull request #2696 from opentx/bsongis/issue2595_cli

Fixes #2595 and #2598: USB serial port and CLI added
This commit is contained in:
Damjan Adamic
2015-08-31 11:06:04 +02:00
40 changed files with 1316 additions and 709 deletions
+24 -13
View File
@@ -44,29 +44,40 @@ void handleUsbConnection()
{
#if defined(PCBTARANIS) && !defined(SIMU)
static bool usbStarted = false;
if (!usbStarted && usbPlugged()) {
usbStarted = true;
/*
We used to initialize USB peripheral and driver here.
According to my tests this is way too late. The USB peripheral
therefore does not have enough information to start responding to
USB host request, which causes very slow USB device recognition,
multiple USB device resets, etc...
If we want to change the USB profile, the procedure is simple:
* USB cable must be disconnected
* call usbDeInit();
* call usbUnit(); which initializes USB with the new profile.
Obviously the usbInit() should be modified to have a runtime
selection of the USB profile.
*/
#if defined(USB_MASS_STORAGE)
opentxClose();
#endif
usbStart();
#if defined(USB_MASS_STORAGE)
usbPluggedIn();
#endif
usbStarted = true;
}
if (usbStarted && !usbPlugged()) {
usbStarted = false;
}
#if defined(USB_JOYSTICK)
if (usbStarted) {
if (!usbPlugged()) {
//disable USB
usbStop();
usbStarted = false;
}
else {
usbJoystickUpdate();
}
if (usbStarted ) {
usbJoystickUpdate();
}
#endif
#endif //#if defined(PCBTARANIS) && !defined(SIMU)
}