summaryrefslogtreecommitdiff
path: root/n/asserv/src/counter.c
diff options
context:
space:
mode:
authorschodet2005-04-06 21:12:34 +0000
committerschodet2005-04-06 21:12:34 +0000
commit02425b791000aa390839cabcc67707bd610a8bfb (patch)
tree97d258d0795bb81ceaf0f4e59a001a3ce897f5d4 /n/asserv/src/counter.c
parent0432e1772412d42036124a213663105eb52fb02a (diff)
Ajout de define pour les sens moteurs.
Diffstat (limited to 'n/asserv/src/counter.c')
-rw-r--r--n/asserv/src/counter.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/n/asserv/src/counter.c b/n/asserv/src/counter.c
index 7fcfac5..774a9c8 100644
--- a/n/asserv/src/counter.c
+++ b/n/asserv/src/counter.c
@@ -23,6 +23,11 @@
*
* }}} */
+/** Define to 1 to reverse the left counter. */
+#define COUNTER_REVERSE_LEFT 1
+/** Define to 1 to reverse the right counter. */
+#define COUNTER_REVERSE_RIGHT 0
+
/** Forward and reverse counter values. */
static uint8_t counter_left_frw, counter_left_rev,
counter_right_frw, counter_right_rev;
@@ -79,7 +84,11 @@ counter_poll (void)
uint8_t c;
/* Read left counter. */
c = TCNT2;
+#if COUNTER_REVERSE_LEFT == 0
if (PINE & _BV (4))
+#else
+ if (!(PINE & _BV (4)))
+#endif
{
PORTD &= ~0x40;
counter_left_frw += c - counter_left_old;
@@ -92,7 +101,11 @@ counter_poll (void)
counter_left_old = c;
/* Read right counter. */
c = TCNT3L;
+#if COUNTER_REVERSE_RIGHT == 0
if (PINE & _BV (5))
+#else
+ if (!(PINE & _BV (5)))
+#endif
{
PORTD &= ~0x20;
counter_right_frw += c - counter_right_old;