From 2041e7badf28e54c3b999dde1ecfed86e2769656 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Tue, 12 Apr 2022 11:50:14 +0200 Subject: Add STATUS LED --- src/app/main.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/app/main.c') diff --git a/src/app/main.c b/src/app/main.c index 6fe7cd7..5b35286 100644 --- a/src/app/main.c +++ b/src/app/main.c @@ -6,6 +6,7 @@ /* Definitions for pins */ #define PORTB_PLL_MUXOUT (1 << 0) +#define PORTB_LED_STATUS (1 << 1) #define PORTB_PLL_LE (1 << 4) #define PORTB_PLL_DATA (1 << 3) #define PORTB_PLL_CLK (1 << 2) @@ -74,8 +75,8 @@ int main(void) seconds = 0; /* Configure GPIO */ - PORTB = PORTB_PLL_LE; - DDRB = PORTB_PLL_CLK | PORTB_PLL_LE | PORTB_PLL_DATA; + PORTB = PORTB_PLL_LE | PORTB_LED_STATUS; + DDRB = PORTB_PLL_CLK | PORTB_PLL_LE | PORTB_PLL_DATA | PORTB_LED_STATUS; /* initialise timer interrupt */ inittimer(); @@ -105,15 +106,15 @@ int main(void) while (1) { /* - // We actually dont use the timer, but the code is kept around as a reference. const uint32_t second = seconds % 60uL; const uint32_t minute = seconds / 60uL; - if ((PINB & PORTB_PLL_MUXOUT) == 0) { delay_ms(600); } */ - delay_ms(1000); + delay_ms(200); + + set_pin(PORTB_LED_STATUS, seconds % 4 < 2); } return 0; -- cgit v1.2.3