CGPIOPin usbGadgetPin(usbGadgetPinNumber, GPIOModeInputPullUp);

probonopd-try-USBGadgetPin
probonopd 4 months ago committed by GitHub
parent 9c36abdb3a
commit b5b457a04b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 5
      src/config.cpp

@ -39,9 +39,8 @@ void CConfig::Load (void)
m_bUSBGadgetMode = m_Properties.GetNumber ("USBGadget", 0) != 0; m_bUSBGadgetMode = m_Properties.GetNumber ("USBGadget", 0) != 0;
unsigned usbGadgetPinNumber = m_Properties.GetNumber ("USBGadgetPin", 26); // Default to GPIO pin 26 if not specified unsigned usbGadgetPinNumber = m_Properties.GetNumber ("USBGadgetPin", 26); // Default to GPIO pin 26 if not specified
CGPIOPin usbGadgetPin(usbGadgetPinNumber); CGPIOPin usbGadgetPin(usbGadgetPinNumber, GPIOModeInputPullUp);
usbGadgetPin.Input();
usbGadgetPin.PullUp(); // Enable the internal pull-up resistor
if (usbGadgetPin.Read() == 0) // If the pin is pulled down if (usbGadgetPin.Read() == 0) // If the pin is pulled down
{ {
m_bUSBGadgetMode = true; m_bUSBGadgetMode = true;

Loading…
Cancel
Save