主程序源码
int main(void)
{
u8 stauts = 1,key;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE);
GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable,ENABLE);
delay_init(); //延时函数初始化
KEY_GPIO_Init(); //按键初始化
RELAY_INIT();
Human_induction_Iint();
BEEP_DISENABLE();
delay_ms(100); //上电瞬间加入一定延时在初始化
LCD_Init(); //屏幕初始化
LCD_Write_String(0,0,"Please Bush Card");
CHECK_NEW_MCU();
TIM2_Init(1000,719); //以100Hz计数
UART1_INIT((u32)9600);
RC522_Init();
PcdReset (); //复位RC522
M500PcdConfigISOType ( 'A' );//设置工作方式
while(1)
{
if(key == 1) stauts = !stauts;
if(stauts)
key = COMPER_ID_MODE();
else
{
key = 2;
while(key != 1)
{
switch(key)
{
case 2: key = ADD_ID_MODE(); break;
case 3: key = DEL_ID_MODE(); break;
case 4: CLEAR_ALL_MES(); key = 2; break;
default : break;
}
}
}
}
}
|