📄 key.c
字号:
#include "common.h"
void KeyProcess(uint n)
{
if(n>=500)
{
if(UnitONmark)
ACCCalibrationisOK=0;
}
else if(n>=250)
{
if(UnitONmark)
HMC1052CalibrationisOK=0;
}
else if(n>0)
{
UnitONmark^=1;
if(UnitONmark)
{
PORTD=0;
oled_initial();
clear_screen();
}
else
{
clear_screen();
oled_reset();
SPI_MasterInit();
MainOLED_WCom(0xAD); // SET DC/DC BOOSTER(8AH=OFF,8BH=ON)
MainOLED_WCom(0x8A); // built-in DC-DC turn off
MainOLED_WCom(0xAE); // Display turn off
PORTD&=0b00001111;
PORTD|=0b11110000;
OLED_POWER_OFF;
//BATT_POWER_OFF;
}
}
KeyCounter=0;
}
void Key(void)
{
if(!KeyValue)
{
KeyMark=0;
if(!KeyCounter)
return ; /*no pressing, exit*/
}
if(KeyMark) /*detect pressing for the first time?*/
{
KeyCounter++; /*detecting pressing is not first time*/
//if(Qdsj==KeyCounter) /*pressing for Qdsj times?*/
//{
//KeyCounter-=Ljsj;
// KeyProcess(KeyValue,1); /*Processing button*/
//}
//else
//{ return ; } /* pressing button is not get to Qdsj times*/
}
else /*detect pressing first time*/
{
_delay_loop_1(100); /*delay 10ms*/
if(!KeyValue)
{
KeyProcess(KeyCounter);
return ; /*no pressing, exit*/
}
else
{
//BATT_POWER_ON;
KeyMark=1;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -