summaryrefslogtreecommitdiff
path: root/avr/timer.c
diff options
context:
space:
mode:
Diffstat (limited to 'avr/timer.c')
-rw-r--r--avr/timer.c29
1 files changed, 6 insertions, 23 deletions
diff --git a/avr/timer.c b/avr/timer.c
index f45f267..1b15985 100644
--- a/avr/timer.c
+++ b/avr/timer.c
@@ -1,14 +1,13 @@
/*
* (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
*
- * SPDX-License-Identifier: GPL-2.0+
+ * SPDX-License-Identifier: GPL-2.0
*/
-#include "common.h"
+#include "timer.h"
#include <avr/interrupt.h>
#include <util/atomic.h>
#include "time.h"
-#include "timer.h"
/* timer interrupt/overflow counter */
/* counts up every ms. */
@@ -16,9 +15,9 @@ static volatile
uint32_t timestamp;
/*
- * 1000Hz timer interrupt generated by OC3A
+ * 1000Hz timer interrupt generated by OC4A
*/
-ISR(TIMER3_COMPA_vect)
+ISR(TIMER4_COMPA_vect)
{
static int_fast8_t tick_10ms;
static int_fast8_t tick_1s;
@@ -26,6 +25,8 @@ ISR(TIMER3_COMPA_vect)
extern void disk_timerproc(void);
+ OCR4A += F_CPU / 1000; /* 1000Hz interval */
+
timestamp++;
i = tick_10ms + 1;
@@ -49,24 +50,6 @@ ISR(TIMER3_COMPA_vect)
/*--------------------------------------------------------------------------*/
-#if 0
-void timer_setup(void)
-{
-
- /* Clock */
- CLKPR = _BV(CLKPCE);
- CLKPR = 0;
-
- /* Timer */
-
- OCR1A = F_CPU / 1000 - 1; // Timer1: 1000Hz interval (OC1A)
- TCCR1B = 0b00001001;
- TIMSK1 = _BV(OCIE1A); // Enable TC1.oca interrupt
-}
-#endif
-
-/*--------------------------------------------------------------------------*/
-
uint32_t get_timer(uint32_t base)
{
uint32_t ret;