From 90527d1cf27582b1e7bb8588afbed8989453f606 Mon Sep 17 00:00:00 2001 From: Florent Duchon Date: Sat, 21 Apr 2012 16:42:16 +0200 Subject: digital/beacon: split sensors.* into codewheel.* & laser.* and modify dedicated calls --- digital/beacon/src/codewheel.c | 65 ++++++++++++++++++++++ digital/beacon/src/codewheel.h | 40 ++++++++++++++ digital/beacon/src/debug.c | 44 +++++++++++++-- digital/beacon/src/debug.h | 1 + digital/beacon/src/laser.c | 121 +++++++++++++++++++++++++++++++++++++++++ digital/beacon/src/laser.h | 55 +++++++++++++++++++ digital/beacon/src/main_avr.c | 7 ++- digital/beacon/src/sensors.c | 84 ---------------------------- digital/beacon/src/sensors.h | 43 --------------- 9 files changed, 326 insertions(+), 134 deletions(-) create mode 100644 digital/beacon/src/codewheel.c create mode 100644 digital/beacon/src/codewheel.h create mode 100644 digital/beacon/src/laser.c create mode 100644 digital/beacon/src/laser.h delete mode 100644 digital/beacon/src/sensors.c delete mode 100644 digital/beacon/src/sensors.h (limited to 'digital') diff --git a/digital/beacon/src/codewheel.c b/digital/beacon/src/codewheel.c new file mode 100644 index 00000000..efcd9931 --- /dev/null +++ b/digital/beacon/src/codewheel.c @@ -0,0 +1,65 @@ +/* codewheel.c */ +/* Codewheel sensors management. {{{ + * + * Copyright (C) 2012 Florent Duchon + * + * APBTeam: + * Web: http://apbteam.org/ + * Email: team AT apbteam DOT org + * + * 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 + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * }}} */ + +#include +#include +#include "debug.h" +#include "codewheel.h" + + +/* This function initializes the codewheel optical sensors and associated interrupt */ +void codewheel_init(void) +{ + /* Select external clock on rising edge for timer 3 */ + TCCR3B |= (1< +#include +#include "debug.h" +#include "laser.h" + + +/* This function initializes the laser pin input and associated interrupt */ +void laser_init(void) +{ + /* Configure Input compare interrupts for Laser Interrupt*/ + TCCR3B |= (1< #include "configuration.h" #include "calibration.h" +#include "codewheel.h" #include "network.h" #include "position.h" -#include "sensors.h" +#include "laser.h" #include "debug.h" #include "servo.h" #include "led.h" @@ -88,8 +89,8 @@ void APL_TaskHandler(void) break; case DEVICE_TYPE_END_DEVICE: servo_init(); - sensors_codewheel_init(); - sensors_laser_init(); + codewheel_init(); + laser_init(); network_init(); uprintf("LOL_%d initialisation OK !\n\r",CS_NWK_ADDR); break; diff --git a/digital/beacon/src/sensors.c b/digital/beacon/src/sensors.c deleted file mode 100644 index d1418440..00000000 --- a/digital/beacon/src/sensors.c +++ /dev/null @@ -1,84 +0,0 @@ -/* sensors.c */ -/* Beacon sensors management. {{{ - * - * Copyright (C) 2012 Florent Duchon - * - * APBTeam: - * Web: http://apbteam.org/ - * Email: team AT apbteam DOT org - * - * 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 - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * }}} */ - -#include -#include -#include "sensors.h" -#include "debug.h" -#include "led.h" - -/********************************************************/ - -/* This function initializes the laser pin input and associated interrupt */ -void sensors_laser_init(void) -{ - /* Configure Input compare interrupts for Laser Interrupt*/ - TCCR3B |= (1<