From f1926dbca3260f344621522715f82aa29fe1f931 Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Mon, 18 Mar 2013 00:52:36 +0100 Subject: digital/io-hub/src/apbirthday: compile FSM --- digital/io-hub/src/apbirthday/Makefile | 15 ++++++++++++-- digital/io-hub/src/apbirthday/main.cc | 7 +++++++ digital/io-hub/src/apbirthday/top.cc | 37 ++++++++++++++++++++++++++++++++++ 3 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 digital/io-hub/src/apbirthday/top.cc (limited to 'digital/io-hub/src/apbirthday') 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) -- cgit v1.2.3