mirror of https://github.com/ARMmbed/mbed-os.git
STM USBHALHost: Fix NULL pointer dereference
On STM32F746G Discovery boards, the USB OTG HS port does not have a dedicated GPIO for controlling the USB VBUS. This change fixes HardFault (NULL pointer dereference) that triggered when such USB host port was used.pull/10952/head
parent
d40c529320
commit
b9490b8541
|
@ -122,11 +122,18 @@ static gpio_t gpio_powerpin;
|
||||||
|
|
||||||
void usb_vbus(uint8_t state)
|
void usb_vbus(uint8_t state)
|
||||||
{
|
{
|
||||||
|
if (gpio_powerpin.reg_set && gpio_powerpin.reg_clr)
|
||||||
|
{
|
||||||
if (state == 0) {
|
if (state == 0) {
|
||||||
gpio_write(&gpio_powerpin, USB_POWER_OFF);
|
gpio_write(&gpio_powerpin, USB_POWER_OFF);
|
||||||
} else {
|
} else {
|
||||||
gpio_write(&gpio_powerpin, USB_POWER_ON);
|
gpio_write(&gpio_powerpin, USB_POWER_ON);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* The board does not have GPIO pin to control usb supply */
|
||||||
|
}
|
||||||
wait(0.2);
|
wait(0.2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue