EL18 RF USB switch (#2221)

* feature: added ability to have radio specific menu items in the bootloader
* added enabling/disabling USB access to the RF module via the bootloader
* enable the internal module on EL18, when RF module USB access is enabled
* moved USB switch pin initialization to the NV14/EL18 specific code
* moved EL18 USB switch defines to boot_menu
* feat: added a symbol for RF USB switch menu option on EL18 bootloader
This commit is contained in:
Malte Langermann
2022-09-08 08:20:49 +02:00
committed by GitHub
parent 4e49ac68be
commit 8b7e8c3017
10 changed files with 194 additions and 23 deletions
@@ -227,6 +227,10 @@ void bootloaderInitApp()
AUX2_SERIAL_RCC_APB2Periph,
ENABLE);
#if defined(HAVE_BOARD_BOOTLOADER_INIT)
boardBootloaderInit();
#endif
pwrInit();
keysInit();
@@ -299,6 +303,7 @@ int bootloaderMain()
{
BootloaderState state = ST_START;
uint32_t vpos = 0;
uint32_t radioMenuItem = 0;
uint8_t index = 0;
FRESULT fr;
uint32_t nameCount = 0;
@@ -322,7 +327,8 @@ int bootloaderMain()
if (tenms) {
tenms = 0;
if (state != ST_USB && state != ST_FLASHING && state != ST_FLASH_DONE) {
if (state != ST_USB && state != ST_FLASHING
&& state != ST_FLASH_DONE && state != ST_RADIO_MENU) {
if (usbPlugged()) {
state = ST_USB;
if (!unlocked) {
@@ -358,7 +364,7 @@ int bootloaderMain()
bootloaderDrawScreen(state, vpos);
if (event == EVT_KEY_FIRST(KEY_DOWN)) {
if (vpos < MAIN_MENU_LEN - 1) { vpos++; }
if (vpos < bootloaderGetMenuItemCount(MAIN_MENU_LEN) - 1) { vpos++; }
continue;
}
else if (event == EVT_KEY_FIRST(KEY_UP)) {
@@ -378,7 +384,13 @@ int bootloaderMain()
break;
#endif
default:
state = ST_REBOOT;
if(vpos < bootloaderGetMenuItemCount(MAIN_MENU_LEN-1))
{
state = ST_RADIO_MENU;
radioMenuItem = vpos - MAIN_MENU_LEN - 1;
} else {
state = ST_REBOOT;
}
break;
}
@@ -513,6 +525,13 @@ int bootloaderMain()
state = ST_FLASH_DONE; // Backstop
}
#endif
} else if (state == ST_RADIO_MENU) {
if(bootloaderRadioMenu(radioMenuItem, event))
{
state = ST_START;
vpos = 0;
bootloaderDrawScreen(state, vpos);
}
}
if (state == ST_FLASH_DONE) {
@@ -567,6 +586,6 @@ int bootloaderMain()
return 0;
}
#if defined(PCBHORUS) || defined(PCBNV14)
#if !defined(SIMU) && (defined(PCBHORUS) || defined(PCBNV14))
void *__dso_handle = nullptr;
#endif