From 69cf1dc9361b0200075f1d9ff45a1127e8353762 Mon Sep 17 00:00:00 2001 From: Lea Date: Tue, 29 Aug 2023 20:49:46 +0200 Subject: [PATCH] move stuff around --- ...tmega640-1280-1281-2560-2561_datasheet.pdf | 0 pinout.png => documents/pinout.png | Bin main.c | 35 ++---------------- 3 files changed, 3 insertions(+), 32 deletions(-) rename atmega640-1280-1281-2560-2561_datasheet.pdf => documents/atmega640-1280-1281-2560-2561_datasheet.pdf (100%) rename pinout.png => documents/pinout.png (100%) diff --git a/atmega640-1280-1281-2560-2561_datasheet.pdf b/documents/atmega640-1280-1281-2560-2561_datasheet.pdf similarity index 100% rename from atmega640-1280-1281-2560-2561_datasheet.pdf rename to documents/atmega640-1280-1281-2560-2561_datasheet.pdf diff --git a/pinout.png b/documents/pinout.png similarity index 100% rename from pinout.png rename to documents/pinout.png diff --git a/main.c b/main.c index b795adc..aed2e47 100644 --- a/main.c +++ b/main.c @@ -32,11 +32,6 @@ void start_timer() { sei(); } -void main() { - start_timer(); - prog_7segment_4digit(); -} - // ISR is used to handle interrupts. TIMER1_OVF_vect // is triggered whenever timer 1 (16 bit) overflows. ISR(TIMER1_OVF_vect) { @@ -54,44 +49,20 @@ ISR(TIMER2_OVF_vect) { update_next_digit(); } -void prog_7segment() { - DDRF = 0b11111111; - DDRK = 0b00000000; - PORTK = 0b00000001; // enable pull-up resistor - - uint8_t val = 0; - - set_display(&PORTF, val, false); - - while(1) { - loop_until_bit_is_clear(PINK, PINK0); - - if (val >= 9) { - val = 0xff; // will overflow to 0 when incremented - } - - set_display(&PORTF, ++val, true); - - // debounce - _delay_ms(200); - - loop_until_bit_is_set(PINK, PINK0); - set_display(&PORTF, val, false); - } -} - void beep() { beeping = true; _delay_ms(50); beeping = false; } -void prog_7segment_4digit() { +void main() { DDRF = 0b11111111; DDRK = 0b00001111; DDRD = 0b00000001; PORTK = 0b11000000; // set pull-up + start_timer(); + float num = 0.0f; bool pressed_pause = false; bool pressed_clear = false;