[9XR-PRO] USB Bootloader fix
This commit is contained in:
+15
-9
@@ -289,10 +289,24 @@ volatile tmr10ms_t g_tmr10ms;
|
|||||||
#if defined(CPUARM)
|
#if defined(CPUARM)
|
||||||
volatile uint8_t rtc_count = 0;
|
volatile uint8_t rtc_count = 0;
|
||||||
uint32_t watchdogTimeout = 0;
|
uint32_t watchdogTimeout = 0;
|
||||||
|
|
||||||
void watchdogSetTimeout(uint32_t timeout)
|
void watchdogSetTimeout(uint32_t timeout)
|
||||||
{
|
{
|
||||||
watchdogTimeout = timeout;
|
watchdogTimeout = timeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void opentxBootloader()
|
||||||
|
{
|
||||||
|
BACKLIGHT_ON();
|
||||||
|
|
||||||
|
lcd_clear();
|
||||||
|
lcd_putcAtt( 48, 24, 'U', DBLSIZE ) ;
|
||||||
|
lcd_putcAtt( 60, 24, 'S', DBLSIZE ) ;
|
||||||
|
lcd_putcAtt( 72, 24, 'B', DBLSIZE ) ;
|
||||||
|
lcdRefresh() ;
|
||||||
|
|
||||||
|
usbBootloader();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void per10ms()
|
void per10ms()
|
||||||
@@ -5066,15 +5080,7 @@ int main(void)
|
|||||||
g_eeGeneral.backlightBright = 0;
|
g_eeGeneral.backlightBright = 0;
|
||||||
g_eeGeneral.contrast = 25;
|
g_eeGeneral.contrast = 25;
|
||||||
|
|
||||||
BACKLIGHT_ON();
|
opentxBootloader();
|
||||||
|
|
||||||
lcd_clear();
|
|
||||||
lcd_putcAtt( 48, 24, 'U', DBLSIZE ) ;
|
|
||||||
lcd_putcAtt( 60, 24, 'S', DBLSIZE ) ;
|
|
||||||
lcd_putcAtt( 72, 24, 'B', DBLSIZE ) ;
|
|
||||||
lcdRefresh() ;
|
|
||||||
|
|
||||||
usbBootloader();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CoInitOS();
|
CoInitOS();
|
||||||
|
|||||||
@@ -529,6 +529,8 @@ void configure_pins( uint32_t pins, uint16_t config )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void opentxBootloader();
|
||||||
|
|
||||||
void boardInit()
|
void boardInit()
|
||||||
{
|
{
|
||||||
register Pio *pioptr ;
|
register Pio *pioptr ;
|
||||||
@@ -539,33 +541,35 @@ void boardInit()
|
|||||||
|
|
||||||
PMC->PMC_PCER0 = (1<<ID_PIOC)|(1<<ID_PIOB)|(1<<ID_PIOA)|(1<<ID_UART0) ; // Enable clocks to PIOB and PIOA and PIOC and UART0
|
PMC->PMC_PCER0 = (1<<ID_PIOC)|(1<<ID_PIOB)|(1<<ID_PIOA)|(1<<ID_UART0) ; // Enable clocks to PIOB and PIOA and PIOC and UART0
|
||||||
|
|
||||||
|
PIOC->PIO_PER = PIO_PC25 ; // Enable bit C25 (USB-detect)
|
||||||
|
|
||||||
|
#if defined(REVX)
|
||||||
|
if (usbPlugged()) {
|
||||||
|
lcdInit() ;
|
||||||
|
opentxBootloader();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(REVA)
|
#if defined(REVA)
|
||||||
// On REVB, PA21 is used as AD8, and measures current consumption.
|
// On REVB, PA21 is used as AD8, and measures current consumption.
|
||||||
pioptr = PIOA ;
|
pioptr = PIOA ;
|
||||||
pioptr->PIO_PER = PIO_PA21 ; // Enable bit A21 (EXT3)
|
pioptr->PIO_PER = PIO_PA21 ; // Enable bit A21 (EXT3)
|
||||||
pioptr->PIO_OER = PIO_PA21 ; // Set bit A21 as output
|
pioptr->PIO_OER = PIO_PA21 ; // Set bit A21 as output
|
||||||
pioptr->PIO_SODR = PIO_PA21 ; // Set bit A21 ON
|
pioptr->PIO_SODR = PIO_PA21 ; // Set bit A21 ON
|
||||||
#else
|
|
||||||
pwrInit() ;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// pioptr->PIO_PUER = 0x80000000 ; // Enable pullup on bit A31 (EXIT)
|
|
||||||
// pioptr->PIO_PER = 0x80000000 ; // Enable bit A31
|
|
||||||
|
|
||||||
pioptr = PIOC ;
|
|
||||||
pioptr->PIO_PER = PIO_PC25 ; // Enable bit C25 (USB-detect)
|
|
||||||
// pioptr->PIO_OER = 0x80000000L ; // Set bit C31 as output
|
|
||||||
// pioptr->PIO_SODR = 0x80000000L ; // Set bit C31
|
|
||||||
|
|
||||||
#if defined(REVA)
|
|
||||||
// Configure RF_power (PC17) and PPM-jack-in (PC19), neither need pullups
|
// Configure RF_power (PC17) and PPM-jack-in (PC19), neither need pullups
|
||||||
pioptr->PIO_PER = 0x000A0000L ; // Enable bit C19, C17
|
pioptr->PIO_PER = 0x000A0000L ; // Enable bit C19, C17
|
||||||
pioptr->PIO_ODR = 0x000A0000L ; // Set bits C19 and C17 as input
|
pioptr->PIO_ODR = 0x000A0000L ; // Set bits C19 and C17 as input
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !defined(REVA)
|
||||||
|
pwrInit() ;
|
||||||
|
#endif
|
||||||
|
|
||||||
config_free_pins() ;
|
config_free_pins() ;
|
||||||
|
|
||||||
// Next section configures the key inputs on the LCD data
|
// Next section configures the key inputs on the LCD data
|
||||||
|
pioptr = PIOC;
|
||||||
#if defined(REVA)
|
#if defined(REVA)
|
||||||
pioptr->PIO_PER = 0x0000003DL ; // Enable bits 2,3,4,5, 0
|
pioptr->PIO_PER = 0x0000003DL ; // Enable bits 2,3,4,5, 0
|
||||||
pioptr->PIO_OER = PIO_PC0 ; // Set bit 0 output
|
pioptr->PIO_OER = PIO_PC0 ; // Set bit 0 output
|
||||||
|
|||||||
Reference in New Issue
Block a user