小孔按键重置

This commit is contained in:
cdy 2017-01-09 14:51:48 +08:00
parent 4b9c92e02d
commit 082568f6de
2 changed files with 22 additions and 8 deletions

View File

@ -291,8 +291,22 @@ void IOK027X::Union(Pin pin1, Pin pin2)
}
}
static bool ledstat2 = false;
static void RestPress(InputPort& port, bool down)
{
if (down) return;
auto client = IOK027X::Current;
client->Restore();
}
void IOK027X::SetRestore(Pin pin)
{
if (pin == P0) return;
auto port = new InputPort(pin);
port->Open();
port->Press = RestPress;
RestPort = port;
}
static bool ledstat2 = false;
void IOK027X::Restore()
{
for (int i = 0; i < 10; i++)
@ -304,7 +318,6 @@ void IOK027X::Restore()
if (Client) Client->Reset("按键重置");
}
void IOK027X::FlushLed()
{
if (LedsShow == 0) // 启动时候20秒

View File

@ -29,7 +29,7 @@ public:
void* InitData(void* data, int size);
void Register(int index, IDataPort& dp);
void SetRestore(Pin pin = PB4); //设置重置引脚
void InitLeds();
void FlushLed(); // 刷新led状态输出
@ -50,6 +50,7 @@ public:
private:
void* Data;
int Size;
InputPort* RestPort;
void OpenClient(ISocketHost& host);
TokenController* AddControl(ISocketHost& host, const NetUri& uri, ushort localPort);