fix issue nrf52840 not reset properly when upgrading bootloader+sd combo

- root cause tusb_task()/cdc task is called when usb is not inited (in
case of sd upgrade)
This commit is contained in:
hathach
2018-12-20 00:50:14 +07:00
parent fc13287837
commit 5c38bc8957
3 changed files with 16 additions and 3 deletions

View File

@ -65,8 +65,20 @@ extern void tusb_hal_nrf_power_event(uint32_t event);
//------------- IMPLEMENTATION -------------//
static bool _inited = false;
bool usb_inited(void)
{
return _inited;
}
void usb_init(bool cdc_only)
{
// skipped if already inited
if ( _inited ) return;
_inited = true;
// USB power may already be ready at this time -> no event generated
// We need to invoke the handler based on the status initially
uint32_t usb_reg;