summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Schodet2013-03-18 00:52:36 +0100
committerNicolas Schodet2013-03-18 00:52:36 +0100
commit17dc6433be05af26b1254368c9d8821bb25219bb (patch)
tree9d9b48f147125ed5927ec0b1e070ff34fed0733c
parentbe3293bd42688b1fede64b36c2d40920cc1954a4 (diff)
WIP FSMfsm
-rw-r--r--.gitignore2
-rw-r--r--digital/io-hub/src/apbirthday/Makefile15
-rw-r--r--digital/io-hub/src/apbirthday/main.cc7
-rw-r--r--digital/io-hub/src/apbirthday/top.cc37
4 files changed, 59 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore
index 7fbee396..30b767f5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,6 +15,8 @@ tags
*.mpd
fsm_AI_gen.avr.c
angfsm_gen_avr_AI.h
+angfsm_gen_arm_AI.arm.c
+angfsm_gen_arm_AI.h
AI.dot
AI.png
AI.svg
diff --git a/digital/io-hub/src/apbirthday/Makefile b/digital/io-hub/src/apbirthday/Makefile
index cc32c783..bc26624a 100644
--- a/digital/io-hub/src/apbirthday/Makefile
+++ b/digital/io-hub/src/apbirthday/Makefile
@@ -2,12 +2,23 @@ BASE = ../../../ucoolib
TARGETS = host stm32f4
PROGS = apbirthday
-apbirthday_SOURCES = main.cc robot.cc hardware.host.cc hardware.stm32.cc
+apbirthday_SOURCES = main.cc robot.cc hardware.host.cc hardware.stm32.cc \
+ top.cc \
+ angfsm.host.c angfsm_gen_arm_AI.arm.c
MODULES = hal/gpio hal/uart hal/usb base/proto
+# FSM.
+INCLUDES += -I$(BASE)/../ai/src/fsm -I.
+vpath %.c $(BASE)/../ai/src/fsm
+
include $(BASE)/build/top.mk
clean: clean.project
clean.project:
- rm -f usb zb_uart
+ rm -f usb zb_uart angfsm_gen_arm_AI.h angfsm_gen_arm_AI.arm.c
+
+obj/main.stm32f4.o: angfsm_gen_arm_AI.h
+angfsm_gen_arm_AI.arm.c: angfsm_gen_arm_AI.h
+angfsm_gen_arm_AI.h: apbirthday.host
+ ./$< --ang-gen arm && mv angfsm_gen_arm_AI.c angfsm_gen_arm_AI.arm.c
diff --git a/digital/io-hub/src/apbirthday/main.cc b/digital/io-hub/src/apbirthday/main.cc
index ef9c8119..f6f244f7 100644
--- a/digital/io-hub/src/apbirthday/main.cc
+++ b/digital/io-hub/src/apbirthday/main.cc
@@ -25,9 +25,16 @@
#include "ucoolib/common.hh"
#include "robot.hh"
+extern "C" {
+#define ANGFSM_NAME AI
+#include "angfsm.h"
+}
+
int
main (int argc, const char **argv)
{
+ if (ANGFSM_OPTIONS (argc, (char **) argv))
+ return 0;
ucoo::arch_init (argc, argv);
Robot robot;
robot.main_loop ();
diff --git a/digital/io-hub/src/apbirthday/top.cc b/digital/io-hub/src/apbirthday/top.cc
new file mode 100644
index 00000000..8975f67f
--- /dev/null
+++ b/digital/io-hub/src/apbirthday/top.cc
@@ -0,0 +1,37 @@
+// io-hub - Modular Input/Output. {{{
+//
+// Copyright (C) 2013 Nicolas Schodet
+//
+// 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 "top.hh"
+
+extern "C" {
+#define ANGFSM_NAME AI
+#include "angfsm.h"
+}
+
+ANGFSM_INIT
+
+ANGFSM_STATES (
+ // Initial state.
+ TOP_START)
+
+ANGFSM_START_WITH (TOP_START)