Buttton Onpress 修改

This commit is contained in:
WangQiang 2016-04-27 03:42:52 +00:00
parent 6fc7930c40
commit 7a41db4a58
3 changed files with 7 additions and 4 deletions

View File

@ -9,7 +9,9 @@ void TestPulsePort()
} }
void PulseHandler(PulsePort* port, bool hasPulse, void* param) void PulseHandler(PulsePort* port, bool hasPulse, void* param)
{ // down true 无遮挡   down false 有遮挡 {
#if defined(DEBUG)
// down true 无遮挡   down false 有遮挡
static UInt64 HideStr; static UInt64 HideStr;
static UInt64 UnHideStr; static UInt64 UnHideStr;
// debug_printf("Press P%c%d down=%d", _PIN_NAME(port->_Port->_Pin),down); // debug_printf("Press P%c%d down=%d", _PIN_NAME(port->_Port->_Pin),down);
@ -27,6 +29,7 @@ void PulseHandler(PulsePort* port, bool hasPulse, void* param)
//int time = HideStr-UnHideStr; //int time = HideStr-UnHideStr;
debug_printf("有脉冲时间 %d \r\n", (int)(HideStr-UnHideStr)); debug_printf("有脉冲时间 %d \r\n", (int)(HideStr-UnHideStr));
} }
#endif
} }
// 初始化引脚 // 初始化引脚

View File

@ -239,13 +239,13 @@ void CheckUserPress2(InputPort* port, bool down, void* param)
CheckUserPress(port, down, param); CheckUserPress(port, down, param);
} }
void InitButtonPress(Button_GrayLevel* btns, byte count) /*void InitButtonPress(Button_GrayLevel* btns, byte count)
{ {
for(int i=0; i<count; i++) for(int i=0; i<count; i++)
{ {
btns[i].OnPress = CheckUserPress2; btns[i].OnPress = CheckUserPress2;
} }
} }*/
void SetPower(ITransport* port) void SetPower(ITransport* port)
{ {

View File

@ -20,7 +20,7 @@ ITransport* CreateShunCom(COM index, int baudRate, Pin rst, Pin power, Pin slp,
TinyClient* CreateTinyClient(ITransport* port); TinyClient* CreateTinyClient(ITransport* port);
bool CheckUserPress(InputPort* port, bool down, void* param = nullptr); bool CheckUserPress(InputPort* port, bool down, void* param = nullptr);
void InitButtonPress(Button_GrayLevel* btns, byte count); //void InitButtonPress(Button_GrayLevel* btns, byte count);
void SetPower(ITransport* port); void SetPower(ITransport* port);