/****************************************************************************** * LED_FlashTimeout * * Flash the selected LED(s). ******************************************************************************/ static void LED_FlashTimeout ( uint8_t timerId /* IN: TimerID. */ ) { (void)timerId; /* prevent compiler warning */ if(mLedFlashingLEDs & LED1) Led1Toggle(); if(mLedFlashingLEDs & LED2) Led2Toggle(); if(mLedFlashingLEDs & LED3) Led3Toggle(); if(mLedFlashingLEDs & LED4) Led4Toggle(); #if gLEDBlipEnabled_d /* decrement blips */ LED_DecrementBlip(); #endif /* if serial lights, move on to next light */ if(mfLedInSerialMode) { mLedFlashingLEDs = mLedFlashingLEDs << 1; if(mLedFlashingLEDs & (LED4 << 1)) /* wrap around */ { mLedFlashingLEDs &= LED_ALL; mLedFlashingLEDs |= LED1; } } }
int main(void) { lcdInit(); Led1Init(); lcdWriteDataLine(1,txt1); lcdWriteDataLine(0,txt2); while(1){ Led1Toggle(); _delay_ms(1000); } }
/****************************************************************************** * LED_ToggleLed * * Toggles on or more LEDs. Doesn't check/affect flashing states. *******************************************************************************/ void LED_ToggleLed(LED_t LEDNr) { if (LEDNr & LED1){ Led1Toggle(); } if (LEDNr & LED2){ Led2Toggle(); } if (LEDNr & LED3){ Led3Toggle(); } if (LEDNr & LED4){ Led4Toggle(); } }
void ISR_TIMER(void) { uint16_t LecturaADC; LecturaADC = A * ADCRead(); Led1Toggle(); if(LecturaADC > 1023) LecturaADC = 1023; if(LecturaADC < 10) LecturaADC = 0; DACUpdate(LecturaADC); TimerClearFlag(); }