From 390bf9ad86db418872c7842bf042f9fea22ce476 Mon Sep 17 00:00:00 2001 From: Florent Duchon Date: Sun, 24 Mar 2013 15:37:42 +0100 Subject: digital/beacon: add lol-v2 unitary tests programs --- digital/beacon/tests/codewheel/codewheel.c | 146 +++++++++++++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100644 digital/beacon/tests/codewheel/codewheel.c (limited to 'digital/beacon/tests/codewheel/codewheel.c') diff --git a/digital/beacon/tests/codewheel/codewheel.c b/digital/beacon/tests/codewheel/codewheel.c new file mode 100644 index 00000000..874a16a7 --- /dev/null +++ b/digital/beacon/tests/codewheel/codewheel.c @@ -0,0 +1,146 @@ +/* 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 +#include "print.h" +#include "codewheel.h" + +codewheel_s codewheel; +static HAL_AppTimer_t codewheelTimer; + +/* This function initializes the codewheel optical sensors and associated interrupt */ +void codewheel_init(void) +{ + /* Set codewheel state*/ + codewheel_set_state(CODEWHEEL_INIT); + + /* activated pull up on E6 */ + PORTE = 0x40; + + /* Select external clock on rising edge for timer 3 */ + TCCR3B |= (1<