main.c
#include "led.h"
#include "delay.h"
#include "key.h"
#include "sys.h"
#include "usart.h"
#include "rc522.h"
#include "beep.h"
#include "oled.h"
u8 RC522_lock(void);//刷卡解锁
u8 cardid[6]={0,0,0,0,0,0}; //卡号1
//MFRC522数据区
u8 mfrc552pidbuf[18];
u8 card_pydebuf[2];
u8 card_numberbuf[5];
u8 card_key0Abuf[6]={0xff,0xff,0xff,0xff,0xff,0xff};
u8 card_writebuf[16]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
u8 card_readbuf[18];
int main(void)
{
delay_init(); //延时函数初始化
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2); //设置NVIC中断分组2:2位抢占优先级,2位响应优先级
uart_init(115200); //串口初始化为115200
LED_Init(); //LED端口初始化
KEY_Init(); //初始化与按键连接的硬件接口
RC522_Init(); //初始化射频卡模块
// BEEP_Init(); //初始化蜂鸣器
OLED_Init(); //初始化OLED
OLED_Clear(); //清屏
OLED_ShowCHinese(0,5,9); //刷
OLED_ShowCHinese(15,5,2); //卡
OLED_ShowCHinese(30,5,12); //显
OLED_ShowCHinese(45,5,13); //示
while(1)
{
RC522_Handel();
}
}
|