📄 key.c
字号:
#include "stdio.h"#include "hardware.h"#include "sdio.h"#include "zlg7289.h"#include "message.h"unsigned char keymap[]={7,4,1,0,0,0,0,0,8,5, 2,0,11,0,0,0,9,6,3,16, 12,13,0,0,14,0,15,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0 };void Delay(int t){ int i; for(;t>0;t--) for(i=0;i<400;i++);}char getkey(){ char key; INTMSK|=(0X1<<26); ZLG7289_ENABLE(); sendsiodata(ZLG7289_CMD_RDKEY); key=readsiodata(); ZLG7289_DISABLE(); INTMSK&=(~0X1<<26); key=keymap[key]; return key;}int led_showdata(unsigned int a){ int i=0; INTMSK|=(0X1<<26); ZLG7289_ENABLE(); sendsiodata(ZLG7289_CMD_RST); Delay(20); a%=100000000; for(i=0;i<8 && a !=0 ;i++) { sendsiodata(ZLG7289_CMD_DATA1|i); // sendsiodata(a%10); a/=10; Delay(10); } for(;i<8;i++) { sendsiodata(ZLG7289_CMD_DATA0|i); sendsiodata(0xf); Delay(10); } ZLG7289_DISABLE(); INTMSK&=(~0X1<<26); return 0;}int led_cmd(char cmd){ INTMSK|=(0X1<<26); ZLG7289_ENABLE(); sendsiodata(cmd); ZLG7289_DISABLE(); INTMSK&=(~0X1<<26); return 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -