From a7b19ca1620c5aec52e608e687c6319a8cf73dff Mon Sep 17 00:00:00 2001 From: Maix0 <39835848+Maix0@users.noreply.github.com> Date: Thu, 16 Apr 2026 10:27:33 +0200 Subject: [PATCH] feat(ex03): removed extra files and do the case conversion --- ex03/Makefile | 2 +- ex03/src/main.c | 5 ++++- ex03/src/timer.c | 38 -------------------------------------- 3 files changed, 5 insertions(+), 40 deletions(-) delete mode 100644 ex03/src/timer.c diff --git a/ex03/Makefile b/ex03/Makefile index add8cae..5c58470 100644 --- a/ex03/Makefile +++ b/ex03/Makefile @@ -12,7 +12,7 @@ SERIAL=-P /dev/ttyUSB0 -b 115200 SRC_DIR=src OBJ_DIR=build -SRC_FILES=main.c utils.c uart.c timer.c +SRC_FILES=main.c utils.c uart.c OBJ_FILES=$(patsubst %.c,%.o,$(SRC_FILES)) SRC=$(addprefix $(SRC_DIR)/,$(SRC_FILES)) diff --git a/ex03/src/main.c b/ex03/src/main.c index 55e6f3e..6dea53a 100644 --- a/ex03/src/main.c +++ b/ex03/src/main.c @@ -17,5 +17,8 @@ int main(void) { // UART_RX COMPLETE void __attribute__((signal)) __vector_18(void) { - uart_tx(UDR0); + char data = UDR0; + if ((data >= 'A' && data <= 'Z') || (data >= 'a' && data <= 'z')) + data ^= 0x20; + uart_tx(data); } diff --git a/ex03/src/timer.c b/ex03/src/timer.c deleted file mode 100644 index bc35f18..0000000 --- a/ex03/src/timer.c +++ /dev/null @@ -1,38 +0,0 @@ - -#include -#include -#include "mystd.h" -#include "utils.h" - -#define PRESCALER 256 -#define TIMER_FREQ (F_CPU / PRESCALER) - -// at a high level: -// Set the OC1B (PB2) pin as output -// set the TIMER1 mode to COMPARE (CTC) -// say to compare against OC1A -// set the value to be compated at X count -// say the presacler for the timer is 512 -// -// all these information are on page ~140 -void timer1_init(void) { - // Set PB1 (OC1A) as output - DDRB |= _BV(PB1); - - // CTC mode (WGM12 = 1) - TCCR1B |= _BV(WGM12); - - // Toggle OC1B on compare match (COM1B0 = 1) - // TCCR1A |= _BV(COM1A0); - - // Set compare values - OCR1A = TIMER_FREQ / 2; - - // Start timer with prescaler 256 (CS12) - TCCR1B |= _BV(CS12); - - // set OCR1A interrupt - TIMSK1 = _BV(1); - - sei(); -}