/* flaneth - flash and ethernet
Copyright (C) 2007-2012 Stefan Schuermans <stefan@blinkenarea.org>
Copyleft: GNU public license V2 - http://www.gnu.org/copyleft/gpl.html
a BlinkenArea project - http://www.blinkenarea.org/ */
#include "mcuf_in.h"
#include "ser115200.h"
#define MCUF_IN_TIMEOUT 25 // 25 * 200ms = 5s
static unsigned int McufInTimeout = 0;
// check if MCUF input is active
int McufInIsActive(void)
{
return McufInTimeout > 0; // MCUF input active if timeout is greater zero
}
// tick procedure - call every 200ms
void McufInTick200(void)
{
// time out active MCUF input after 5s
if (McufInTimeout > 0) {
--McufInTimeout;
}
}
// process a received MCUF packet
void McufInRecv(unsigned char *pData, unsigned short Length)
{
McufInTimeout = MCUF_IN_TIMEOUT; // MCUF input is active now
Ser115200Send(pData, Length);
}