Final version.
Fork of F746_SAI_IO by
Diff: SAI_InOut.cpp
- Revision:
- 1:48ed86c8430a
- Parent:
- 0:eade5d3ae0eb
- Child:
- 2:1aef7b703249
--- a/SAI_InOut.cpp Thu May 05 11:12:45 2016 +0000 +++ b/SAI_InOut.cpp Mon May 09 08:32:03 2016 +0000 @@ -1,6 +1,6 @@ //----------------------------------------------------------- // SiaIO class -// 2016/05/05, Copyright (c) 2016 MIKAMI, Naoki +// 2016/05/09, Copyright (c) 2016 MIKAMI, Naoki //----------------------------------------------------------- #include "SAI_InOut.hpp" @@ -70,6 +70,14 @@ xR = inBuffer_[inIndex_++]; } + void SaiIO::PlayOut() + { + if (BSP_AUDIO_OUT_Play((uint16_t *)outBuffer_, + bufferSize_*AUDIODATA_SIZE) == AUDIO_ERROR) + ErrorTrap(); + ClearBuffer(); + } + bool SaiIO::IsXferred() { if (!xferred_) return false; @@ -152,16 +160,14 @@ NVIC_SetVector(AUDIO_OUT_SAIx_DMAx_IRQ, (uint32_t)AUDIO_OUT_SAIx_DMAx_IRQHandler); BSP_AUDIO_OUT_SetAudioFrameSlot(CODEC_AUDIOFRAME_SLOT_02); - - if (BSP_AUDIO_OUT_Play((uint16_t *)outBuffer_, - bufferSize_*AUDIODATA_SIZE) == AUDIO_ERROR) - ErrorTrap(); // Set output volume of headphone maximum // AUDIO_IO_Write() is defined in "stm32746g_discovery.c" // AUDIO_I2C_ADDRESS is defined in "stm32746g_discovery.h" AUDIO_IO_Write(AUDIO_I2C_ADDRESS, 0x1C, 0x17F); // 0x1C: R28 of WM8994 AUDIO_IO_Write(AUDIO_I2C_ADDRESS, 0x1D, 0x17F); // 0x1D: R29 of WM8994 + + PlayOut(); } void SaiIO::ClearBuffer() @@ -196,4 +202,3 @@ int16_t* SaiIO::tmp_; __IO bool SaiIO::xferred_; } -