Reused ACT (led0) light as activity light.

This commit is contained in:
2018-08-12 11:33:41 +01:00
parent 2b01dbc605
commit cf69741c24
5 changed files with 89 additions and 3 deletions

View File

@@ -2,6 +2,7 @@
#include "u2f.hpp"
#include <iostream>
#include "IO.hpp"
#include "LED.hpp"
using namespace std;
@@ -11,10 +12,17 @@ Controller::Controller(const uint32_t startChannel)
void Controller::handleTransaction()
{
if (channels.size() != 0 && chrono::duration_cast<chrono::seconds>(chrono::system_clock::now() - lastMessage) < 5s)
toggleACTLED();
else
enableACTLED(false);
auto msg = U2FMessage::readNonBlock();
if (!msg)
return;
lastMessage = chrono::system_clock::now();
auto opChannel = msg->cid;