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;