Preserve state across resets by putting Wormhole to the newly added .noinit section. Rename The jump to bootloader USB command to reenumerate and generalize accordingly by handling the passed reenumeration mode.

This commit is contained in:
László Monda
2017-06-04 23:32:48 +02:00
parent a6ed51360f
commit 6c60af4ba8
7 changed files with 32 additions and 18 deletions

View File

@@ -72,16 +72,12 @@ void UpdateUsbReports()
IsUsbBasicKeyboardReportSent = false;
}
wormhole_t wormhole;
void main() {
InitPeripherials();
InitClock();
Wormhole = &wormhole; // TODO: Remove this as soon as the wormhole stabilizes.
Wormhole->enumerationMode = EnumerationMode_NormalKeyboard;
// Wormhole->enumerationMode = EnumerationMode_BusPal;
if (/*Wormhole->magicNumber == WORMHOLE_MAGIC_NUMBER && */ Wormhole->enumerationMode == EnumerationMode_BusPal) {
//Wormhole->magicNumber = 0;
if (Wormhole.magicNumber == WORMHOLE_MAGIC_NUMBER && Wormhole.enumerationMode == EnumerationMode_BusPal) {
Wormhole.magicNumber = 0;
init_hardware();
handleUsbBusPalCommand();
} else {