野火电子论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 16979|回复: 2

使用1053b播放mp3,在播放歌曲过程中,一设置音量播放就停止

[复制链接]
发表于 2018-5-13 22:21:41 | 显示全部楼层 |阅读模式
void mp3_play_song(uint8_t *pname)
{         
  uint16_t         br, bw;
        uint8_t         res, resw;                   
        uint16_t         i=0;         
        u16 temp;
       
        res = f_open(&fmp3, (const TCHAR*)pname, FA_READ);       

        if(res != resflag)
        {
                resflag = res;
                printf("res = %d \r\n", res);
        }
       
        if(res==0)
        {
                VS_SPI_SpeedHigh();                                          
                while(1)
                {
                        delayvar += 1;
                        if(delayvar >= 10)
                        {
                                VS_Set_Vol(100);                                                                              一运行到这行播放就停止!!!
                                temp = VS_RD_Reg(SPI_MODE);
                                if(delayvar > 20)
                                {
                                        delayvar = 0;
                                        VS_Set_Vol(220);
                                }
                        }
                        res=f_read(&fmp3, databuf, num2read, (UINT*)&br);
                       
                        i=0;
                        do
                        {         
                                if(VS_Send_MusicData(databuf+i)==0)
                                {
                                        i+=32;
                                }               
                        }while(i<num2read);                       

                        if(br!=num2read||res!=0)
                        {
                                break;                  
                        }                                                          
                }               
        }  
        f_close(&fmp3);
}
我查看了MODE寄存器,是0x0800,请各位大神指导


回复

使用道具 举报

发表于 2018-5-14 08:39:50 | 显示全部楼层
帮顶。。。。。。。。还没学到这儿。。。
回复 支持 反对

使用道具 举报

发表于 2018-5-14 08:53:27 | 显示全部楼层
直接用例程看看
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

联系站长|手机版|野火电子官网|野火淘宝店铺|野火电子论坛 ( 粤ICP备14069197号 ) 大学生ARM嵌入式2群

GMT+8, 2025-12-7 04:44 , Processed in 0.038050 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表