From 75e82caf72c2154c9c3c909835d09d005bbc24bc Mon Sep 17 00:00:00 2001 From: probonopd Date: Fri, 5 Jul 2024 18:58:01 +0200 Subject: [PATCH] Try USBGadgetPin (#670) * Try USBGadgetPin * CGPIOPin usbGadgetPin(usbGadgetPinNumber, GPIOModeInputPullUp); * Remove extraneous line --- src/config.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/config.cpp b/src/config.cpp index ea6bde3..ad55d13 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -22,6 +22,7 @@ // #include "config.h" #include "../Synth_Dexed/src/dexed.h" +#include CConfig::CConfig (FATFS *pFileSystem) : m_Properties ("minidexed.ini", pFileSystem) @@ -37,6 +38,13 @@ void CConfig::Load (void) m_Properties.Load (); 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, GPIOModeInputPullUp); + + if (usbGadgetPin.Read() == 0) // If the pin is pulled down + { + m_bUSBGadgetMode = true; + } m_SoundDevice = m_Properties.GetString ("SoundDevice", "pwm");