Replace led_hour (etc.) globals with TIME struct

This commit is contained in:
2020-11-18 09:00:09 +01:00
parent b9c0be68d8
commit ed730b8dc3
6 changed files with 28 additions and 31 deletions

View File

@@ -3,9 +3,7 @@
#include "config.h"
#include "led.h"
volatile uint8_t led_hour;
volatile uint8_t led_minute;
volatile uint8_t led_second;
volatile struct TIME led_display = { 0, 0, 0 };
void led_init(void)
{
@@ -31,15 +29,15 @@ ISR(TIMER0_OVF_vect)
switch(curr_anode)
{
case 1:
LED_PORT = ~led_hour;
LED_PORT = ~led_display.hour;
ANODES_PORT = ram_cfg.led_brightness >= pwm_counter ? ~HOUR_ANODE : 0xFF;
break;
case 2:
LED_PORT = ~led_minute;
LED_PORT = ~led_display.minute;
ANODES_PORT = ram_cfg.led_brightness >= pwm_counter ? ~MINUTE_ANODE : 0xFF;
break;
case 4:
LED_PORT = ~led_second;
LED_PORT = ~led_display.second;
ANODES_PORT = ram_cfg.led_brightness >= pwm_counter ? ~SECOND_ANODE : 0xFF;
break;
}