From f5b85a06258fc17310d91ba0925c34608b6315d7 Mon Sep 17 00:00:00 2001 From: Florent Duchon Date: Tue, 17 Apr 2012 22:34:20 +0200 Subject: digital/beacon: add get value and reset counter to the debug task --- digital/beacon/src/debug.c | 10 ++++++++++ digital/beacon/src/sensors.c | 13 ++++++------- 2 files changed, 16 insertions(+), 7 deletions(-) (limited to 'digital') 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 -#include +#include #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 */ -- cgit v1.2.3