From b4d8344ae068467679c733998ef9e0a2cbb6956c Mon Sep 17 00:00:00 2001 From: Florent Duchon Date: Wed, 16 May 2012 17:31:53 +0200 Subject: digital/beacon: sending angle management --- digital/beacon/src/codewheel.c | 3 +++ digital/beacon/src/laser.c | 24 +++++++++++++++++++++++- digital/beacon/src/laser.h | 5 ++++- 3 files changed, 30 insertions(+), 2 deletions(-) (limited to 'digital/beacon') diff --git a/digital/beacon/src/codewheel.c b/digital/beacon/src/codewheel.c index 205c2e2b..b28f756c 100644 --- a/digital/beacon/src/codewheel.c +++ b/digital/beacon/src/codewheel.c @@ -28,6 +28,8 @@ #include #include "debug_avr.h" #include "codewheel.h" +#include "laser.h" +#include "network.h" codewheel_s codewheel; @@ -111,4 +113,5 @@ ISR(TIMER3_COMPA_vect) { OCR3A = CODEWHEEL_CPR; } + laser_reset_angle_id(); } diff --git a/digital/beacon/src/laser.c b/digital/beacon/src/laser.c index 888589ad..bf77cdd9 100644 --- a/digital/beacon/src/laser.c +++ b/digital/beacon/src/laser.c @@ -28,7 +28,9 @@ #include "debug_avr.h" #include "laser.h" #include "servo.h" +#include "network.h" #include "codewheel.h" +#include "calibration.h" laser_s laser; @@ -37,6 +39,7 @@ void laser_init(void) { /* Init laser structiure */ laser_set_angle(0); + laser_reset_angle_id(); /* Configure Input compare interrupts for Laser Interrupt*/ TCCR3B |= (1< 30) && (laser_get_angle_degree() < 70)) + { + uprintf("angle[%d] = %f\r\n",laser.angle_id,laser_get_angle_degree()); + laser.angle_id++; + } } /* Disable the interrupt */ diff --git a/digital/beacon/src/laser.h b/digital/beacon/src/laser.h index f50c5b07..f0d32d93 100644 --- a/digital/beacon/src/laser.h +++ b/digital/beacon/src/laser.h @@ -64,6 +64,9 @@ uint16_t laser_get_angle_raw(void); float laser_get_angle_degrees(void); /* This function sets the angle value in raw format */ -void laser_set_angle_raw(uint16_t angle); +void laser_set_angle(uint16_t angle); + +/* This function resets the angle id variable */ +void laser_reset_angle_id(void); #endif -- cgit v1.2.3