Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions libraries/PDM/src/PDM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,26 @@ bool AP3_PDM::begin(pin_size_t pinPDMData, pin_size_t pinPDMClock)
return (true);
}

bool AP3_PDM::end()
{
uint32_t retval = am_hal_pdm_disable(_PDMhandle);
if (retval != AP3_OK)
{
return false;
}
retval = (uint32_t)am_hal_pdm_power_control(_PDMhandle, AM_HAL_PDM_POWER_OFF, false);
if (retval != AP3_OK)
{
return retval;
}
retval = am_hal_pdm_deinitialize(_PDMhandle);
if (retval != AP3_OK)
{
return false;
}
return true;
}

bool AP3_PDM::available(void)
{
if (buff1New || buff2New)
Expand Down
1 change: 1 addition & 0 deletions libraries/PDM/src/PDM.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ class AP3_PDM
//AP3_PDM(uint16_t *userBuffer, uint32_t bufferSize);

bool begin(pin_size_t pinPDMData = MIC_DATA, pin_size_t pinPDMClock = MIC_CLOCK);
bool end();
bool available(void); //Goes true if circular buffer is not empty
bool isOverrun(void); //Goes true if head crosses tail

Expand Down