summaryrefslogtreecommitdiff
path: root/n/asserv/src/timer.c
diff options
context:
space:
mode:
Diffstat (limited to 'n/asserv/src/timer.c')
-rw-r--r--n/asserv/src/timer.c38
1 files changed, 28 insertions, 10 deletions
diff --git a/n/asserv/src/timer.c b/n/asserv/src/timer.c
index b5d0b4d..1e18aca 100644
--- a/n/asserv/src/timer.c
+++ b/n/asserv/src/timer.c
@@ -1,8 +1,12 @@
/* timer.c */
-/* {{{
+/* asserv - Position & speed motor control on a ATmega128. {{{
*
* Copyright (C) 2004 Nicolas Schodet
*
+ * Robot APB Team/Efrei 2005.
+ * Web: http://assos.efrei.fr/robot/
+ * Email: robot AT efrei DOT fr
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
@@ -17,19 +21,26 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Contact :
- * Web: http://perso.efrei.fr/~schodet/
- * Email: <contact@ni.fr.eu.org>
* }}} */
-#include "timer.h"
-#include <avr/io.h>
-#include <n/avr/utils/utils.h>
/* +AutoDec */
+
+/** Initialise the timer. */
+static inline void
+timer_init (void);
+
+/** Test if a overflow occured and reset the flag. */
+static inline int
+timer_pending (void);
+
+/** Read timer value. Used for performance analysis. */
+static inline int8_t
+timer_read (void);
+
/* -AutoDec */
/** Initialise the timer. */
-inline void
+static inline void
timer_init (void)
{
/* 1024 prescaler. */
@@ -39,8 +50,8 @@ timer_init (void)
* Tov = 1 / Fov = 4.44 ms */
}
-/* Test if a overflow occured and reset the flag. */
-inline int
+/** Test if a overflow occured and reset the flag. */
+static inline int
timer_pending (void)
{
if (TIFR & _BV (TOV0))
@@ -53,3 +64,10 @@ timer_pending (void)
return 0;
}
+/** Read timer value. Used for performance analysis. */
+static inline int8_t
+timer_read (void)
+{
+ return TCNT0;
+}
+