Projectkk2glider/usb hardening (#4125)

* USB fixes:
 * USB initialized when USB cable is inserted and de-initialized when disconnected (this was the original way, which proved itself unreliable in the past. Now with the new USB library it appears to work without any problems. Used in this way result in safer operation - USB controller is disabled while unconnected)
Works without force device mod
 * Serial: initialization of global variables
 * Reduced RAM usage - data moved to FLASH

* Detailed USB interrupt counters (+ debug print fix)
This commit is contained in:
Damjan Adamic
2016-12-11 10:33:52 +01:00
committed by Bertrand Songis
parent c3238ee38c
commit 29c43d9e33
16 changed files with 157 additions and 69 deletions
@@ -9,6 +9,7 @@ option(DEBUG_TRACE_BUFFER "Debug Trace Screen" OFF)
option(MULTIMODULE "DIY Multiprotocol TX Module (https://github.com/pascallanger/DIY-Multiprotocol-TX-Module)" OFF)
option(SUPPORT_D16_EU_ONLY "XJT module only supports D16-EU and LR12-EU" OFF) # TODO rename to XJT_EU_ONLY
option(DEBUG_INTERRUPTS "Count interrupts" OFF)
option(DEBUG_USB_INTERRUPTS "Count individual USB interrupts" OFF)
option(DEBUG_TASKS "Task switching statistics" OFF)
option(DEBUG_TIMERS "Time critical parts of the code" OFF)
@@ -41,6 +42,9 @@ endif()
if(DEBUG_INTERRUPTS)
add_definitions(-DDEBUG_INTERRUPTS)
set(DEBUG ON)
if(DEBUG_USB_INTERRUPTS)
add_definitions(-DDEBUG_USB_INTERRUPTS)
endif()
endif()
if(DEBUG_TASKS)
add_definitions(-DDEBUG_TASKS)