概述
void WaveRecorder_kaishi(void)
{
WaveRecorderInit(32000,16, 1); //录音初始化 32KHZ 16位数据 单通道
WaveCounter = 0;
LED_Toggle = 7;
num_shu=0;
STMFLASH_CACHU(); //整片擦除的是地址0x0802 0000 - 0x0803 FFFF 和 0x0804 0000 - 0x0805 FFFF 两个扇区
/* Start the record 开始录音*/
WaveRecorderStart(RecBuf, PCM_OUT_SIZE);
/* Reset the time base variable重置时间基变量 */
Time_Rec_Base = 0;
Switch = 0;
while(1)
{
/* Wait for the recording time 等待录音时间 */
if (num_shu*32 < 262144)
{
/* Wait for the data to be ready with PCM form 等待数据以PCM的形式准备好*/
while(Data_Status == 0);
Data_Status =0;
LED_Toggle = 3;
if (Switch ==1)
{
pAudioRecBuf = RecBuf;
writebuffer = RecBuf1;
WaveCounter += 32;
Switch = 0;
}
else
{
pAudioRecBuf = RecBuf1;
writebuffer = RecBuf;
WaveCounter += 32;
Switch = 1;
}
for (counter=0; counter<16; counter++)
{
LED_Toggle = 3;
if (buf_idx< RAM_BUFFER_SIZE)
{
/* Store Data in RAM buffer */
RAM_Buf[buf_idx++]= *(writebuffer + counter);
if (buf_idx1 == RAM_BUFFER_SIZE)
{
buf_idx1 = 0;
/* Write the stored data in the RAm to the USB Key 将存储的数据写入到USB密匙中 */
STMFLASH_Write(0x08020000+(num_shu*32),(uint32_t*)RAM_Buf1,RAM_BUFFER_SIZE/2);
}
}
else if (buf_idx1< RAM_BUFFER_SIZE)
{
/* Store Data in RAM buffer 在RAM缓冲器中存储数据 */
RAM_Buf1[buf_idx1++]= *(writebuffer + counter);
if (buf_idx == RAM_BUFFER_SIZE)
{
buf_idx = 0;
/* Write the stored data in the RAM to the USB Key */
STMFLASH_Write(0x08020000+(num_shu*32),(uint32_t*)RAM_Buf,RAM_BUFFER_SIZE/2);
}
}
}
}
else /* End of Recording time 记录结束时间 */
{
WaveRecorderStop();
LED_Toggle = 4;
luyin = 2;
Data_Status =0;
AUDIO_SZE=262144;
break;
}
}
void AUDIO_REC_SPI_IRQHANDLER(void)
{
u16 volume;
u16 app;
/* Check if data are available in SPI Data register 检查SPI数据寄存器中的数据是否可用 */
if (SPI_GetITStatus(SPI2, SPI_I2S_IT_RXNE) != RESET)
{
app = SPI_I2S_ReceiveData(SPI2);
InternalBuffer[InternalBufferSize++] = HTONS(app);
/* Check to prevent overflow condition 检查防止溢出条件 */
if (InternalBufferSize >= INTERNAL_BUFF_SIZE)
{
InternalBufferSize = 0;
volume = 50;
PDM_Filter_64_LSB((uint8_t *)InternalBuffer, (uint16_t *)pAudioRecBuf, volume , (PDMFilter_InitStruct *)&Filter);
Data_Status = 1; //代表PDM转PCM转换完毕
num_shu++;
}
}
}
最后
以上就是粗犷小海豚为你收集整理的matlab pdm转pcm_关于PDM转PCM数据存入内部flash问题的全部内容,希望文章能够帮你解决matlab pdm转pcm_关于PDM转PCM数据存入内部flash问题所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复