@@ -1,51 +1,40 @@
|
||||
#include "encode.h"
|
||||
|
||||
void GEI_BUTTON_CODE(button *bt)
|
||||
void GEI_BUTTON_CODE(button *bt,uint8_t flag)
|
||||
{
|
||||
#define t 500 //????(ms)
|
||||
#define t 500 //timeout (ms)
|
||||
|
||||
bt->flag=HAL_GPIO_ReadPin(bt->GPIOx,bt->GPIO_Pin);
|
||||
bt->flag=flag;
|
||||
bt->code=0;
|
||||
if(bt->flag==0)
|
||||
{
|
||||
if(bt->lock==0)
|
||||
{
|
||||
if(HAL_GetTick()<bt->time+t)//??????????
|
||||
if(HAL_GetTick()<bt->time+t)//
|
||||
{
|
||||
bt->times++;
|
||||
bt->time=HAL_GetTick();
|
||||
bt->lock=1;
|
||||
|
||||
}else
|
||||
{
|
||||
bt->times=1; //??????
|
||||
bt->time=HAL_GetTick();
|
||||
bt->lock=1;
|
||||
bt->times=1; //
|
||||
}
|
||||
|
||||
bt->time=HAL_GetTick();
|
||||
bt->lock=1;
|
||||
bt->code=bt->times;
|
||||
}
|
||||
if(bt->lock==1)
|
||||
{
|
||||
if(HAL_GetTick()>bt->time+t)//??????t ms
|
||||
{
|
||||
bt->code=255;
|
||||
bt->times=255;
|
||||
} //????
|
||||
}
|
||||
|
||||
if(bt->config_longtimes==1)
|
||||
{
|
||||
if(HAL_GetTick()>bt->time+t)//
|
||||
{
|
||||
bt->code=255;
|
||||
bt->times=255;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(bt->flag==1)
|
||||
{
|
||||
if(bt->lock==1)
|
||||
{
|
||||
if(bt->code==255)
|
||||
{
|
||||
|
||||
}else
|
||||
{
|
||||
bt->code=bt->times;
|
||||
}
|
||||
bt->lock=0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user