while (1) {
/* Wait end of half block recording */
while(audio_rec_buffer_state == BUFFER_OFFSET_HALF) {
}
audio_rec_buffer_state = BUFFER_OFFSET_NONE;
/* Copy recorded 1st half block */
memcpy((uint16_t *)(AUDIO_BUFFER_OUT), (uint16_t *)(AUDIO_BUFFER_IN), AUDIO_BLOCK_SIZE);
/* Wait end of one block recording */
while(audio_rec_buffer_state == BUFFER_OFFSET_FULL) {
}
audio_rec_buffer_state = BUFFER_OFFSET_NONE;
/* Copy recorded 2nd half block */
memcpy((uint16_t *)(AUDIO_BUFFER_OUT + (AUDIO_BLOCK_SIZE)), (uint16_t *)(AUDIO_BUFFER_IN
+ (AUDIO_BLOCK_SIZE)), AUDIO_BLOCK_SIZE);
}
}
/*-------------------------------------------------------------------------------------
Callbacks implementation:
the callbacks API are defined __weak in the stm32746g_discovery_audio.c file
and their implementation should be done in the user code if they are needed.
Below some examples of callback implementations.
-------------------------------------------------------------------------------------*/
/**
* @brief Manages the DMA Transfer complete interrupt.
* @param None
* @retval None
*/
void BSP_AUDIO_IN_TransferComplete_CallBack(void)
{
audio_rec_buffer_state = BUFFER_OFFSET_FULL;
return;
}