Skip to content

Commit

Permalink
Set usb_state to disconnected immediately after cable deatch, instead…
Browse files Browse the repository at this point in the history
… of waiting to the main loop poll to update the status.
  • Loading branch information
gerargz committed Sep 15, 2020
1 parent a48a713 commit 147b1b4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions source/board/microbitv2/power.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "fsl_port.h"
#include "fsl_clock.h"

#include "main.h"
#include "power.h"
#include "IO_Config.h"
#include "uart.h"
Expand All @@ -26,6 +27,7 @@ static void power_enter_mode(app_power_mode_t targetPowerMode);
extern volatile uint8_t wake_from_reset;
extern volatile uint8_t wake_from_usb;
extern volatile bool usb_pc_connected;
extern main_usb_connect_t usb_state;

/*******************************************************************************
* Code
Expand Down Expand Up @@ -63,6 +65,7 @@ void PORTCD_IRQHandler(void)
USBD_Reset();
usbd_reset_core();
usb_pc_connected = false;
usb_state = USB_DISCONNECTED;
}
else {
// Cable inserted
Expand Down

0 comments on commit 147b1b4

Please sign in to comment.