📄 switch_wait.c
字号:
#include "main.h"
#include "port.h"
#include "switch_wait.h"
#include "delay_loop.h"
void switch_init()
{
Q1_pin=1;//读段口1的第临危
}
bit switch_get_input(const tByte de)
{
bit re_v=switch_not_pressed;
if(Q1_pin==0)
{
delay_loop_wait(de);
if(Q1_pin==0) ///******关键****///
{
while(Q1_pin==0);//***关键*千万小心不要把下面的话放在WHILE中///
re_v=switch_pressed;//因为WHILE只在空等,如果放进了它就不断的把一
//写入地三口
}
}
return re_v; //小心啊
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -