summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNélio Laranjeiro2008-04-10 00:44:25 +0200
committerNélio Laranjeiro2008-04-10 00:44:25 +0200
commit1d62fb05a261f1816a5be47d31abe64cdebcff00 (patch)
tree18f0be7f2738989c5479d5debcc932e406785a91
parent4078cbc146a2c0c7d23bd12b64930a771ccd0281 (diff)
Added the topfsm. pb with the fsm generation.
-rw-r--r--digital/io/src/Makefile10
-rw-r--r--digital/io/src/fsm.h1
-rw-r--r--digital/io/src/topfsm.c43
-rw-r--r--digital/io/src/topfsm.fsm (renamed from digital/io/src/mainFsm.fsm)2
-rw-r--r--digital/io/src/topfsm.h39
5 files changed, 89 insertions, 6 deletions
diff --git a/digital/io/src/Makefile b/digital/io/src/Makefile
index 0bc02433..c9666126 100644
--- a/digital/io/src/Makefile
+++ b/digital/io/src/Makefile
@@ -3,7 +3,8 @@ PROGS = io
io_SOURCES = main.c asserv.c servo.avr.c eeprom.avr.c trap.c sharp.c \
simu.host.c \
fsm.c getsamples.c getsamples_fsm.c getsamples_cb.c \
- gutter_fsm.c gutter_cb.c move_fsm.c move_cb.c move.c
+ gutter_fsm.c gutter_cb.c move_fsm.c move_cb.c move.c \
+ topfsm.c
MODULES = proto uart twi utils adc
CONFIGFILE = avrconfig.h
# atmega8, atmega8535, atmega128...
@@ -42,12 +43,11 @@ EXTRA_CLEAN_FILES = getsamples_fsm.h getsamples_fsm.c getsamples_cb.h \
gutter_fsm.h gutter_fsm.c gutter_cb.h \
gutter_cb_skel.c gutter.png \
move_fsm.h move_fsm.c move.png move_cb.h move_cb_skel.c \
- mainFsm.h mainFsm.c mainFsm.png mainFsm_cb.h \
- mainFsm_cb_skel.c
+ topfsm.png
# Bootstrap, fsm should be generated before fsm.h is used.
fsm.c: fsm.h
-fsm.h: getsamples_fsm.h gutter_fsm.h move_fsm.h
+fsm.h: getsamples_fsm.h gutter_fsm.h move_fsm.h topfsm.h
DFAGEN = python $(BASE)/../../tools/dfagen/dfagen.py
@@ -83,7 +83,7 @@ else
endif
-png: getsamples.png gutter.png move.png mainFsm.png
+png: getsamples.png gutter.png move.png topfsm.png
%.png: %.dot
dot -Tpng -o $@ $<
diff --git a/digital/io/src/fsm.h b/digital/io/src/fsm.h
index d4a6fef8..84bc960b 100644
--- a/digital/io/src/fsm.h
+++ b/digital/io/src/fsm.h
@@ -88,5 +88,6 @@ fsm_handle_event (fsm_t *fsm, u8 event);
#include "getsamples_fsm.h"
#include "gutter_fsm.h"
#include "move_fsm.h"
+#include "topfsm.h"
#endif /* fsm_h */
diff --git a/digital/io/src/topfsm.c b/digital/io/src/topfsm.c
new file mode 100644
index 00000000..27eef2b2
--- /dev/null
+++ b/digital/io/src/topfsm.c
@@ -0,0 +1,43 @@
+/* robot_main_fsm.c */
+/* io - Input & Output with Artificial Intelligence (ai) support on AVR. {{{
+ *
+ * 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 "asserv.h"
+#include "topfsm.h"
+#include "fsm.h"
+
+struct topfsm_data_t topfsm_data;
+
+/** Start a main FSM. */
+void
+robot_main_start (void)
+{
+ /* Set parameters. */
+ topfsm_data.sequence = 0x15;
+ /* Start the FSM. */
+/* fsm_init (&robot_main_fsm);
+ fsm_handle_event (&robot_main_fsm, ROBOT_MAIN_EVENT_ok);
+ */
+}
+
diff --git a/digital/io/src/mainFsm.fsm b/digital/io/src/topfsm.fsm
index 35482f52..d0631813 100644
--- a/digital/io/src/mainFsm.fsm
+++ b/digital/io/src/topfsm.fsm
@@ -1,5 +1,5 @@
# Main FSM.
-mainfsm
+topfsm
States:
START
diff --git a/digital/io/src/topfsm.h b/digital/io/src/topfsm.h
new file mode 100644
index 00000000..f6b1f0bf
--- /dev/null
+++ b/digital/io/src/topfsm.h
@@ -0,0 +1,39 @@
+#ifndef topfsm_h
+#define topfsm_h
+/* topfsm.h */
+/* io - Input & Output with Artificial Intelligence (ai) support on AVR. {{{
+ *
+ * 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.
+ *
+ * }}} */
+
+struct topfsm_data_t
+{
+ uint8_t sequence;
+};
+
+extern struct topfsm_data_t topfsm_data;
+
+/** Start a main FSM. */
+void
+topfsm_start (void);
+
+#endif /* topfsm_h */