- #include "stm32f10x.h"
- //#include "led.h"
- #include "delay.h"
- #include "key.h"
- #include "sys.h"
- //#include "beep.h"
- #include "oled_iic.h"
- #include "display.h"
- //#include "24cxx.h"
- //#include "myiic.h"
- //#include "timer.h"
- //#include "as608.h"
- //#include "usart3.h"
- //#include "motor.h"
- #include "string.h"
- #include "stdio.h"
-
- int main(void)
- {
- RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE);
- GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable, ENABLE);
- vu8 key=0;
- delay_init();
- HZ= GB16_NUM();
- OLED_Init();
- KEY_Init();
- char str[20];
- OLED_Clear();
-
- while(1)
- {
- key=KEY_Scan(0);
- if(key!=0)
- {
- sprintf(str,"key:%d",key);
- OLED_Clear();
- OLED_ShowCH(0,2,(u8*)str);
- delay_ms(1000);
- OLED_Clear();
- key=0;
- }
- else
- {
- OLED_ShowCH(0,2,"请按key");
- }
- }
- }
复制代码
代码:
测试-键盘.7z
(197.24 KB, 下载次数: 18)
|