Improve charger detection
This commit is contained in:
@@ -339,6 +339,7 @@
|
||||
#define USB_CHARGER_RCC_AHB1Periph RCC_AHB1Periph_GPIOG
|
||||
#define USB_CHARGER_GPIO GPIOG
|
||||
#define USB_CHARGER_GPIO_PIN GPIO_Pin_11 // PG.11
|
||||
#define USB_USBDet_GPIO_PIN GPIO_Pin_13 // PG.13
|
||||
#else
|
||||
#define USB_CHARGER_RCC_AHB1Periph 0
|
||||
#endif
|
||||
|
||||
@@ -33,6 +33,6 @@ void usbChargerInit()
|
||||
|
||||
bool usbChargerLed()
|
||||
{
|
||||
return GPIO_ReadInputDataBit(USB_CHARGER_GPIO, USB_CHARGER_GPIO_PIN) == Bit_RESET;
|
||||
return GPIO_ReadInputDataBit(USB_CHARGER_GPIO, USB_USBDet_GPIO_PIN) == 0 ? 0 : GPIO_ReadInputDataBit(USB_CHARGER_GPIO, USB_CHARGER_GPIO_PIN) == Bit_RESET;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user