Disable VBUSSENSING features on PA9 completely

This commit is contained in:
jflyper 2018-04-13 02:07:58 +09:00
parent 3cf1851382
commit 78bc3f52ad
2 changed files with 11 additions and 7 deletions

View File

@ -318,6 +318,7 @@ USB_OTG_STS USB_OTG_SelectCore(USB_OTG_CORE_HANDLE *pdev,
return status; return status;
} }
#include "build/debug.h"
/** /**
* @brief USB_OTG_CoreInit * @brief USB_OTG_CoreInit
@ -391,10 +392,10 @@ USB_OTG_STS USB_OTG_CoreInit(USB_OTG_CORE_HANDLE *pdev)
/* Deactivate the power down*/ /* Deactivate the power down*/
gccfg.d32 = 0; gccfg.d32 = 0;
gccfg.b.pwdn = 1; gccfg.b.pwdn = 1;
#ifdef VBUS_SENSING_ENABLED
gccfg.b.vbussensingA = 1 ; gccfg.b.vbussensingA = 1 ;
gccfg.b.vbussensingB = 1 ; gccfg.b.vbussensingB = 1 ;
#else
#ifndef VBUS_SENSING_ENABLED
gccfg.b.disablevbussensing = 1; gccfg.b.disablevbussensing = 1;
#endif #endif

View File

@ -28,13 +28,13 @@
#include "sdcard.h" #include "sdcard.h"
#ifdef USB_DETECT_PIN #ifdef USE_USB_DETECT
static IO_t usbDetectPin = IO_NONE; static IO_t usbDetectPin = IO_NONE;
#endif #endif
void usbCableDetectDeinit(void) void usbCableDetectDeinit(void)
{ {
#ifdef USB_DETECT_PIN #ifdef USE_USB_DETECT
IOInit(usbDetectPin, OWNER_FREE, 0); IOInit(usbDetectPin, OWNER_FREE, 0);
IOConfigGPIO(usbDetectPin, IOCFG_IN_FLOATING); IOConfigGPIO(usbDetectPin, IOCFG_IN_FLOATING);
usbDetectPin = IO_NONE; usbDetectPin = IO_NONE;
@ -43,7 +43,10 @@ void usbCableDetectDeinit(void)
void usbCableDetectInit(void) void usbCableDetectInit(void)
{ {
#ifdef USB_DETECT_PIN #ifdef USE_USB_DETECT
#ifndef USB_DETECT_PIN
#define USB_DETECT_PIN NONE
#endif
usbDetectPin = IOGetByTag(IO_TAG(USB_DETECT_PIN)); usbDetectPin = IOGetByTag(IO_TAG(USB_DETECT_PIN));
IOInit(usbDetectPin, OWNER_USB_DETECT, 0); IOInit(usbDetectPin, OWNER_USB_DETECT, 0);
@ -55,7 +58,7 @@ bool usbCableIsInserted(void)
{ {
bool result = false; bool result = false;
#ifdef USB_DETECT_PIN #ifdef USE_USB_DETECT
result = IORead(usbDetectPin) != 0; result = IORead(usbDetectPin) != 0;
#endif #endif