Your ROOT_URL in app.ini is https://source.parasitstudio.de:63000/ but you are visiting https://source.parasitstudio.de/wirtz/MiniDexed/commit/2bcb8b192c17f75c446c3d4ed9c2d1f51065bbb3?style=unified&whitespace=ignore-change
You should set ROOT_URL correctly, otherwise the web may not work correctly.
4 changed files with
79 additions and
15 deletions
src/config.cpp
src/config.h
src/kernel.cpp
src/minidexed.cpp
@ -22,7 +22,6 @@
//
# include "config.h"
# include "../Synth_Dexed/src/dexed.h"
# include <circle/gpiopin.h>
CConfig : : CConfig ( FATFS * pFileSystem )
: m_Properties ( " minidexed.ini " , pFileSystem )
@ -37,14 +36,9 @@ 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_bUSBGadget = m_Properties . GetNumber ( " USBGadget " , 0 ) ! = 0 ;
m_nUSBGadgetPin = m_Properties . GetNumber ( " USBGadgetPin " , 0 ) ; // Default OFF
SetUSBGadgetMode ( m_bUSBGadget ) ; // Might get overriden later by USBGadgetPin state
m_SoundDevice = m_Properties . GetString ( " SoundDevice " , " pwm " ) ;
@ -183,11 +177,26 @@ void CConfig::Load (void)
m_bPerformanceSelectChannel = m_Properties . GetNumber ( " PerformanceSelectChannel " , 0 ) ;
}
bool CConfig : : GetUSBGadget ( void ) const
{
return m_bUSBGadget ;
}
unsigned CConfig : : GetUSBGadgetPin ( void ) const
{
return m_nUSBGadgetPin ;
}
bool CConfig : : GetUSBGadgetMode ( void ) const
{
return m_bUSBGadgetMode ;
}
void CConfig : : SetUSBGadgetMode ( bool USBGadgetMode )
{
m_bUSBGadgetMode = USBGadgetMode ;
}
const char * CConfig : : GetSoundDevice ( void ) const
{
return m_SoundDevice . c_str ( ) ;
@ -68,7 +68,10 @@ public:
void Load ( void ) ;
// USB Mode
bool GetUSBGadgetMode ( void ) const ; // true if in USB gadget mode
bool GetUSBGadget ( void ) const ;
unsigned GetUSBGadgetPin ( void ) const ;
bool GetUSBGadgetMode ( void ) const ; // true if in USB gadget mode depending on USBGadget and USBGadgetPin
void SetUSBGadgetMode ( bool USBGadgetMode ) ;
// Sound device
const char * GetSoundDevice ( void ) const ;
@ -192,6 +195,8 @@ public:
private :
CPropertiesFatFsFile m_Properties ;
bool m_bUSBGadget ;
unsigned m_nUSBGadgetPin ;
bool m_bUSBGadgetMode ;
std : : string m_SoundDevice ;
@ -20,6 +20,7 @@
# include "kernel.h"
# include <circle/logger.h>
# include <circle/synchronize.h>
# include <circle/gpiopin.h>
# include <assert.h>
# include <circle/usb/usbhcidevice.h>
# include "usbminidexedmidigadget.h"
@ -93,7 +94,29 @@ bool CKernel::Initialize (void)
}
}
if ( m_Config . GetUSBGadgetMode ( ) )
bool bUSBGadgetMode = false ;
if ( m_Config . GetUSBGadget ( ) )
{
unsigned nUSBGadgetPin = m_Config . GetUSBGadgetPin ( ) ;
if ( nUSBGadgetPin = = 0 )
{
// No hardware config option
bUSBGadgetMode = true ;
}
else
{
// State of USB Gadget Mode determined by state of the pin.
// Pulled down = enable USB Gadget mode
CGPIOPin usbGadgetPin ( nUSBGadgetPin , GPIOModeInputPullUp ) ;
if ( usbGadgetPin . Read ( ) = = 0 )
{
bUSBGadgetMode = true ;
}
}
}
if ( bUSBGadgetMode )
{
# if RASPPI==5
# warning No support for USB Gadget Mode on RPI 5 yet
@ -107,6 +130,7 @@ bool CKernel::Initialize (void)
// Run the USB stack in USB Host (default) mode
m_pUSB = new CUSBHCIDevice ( & mInterrupt , & mTimer , TRUE ) ;
}
m_Config . SetUSBGadgetMode ( bUSBGadgetMode ) ;
if ( ! m_pUSB - > Initialize ( ) )
{
@ -102,18 +102,44 @@ CMiniDexed::CMiniDexed (CConfig *pConfig, CInterruptSystem *pInterrupt,
m_pTG [ i ] - > activate ( ) ;
}
if ( pConfig - > GetUSBGadgetMode ( ) )
unsigned nUSBGadgetPin = pConfig - > GetUSBGadgetPin ( ) ;
bool bUSBGadget = pConfig - > GetUSBGadget ( ) ;
bool bUSBGadgetMode = pConfig - > GetUSBGadgetMode ( ) ;
if ( bUSBGadgetMode )
{
# if RASPPI==5
LOGNOTE ( " USB Gadget (Device) Mode NOT supported on RPI 5 " ) ;
# else
if ( nUSBGadgetPin = = 0 )
{
LOGNOTE ( " USB In Gadget (Device) Mode " ) ;
}
else
{
LOGNOTE ( " USB In Gadget (Device) Mode [USBGadgetPin %d = LOW] " , nUSBGadgetPin ) ;
}
# endif
}
else
{
if ( bUSBGadget )
{
if ( nUSBGadgetPin = = 0 )
{
// This shouldn't be possible...
LOGNOTE ( " USB State Unknown " ) ;
}
else
{
LOGNOTE ( " USB In Host Mode [USBGadgetPin %d = HIGH] " , nUSBGadgetPin ) ;
}
}
else
{
LOGNOTE ( " USB In Host Mode " ) ;
}
}
for ( unsigned i = 0 ; i < CConfig : : MaxUSBMIDIDevices ; i + + )
{