- UID
- 1062083
- 性别
- 男
|
本帖最后由 yuchengze 于 2016-12-27 11:35 编辑
1、STM32的用户 可以直接 在工程里面 添加如下4个文件1》LD3320_main.c 2》LDChip.c 3》Reg_RW.c 4》delay.c
2、51的用户同时可以根据以上操作来做相关的修改。
ldchip.c
- /************************************************************************************
- ** 版权所有:Copyright (c) 2005 - 2010 ICRoute INC.
- ** 硬件说明:STM32f103vet6 8MHZ 内部时钟为72MHZ
- ** LD3320 有源晶振 12MHZ 不同的晶振请修改LDChip.h 中的定义值(#define CLK_IN 12)
- ** 软件说明:并行读写寄存器方式,如采用其他方式即修改Reg_RW.c 文件即可!
- ** 时间:2011.10.15
- ** 说明:本程序修改于 ICRoute公司 配套的源程序,版权归其所有。
- ************************************************************************************/
- #include <stm32f10x_conf.h>
- #include <stm32f10x.h>
- #include "LDChip.h"
- #include "Reg_RW.h"
- #include "gui_include.h"
- uint8 nLD_Mode = LD_MODE_IDLE; // 用来记录当前是在进行ASR识别还是在播放MP3
- uint8 ucRegVal;
- uint8 ucHighInt;
- uint8 ucLowInt;
- extern uint8 nAsrStatus;
- void ProcessInt0(void);
- /************************************************************************
- 功能描述: 芯片硬件初始化
- 调用函数:
- 入口参数:
- 返回函数:
- **************************************************************************/
- void LD_reset(void)
- {
- LD_RST_H();
- LD3320_delay(10);
- LD_RST_L();
- LD3320_delay(10);
- LD_RST_H();
- LD3320_delay(10);
- LD_CS_L();
- LD3320_delay(10);
- LD_CS_H();
- LD3320_delay(10);
- }
- /************************************************************************
- 功能描述: 初始化命令 软初始化
- 调用函数:
- 入口参数:
- 返回函数:
- **************************************************************************/
- void LD_Init_Common(void)
- {
- LD_ReadReg(0x06);
- LD_WriteReg(0x17, 0x35);
- LD3320_delay(10);
- LD_ReadReg(0x06);
- LD_WriteReg(0x89, 0x03);
- LD3320_delay(5);
- LD_WriteReg(0xCF, 0x43);
- LD3320_delay(5);
- LD_WriteReg(0xCB, 0x02);
- /*PLL setting*/
- LD_WriteReg(0x11, LD_PLL_11);
- if (nLD_Mode == LD_MODE_MP3)
- {
- LD_WriteReg(0x1E, 0x00);
- LD_WriteReg(0x19, LD_PLL_MP3_19);
- LD_WriteReg(0x1B, LD_PLL_MP3_1B);
- LD_WriteReg(0x1D, LD_PLL_MP3_1D);
- }
- else
- {
- LD_WriteReg(0x1E,0x00);
- LD_WriteReg(0x19, LD_PLL_ASR_19);
- LD_WriteReg(0x1B, LD_PLL_ASR_1B);
- LD_WriteReg(0x1D, LD_PLL_ASR_1D);
- }
- LD3320_delay(10);
- LD_WriteReg(0xCD, 0x04);
- LD_WriteReg(0x17, 0x4c);
- LD3320_delay(5);
- LD_WriteReg(0xB9, 0x00);
- LD_WriteReg(0xCF, 0x4F);
- LD_WriteReg(0x6F, 0xFF);
- }
- /************************************************************************
- 功能描述: 初始化ASR
- 调用函数:
- 入口参数:
- 返回函数:
- **************************************************************************/
- void LD_Init_ASR(void)
- {
- nLD_Mode=LD_MODE_ASR_RUN;
- LD_Init_Common();
- LD_WriteReg(0xBD, 0x00);
- GUI_DispDecAt(LD_ReadReg(0xBD),300,20,3); //text................................
- LD_WriteReg(0x17, 0x48);
- LD3320_delay( 10 );
- LD_WriteReg(0x3C, 0x80);
- GUI_DispDecAt(LD_ReadReg(0x3C),300,40,3); //1 text................................
- LD_WriteReg(0x3E, 0x07);
- GUI_DispDecAt(LD_ReadReg(0x3e),300,60,3); //text................................
- LD_WriteReg(0x38, 0xff);
- GUI_DispDecAt(LD_ReadReg(0x38),300,80,3); //text................................
- LD_WriteReg(0x3A, 0x07);
- GUI_DispDecAt(LD_ReadReg(0x3a),300,100,3); //text................................
- LD_WriteReg(0x40, 0);
- GUI_DispDecAt(LD_ReadReg(0x40),300,120,3); //text................................
- LD_WriteReg(0x42, 8);
- GUI_DispDecAt(LD_ReadReg(0x42),300,140,3); //text................................
- LD_WriteReg(0x44, 0);
- GUI_DispDecAt(LD_ReadReg(0x44),300,160,3); //text................................
- LD_WriteReg(0x46, 8);
- GUI_DispDecAt(LD_ReadReg(0x46),300,180,3); //text................................
- LD3320_delay( 1 );
- }
- /************************************************************************
- 功能描述: 识别处理函数 ,可以利用查询方式,或中断方式进行调用
- 调用函数:
- 入口参数:
- 返回函数:
- **************************************************************************/
- void ProcessInt0(void)
- {
|
|