|
#include "sys.h"
void All_Init(void);
void Board_text(unsigned int Code_Val);
int main()
{
All_Init(); //全部初始化
printf("\r\n您请说(^_^)\r\n");
while(1)
{
IWDG_Feed(); //喂狗
LD3320_Subject(); //运行LD3320程序
Board_text(nAsrRes); //LD3320识别到后会运行的程序
}
}
void All_Init(void)
{
NVIC_Configuration(); //设置NVIC中断分组
delay_init(); //延时初始化
uart_init(9600); //串口初始化
LD3320_init(); //LD3320初始化
IWDG_Init(7,625); //看门狗初始化.喂狗8S一次
}
//识别到后会运行的程序
void Board_text(unsigned int Code_Val)
{
if(LD3320_Identified_Flag_bit == LD_ASR_FOUNDOK )
{
LD3320_Identified_Flag_bit=LD_ASR_NONE;
switch(Code_Val) //对结果执行相关操作
{
case CODE_Hello:
printf("你好!");
break;
case CODE_ZWD_ON:
printf("主卧灯已开");
break;
case CODE_ZWD_OFF:
printf("主卧灯已关");
break;
case CODE_CWD_ON:
printf("次卧灯已开");
break;
case CODE_CWD_OFF:
printf("次卧灯已关");
break;
case CODE_CF_ON:
printf("厨房灯已开");
break;
case CODE_CF_OFF:
printf("厨房灯已关");
break;
case CODE_KT_ON:
printf("客厅灯已开");
break;
case CODE_KT_OFF:
printf("客厅灯已关");
break;
case CODE_FC_ON:
printf("风扇已开");
break;
case CODE_FC_OFF:
printf("风扇已关");
break;
case CODE_Self_intr:
break;
case CODE_name:
break;
case CODE_ALL_ON:
printf("全开");
break;
case CODE_ALL_OFF:
printf("全关");
break;
case CODE_GRMS:
printf("单人模式开,普通模式关闭");
break;
case CODE_PTMS:
printf("普通模式开,单人模式关闭");
break;
case CODE_WSDJM:
printf("温湿度");
break;
case CODE_GDJM:
printf("光度");
break;
default:break;
}
}
}
|
|