From b5b457a04b060ec0f02d49adca6c39baadc28047 Mon Sep 17 00:00:00 2001 From: probonopd Date: Sat, 29 Jun 2024 17:33:25 +0200 Subject: [PATCH] CGPIOPin usbGadgetPin(usbGadgetPinNumber, GPIOModeInputPullUp); --- src/config.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/config.cpp b/src/config.cpp index ca08310..545b818 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -39,9 +39,8 @@ void CConfig::Load (void) m_bUSBGadgetMode = m_Properties.GetNumber ("USBGadget", 0) != 0; unsigned usbGadgetPinNumber = m_Properties.GetNumber ("USBGadgetPin", 26); // Default to GPIO pin 26 if not specified - CGPIOPin usbGadgetPin(usbGadgetPinNumber); - usbGadgetPin.Input(); - usbGadgetPin.PullUp(); // Enable the internal pull-up resistor + CGPIOPin usbGadgetPin(usbGadgetPinNumber, GPIOModeInputPullUp); + if (usbGadgetPin.Read() == 0) // If the pin is pulled down { m_bUSBGadgetMode = true;