From 0c083dede1bad6e9ad285bb9e0cdfcbd6263a591 Mon Sep 17 00:00:00 2001 From: jake Date: Mon, 26 Aug 2024 07:56:54 -0700 Subject: [PATCH] refactored the led code I changed it to use the new updated interface that I wrote for the LedController module. --- src/main.c | 39 ++++++--------------------------------- 1 file changed, 6 insertions(+), 33 deletions(-) diff --git a/src/main.c b/src/main.c index cc09d54..49c2f0b 100644 --- a/src/main.c +++ b/src/main.c @@ -80,6 +80,8 @@ int main(int argc, char **argv) uint16_t break_time = 0; uint8_t temp = 0; + LedByte led_byte = LedController_New(&PORTA.OUT); + while (true) { SW1_Wait(); @@ -92,20 +94,8 @@ int main(int argc, char **argv) make_time = Timer_GetOverflowCount(); // Output the Make time via LEDS - // temp = (uint8_t)(make_time & 0x0F); - temp = 0x01; - LedControler_ShowHalfByte(temp); - - _delay_ms(1000); - LedControler_ClearHalfByte(); - - // temp = (uint8_t)((make_time & 0xF0)>>4); - temp = 0x02; - LedControler_ShowHalfByte(temp); - - _delay_ms(1000); - - LedControler_ClearHalfByte(); + temp = (uint8_t)(make_time & 0x0F); + LedController_ShowByte(&led_byte, temp); SW2_Wait(); Deactivate_Relay(); @@ -117,26 +107,9 @@ int main(int argc, char **argv) break_time = Timer_GetOverflowCount(); // Output the Break time via LEDS - // temp = (uint8_t)(break_time & 0x0F); - temp = 0x04; - LedControler_ShowHalfByte(temp); + temp = (uint8_t)(break_time & 0x0F); + LedController_ShowByte(&led_byte, temp); - _delay_ms(1000); - LedControler_ClearHalfByte(); - // temp = (uint8_t)((break_time & 0xF0)>>4); - temp = 0x08; - LedControler_ShowHalfByte(temp); - - _delay_ms(1000); - - LedControler_ClearHalfByte(); - - /* - USART0_sendString(maketime_msg); - USART0_sendChar((uint8_t)(0xFF & make_time)); - USART0_sendString(breaktime_msg); - USART0_sendChar((uint8_t)(0xFF & break_time)); - */ } }