From 9d3573134462335051e46b990e97e1d32bef4b29 Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Mon, 31 Mar 2008 13:03:47 +0200 Subject: * digital/io/src: - adapted FSM to AVR program. --- digital/io/src/gutter_cb.c | 52 +++++++++++++++++++++++++++++++++------------- 1 file changed, 37 insertions(+), 15 deletions(-) (limited to 'digital/io/src/gutter_cb.c') diff --git a/digital/io/src/gutter_cb.c b/digital/io/src/gutter_cb.c index 729c187f..30166929 100644 --- a/digital/io/src/gutter_cb.c +++ b/digital/io/src/gutter_cb.c @@ -1,19 +1,41 @@ -/* - * THIS IS AN AUTOMATICALLY GENERATED FILE, DO NOT EDIT! +/* gutter_cb.c - gutter FSM callbacks. */ +/* {{{ * - * Skeleton for get_samples callbacks implementation. + * Copyright (C) 2008 NĂ©lio Laranjeiro * - * - */ + * 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 "common.h" +#include "fsm.h" #include "gutter_cb.h" +#include "asserv.h" +#include "trap.h" +#include "modules/utils/utils.h" /* * START =ok=> * => GO_TO_GUTTER * Go to the gutter. */ -gutter_branch_t -gutter__START__ok (gutter_t *user) +fsm_branch_t +gutter__START__ok (void) { asserv_go_to_gutter(); return gutter_next (START, ok); @@ -24,8 +46,8 @@ gutter__START__ok (gutter_t *user) * => END * The samples has been inserted in the gutter. */ -gutter_branch_t -gutter__CLOSE_COLLECTOR__collector_closed (gutter_t *user) +fsm_branch_t +gutter__CLOSE_COLLECTOR__collector_closed (void) { //Close the collector. trap_close_rear_panel(); @@ -37,8 +59,8 @@ gutter__CLOSE_COLLECTOR__collector_closed (gutter_t *user) * => GO_TO_GUTTER * The position failed, shall try another path. */ -gutter_branch_t -gutter__GO_TO_GUTTER__position_failed (gutter_t *user) +fsm_branch_t +gutter__GO_TO_GUTTER__position_failed (void) { return gutter_next (GO_TO_GUTTER, position_failed); } @@ -48,8 +70,8 @@ gutter__GO_TO_GUTTER__position_failed (gutter_t *user) * => OPEN_COLLECTOR * The robo is near the gutter and the door can be opened. */ -gutter_branch_t -gutter__GO_TO_GUTTER__position_reached (gutter_t *user) +fsm_branch_t +gutter__GO_TO_GUTTER__position_reached (void) { // Open the collector. trap_open_rear_panel(); @@ -61,8 +83,8 @@ gutter__GO_TO_GUTTER__position_reached (gutter_t *user) * => CLOSE_COLLECTOR * Wait some time and clse the door. */ -gutter_branch_t -gutter__OPEN_COLLECTOR__collector_opened (gutter_t *user) +fsm_branch_t +gutter__OPEN_COLLECTOR__collector_opened (void) { utils_delay_ms(4.4); return gutter_next (OPEN_COLLECTOR, collector_opened); -- cgit v1.2.3