in Tutorials/ErrorReporting/Stage2/main.c [122:140]
static void BlinkingLedTimerEventHandler(EventLoopTimer *timer)
{
if (ConsumeEventLoopTimerEvent(timer) != 0) {
exitCode = ExitCode_LedTimer_Consume;
return;
}
// The LED is active-low so GPIO_Value_Low is on and GPIO_Value_High is off
ledState = (ledState == GPIO_Value_Low ? GPIO_Value_High : GPIO_Value_Low);
// Changes the color of the LED when the button is pressed.
int result =
GPIO_SetValue(buttonToggle ? blinkingLedBlueGpioFd : blinkingLedGreenGpioFd, ledState);
if (result != 0) {
Log_Debug("ERROR: Could not set LED output value: %s (%d).\n", strerror(errno), errno);
exitCode = ExitCode_LedTimer_SetLedState1;
return;
}
}