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:
@@ -112,6 +112,46 @@ void delay_self(int count)
|
||||
EXTMODULE_RCC_APB2Periph \
|
||||
)
|
||||
|
||||
static uint8_t boardGetPcbRev()
|
||||
{
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
|
||||
RCC_AHB1PeriphClockCmd(INTMODULE_RCC_AHB1Periph, ENABLE);
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
|
||||
GPIO_InitStructure.GPIO_OType = GPIO_OType_OD;
|
||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
|
||||
GPIO_InitStructure.GPIO_Pin = INTMODULE_PWR_GPIO_PIN;
|
||||
GPIO_Init(INTMODULE_PWR_GPIO, &GPIO_InitStructure);
|
||||
delay_ms(1); // delay to let the input settle, else it does not work properly
|
||||
|
||||
// detect NV14 vs EL18
|
||||
if (GPIO_ReadInputDataBit(INTMODULE_PWR_GPIO, INTMODULE_PWR_GPIO_PIN) == Bit_SET) {
|
||||
// pull-up connected: EL18
|
||||
return PCBREV_EL18;
|
||||
} else {
|
||||
// pull-down connected: NV14
|
||||
return PCBREV_NV14;
|
||||
}
|
||||
}
|
||||
|
||||
void boardBootloaderInit()
|
||||
{
|
||||
#if defined(USB_SW_PIN)
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
|
||||
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
|
||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
|
||||
GPIO_InitStructure.GPIO_Pin = USB_SW_PIN;
|
||||
GPIO_Init(USB_SW_GPOIO, &GPIO_InitStructure);
|
||||
RCC_AHB1PeriphClockCmd(USB_SW_AHB1Periph_GPIO, ENABLE);
|
||||
#endif
|
||||
|
||||
// detect NV14 vs EL18
|
||||
hardwareOptions.pcbrev = boardGetPcbRev();
|
||||
}
|
||||
|
||||
void boardInit()
|
||||
{
|
||||
#if defined(SEMIHOSTING)
|
||||
@@ -129,13 +169,7 @@ void boardInit()
|
||||
#endif
|
||||
|
||||
// detect NV14 vs EL18
|
||||
if (GPIO_ReadInputDataBit(INTMODULE_PWR_GPIO, INTMODULE_PWR_GPIO_PIN) == Bit_SET) {
|
||||
// pull-up connected: EL18
|
||||
hardwareOptions.pcbrev = PCBREV_EL18;
|
||||
} else {
|
||||
// pull-down connected: NV14
|
||||
hardwareOptions.pcbrev = PCBREV_NV14;
|
||||
}
|
||||
hardwareOptions.pcbrev = boardGetPcbRev();
|
||||
|
||||
#if defined(DEBUG)
|
||||
serialInit(SP_AUX1, UART_MODE_DEBUG);
|
||||
|
||||
Reference in New Issue
Block a user