Skip to content

Commit

Permalink
Reset GPIO pin state on Pisound destruction
Browse files Browse the repository at this point in the history
Fixes #233.
  • Loading branch information
dwhinham committed Jan 20, 2022
1 parent c4162e9 commit 1acc660
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- A bug in the config file reader (unterminated string) could cause the last entry in the file to be read as a corrupted value if the file ended without a newline.
- Some FTP commands could work without being logged in.
- Some DAC accessories which make use of a hardware "mute" pin (e.g. Adafruit I²S Audio Bonnet) could be held in a muted state due to a conflict with the Blokas Pisound driver's probing routine (issue #233). The driver now resets these GPIO pins to the initial power-on state, which should fix this issue. Thanks to @htamas2 for the report!

## [0.11.0] - 2021-12-12

Expand Down
1 change: 1 addition & 0 deletions include/pisound.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class CPisound
using TMIDIReceiveHandler = void (*)(const u8* pData, size_t nSize);

CPisound(CSPIMaster* pSPIMaster, CGPIOManager* pGPIOManager, unsigned nSamplerate);
~CPisound();

bool Initialize();
void RegisterMIDIReceiveHandler(TMIDIReceiveHandler pHandler) { m_pReceiveHandler = pHandler; }
Expand Down
11 changes: 11 additions & 0 deletions src/pisound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,17 @@ CPisound::CPisound(CSPIMaster* pSPIMaster, CGPIOManager* pGPIOManager, unsigned
{
}

CPisound::~CPisound()
{
// Reset GPIO pins to default boot-up state
m_SPIReset.SetMode(TGPIOMode::GPIOModeInputPullDown);
m_DataAvailable.SetMode(TGPIOMode::GPIOModeInputPullDown);
m_ADCReset.SetMode(TGPIOMode::GPIOModeInputPullDown);
m_OversamplingRatio0.SetMode(TGPIOMode::GPIOModeInputPullDown);
m_OversamplingRatio1.SetMode(TGPIOMode::GPIOModeInputPullDown);
m_OversamplingRatio2.SetMode(TGPIOMode::GPIOModeInputPullDown);
}

bool CPisound::Initialize()
{
assert(m_pSPIMaster != nullptr);
Expand Down

0 comments on commit 1acc660

Please sign in to comment.