From 62bc2be46efb74f9800565554298960afac11768 Mon Sep 17 00:00:00 2001 From: Maix0 <39835848+Maix0@users.noreply.github.com> Date: Fri, 17 Apr 2026 11:03:45 +0200 Subject: [PATCH] chore(cleanup): made sure everything is up to the subject expectations --- ex02/src/main.c | 10 +++++++--- ex03/src/main.c | 15 +++++++++------ ex03/src/uart.c | 2 -- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/ex02/src/main.c b/ex02/src/main.c index 074391e..5369e7e 100644 --- a/ex02/src/main.c +++ b/ex02/src/main.c @@ -78,16 +78,20 @@ void wheel(uint8_t pos) { } } -int main(void) { - // OC2B = PD3 → output +void init_rgb(void) +{ DDRD |= RGB_MASK; - t0_init_fpwm_3(PRESCALER_64); t2_init_fpwm_3(PRESCALER_64); t0_set_out_mode(TO_A | TO_B, TOM_00); t2_set_out_mode(TO_B, TOM_00); +} +int main(void) { + // OC2B = PD3 → output + + init_rgb(); uint8_t pos = 0; while (1) { wheel(pos++); diff --git a/ex03/src/main.c b/ex03/src/main.c index 0e04722..050eb85 100644 --- a/ex03/src/main.c +++ b/ex03/src/main.c @@ -84,17 +84,20 @@ const char* HEX_DIGIT = "0123456789ABCDEF"; #define BUFFERSIZE (1 + 6 + 1) -int main(void) { - // OC2B = PD3 → output - DDRD |= RGB_MASK; - - uart_init(); - +void init_rgb(void) +{ t0_init_fpwm_3(PRESCALER_64); t2_init_fpwm_3(PRESCALER_64); t0_set_out_mode(TO_A | TO_B, TOM_00); t2_set_out_mode(TO_B, TOM_00); + DDRD |= RGB_MASK; +} + + +int main(void) { + uart_init(); + init_rgb(); char buffer[BUFFERSIZE]; uint8_t cursor = 0; diff --git a/ex03/src/uart.c b/ex03/src/uart.c index 57d0599..182c08f 100644 --- a/ex03/src/uart.c +++ b/ex03/src/uart.c @@ -85,7 +85,6 @@ void uart_send_u16(uint16_t val) { uart_sendstring(buf); } -*/ void uart_send_u8_hex(uint8_t val) { char buf[3] = {0, 0, 0}; buf[0] = "0123456789abcdef"[(val >> 4) & 0x0F]; @@ -93,7 +92,6 @@ void uart_send_u8_hex(uint8_t val) { uart_sendstring(buf); } -/* void uart_send_u16_hex(uint16_t val) { char buf[5] = {0, 0, 0, 0, 0};