beautypg.com

Wavetronix Click 500 (programmable controller) (CLK-500) - Developer Guide User Manual

Page 101

background image

100

CHAPTER 9 • DIGITAL INPUT/OUTPUT

{
if (ClickUtilTimerExpired(&SignalLightTimer))
{
ChangeSignalLight();
}
if ( (SignalLightState == GREEN_INDICATION)
&& (ClickBtnPressed())
)
{
ClickUtilTimerSet(&SignalLightTimer,
TIME_GREEN_MS);
}
}

void Setup1( void )
{
ClickTimerRegisterCallback(MonitorSignalLight);

SignalLightState = GREEN_INDICATION;
ChangeSignalLight();
}

void MonitorSignalLight(void)
{
char inputState;
static char IndicationStateCurr;
static char IndicationStateLast;

#GLOBAL_INIT
{
IndicationStateCurr = DUAL_INDICATION;
IndicationStateLast = DUAL_INDICATION;
}

inputState = ReadInputs();
if (inputState != DUAL_INDICATION)
{
switch (IndicationStateLast)
{
case GREEN_INDICATION:
if (inputState == YELLOW_INDICATION)
IndicationStateCurr = YELLOW_INDICATION;