Skip to content

Commit

Permalink
audio: Keep audio initialized after first
Browse files Browse the repository at this point in the history
Trying to avoid DC adjustment happening on every recording
  • Loading branch information
jonnor committed Jul 13, 2020
1 parent 3ff6c9e commit ab6e696
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
9 changes: 9 additions & 0 deletions Drivers/BSP/STM32L496G-Discovery/stm32l496g_discovery_audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ b) RECORD A FILE:
#include <string.h>
#include "stm32l496g_discovery_audio.h"

#include <stdbool.h>

/** @addtogroup BSP
* @{
*/
Expand Down Expand Up @@ -781,6 +783,12 @@ uint8_t BSP_AUDIO_IN_Init(uint32_t AudioFreq, uint32_t BitRes, uint32_t ChnlNbr)
*/
uint8_t BSP_AUDIO_IN_InitEx(uint16_t InputDevice, uint32_t AudioFreq, uint32_t BitRes, uint32_t ChnlNbr)
{
static bool audio_initialized = false;

if (audio_initialized) {
return AUDIO_OK;
}

/* Update the audio input context */
hAudioIn.AudioDrv = &cs42l51_drv;
hAudioIn.InputDevice = InputDevice;
Expand Down Expand Up @@ -857,6 +865,7 @@ uint8_t BSP_AUDIO_IN_InitEx(uint16_t InputDevice, uint32_t AudioFreq, uint32_t B
DmaRightRecHalfBuffCplt = 0;
DmaRightRecBuffCplt = 0;

audio_initialized = true;
return AUDIO_OK;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,11 +358,13 @@ AUDIO_RECORDER_ErrorTypdef AUDIO_RECORDER_StopRec(void)
Error_Handler();
}

#if 0
if(BSP_AUDIO_IN_DeInit() == AUDIO_ERROR)
{
Error_Handler();
}

#endif

// /* Configure SD IT pin */
// BSP_SD_Init();
//
Expand Down

0 comments on commit ab6e696

Please sign in to comment.