summaryrefslogtreecommitdiff
path: root/digital
diff options
context:
space:
mode:
authorFlorent Duchon2012-04-17 22:34:20 +0200
committerFlorent Duchon2012-04-17 22:34:20 +0200
commitf5b85a06258fc17310d91ba0925c34608b6315d7 (patch)
treeed92fea02fc68cb46aedb024cede16a943a9e1e1 /digital
parent41bb8dfc23e49a2a1bcfc44fe56d213d69cd623f (diff)
digital/beacon: add get value and reset counter to the debug task
Diffstat (limited to 'digital')
-rw-r--r--digital/beacon/src/debug.c10
-rw-r--r--digital/beacon/src/sensors.c13
2 files changed, 16 insertions, 7 deletions
diff --git a/digital/beacon/src/debug.c b/digital/beacon/src/debug.c
index c21d0dca..dc3e412e 100644
--- a/digital/beacon/src/debug.c
+++ b/digital/beacon/src/debug.c
@@ -28,6 +28,7 @@
#include "configuration.h"
#include "debug.h"
#include "servo.h"
+#include "sensors.h"
#include "network.h"
HAL_UsartDescriptor_t appUsartDescriptor; // USART descriptor (required by stack)
@@ -107,9 +108,15 @@ void usartRXCallback(uint16_t bytesToRead)
/* Decrease servo 2 angle */
uprintf("SERVO_2 = %d\r\n",servo_angle_decrease(SERVO_2));
break;
+ case 'a':
+ uprintf("CodeWheel Value = %d\r\n",sensors_codewheel_get_value());
+ break;
case 'd':
debug_start_stop_task();
break;
+ case 'z':
+ sensors_codewheel_reset();
+ break;
/* Default */
default :
uprintf(" ?? Unknown command ??\r\n");
@@ -166,4 +173,7 @@ void debug_task(void)
{
uprintf("------------------------- debug TASK -------------------------\r\n");
uprintf("NWK : status = 0x%x\r\n",network_get_status());
+#ifdef TYPE_END
+ uprintf("CodeWheel = %d\r\n",sensors_codewheel_get_value());
+#endif
}
diff --git a/digital/beacon/src/sensors.c b/digital/beacon/src/sensors.c
index 03037322..be7f6ea0 100644
--- a/digital/beacon/src/sensors.c
+++ b/digital/beacon/src/sensors.c
@@ -24,10 +24,10 @@
* }}} */
#include <types.h>
-#include <irq.h>
+#include <avr/interrupt.h>
#include "sensors.h"
-
-
+#include "debug.h"
+#include "led.h"
/********************************************************/
@@ -61,11 +61,10 @@ uint16_t sensors_codewheel_get_value(void)
return TCNT3;
}
-
-/* IRQ vector for Laser Interrupt */
-void sensors_laser_irq_vector(void)
+/* This function resets the wheel position */
+void sensors_codewheel_reset(void)
{
- //calculate and send value
+ TCNT3 = 0;
}
/* IRQ vector for CodeWheel complete turn */