beep every second

This commit is contained in:
Lea 2023-08-30 16:08:44 +02:00
parent a41afe87a1
commit 2d5ad1d6f4
Signed by: Lea
GPG key ID: 1BAFFE8347019C42

6
main.c
View file

@ -1,6 +1,7 @@
#define __AVR_ATmega2560__
#define F_CPU 16000000UL
#define DISPLAY PORTF
#define TICK_BEEP true
#include <avr/io.h>
#include <util/delay.h>
@ -36,7 +37,10 @@ void start_timer() {
// is triggered whenever timer 1 (16 bit) overflows.
ISR(TIMER1_OVF_vect) {
TCNT1 = tick_timer_start;
if (counting) ticks += 1;
if (counting) {
ticks += 1;
if (TICK_BEEP && ticks % 1000 == 0 && !beep_time) beep_time = 10;
}
if (bit_is_set(PIND, PIND0)) {
PORTD &= 0b11111110;