beep every second
This commit is contained in:
parent
a41afe87a1
commit
2d5ad1d6f4
6
main.c
6
main.c
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue