summaryrefslogtreecommitdiff
path: root/digital/io/src/getsamples/getsamples.c
diff options
context:
space:
mode:
authorNélio Laranjeiro2008-03-19 00:27:23 +0100
committerNélio Laranjeiro2008-03-19 00:27:23 +0100
commit1f9e5a0242b608ea941d6f8ea32fdc89c60224c1 (patch)
treee636167be96206e63fefa56aad37772a394bbcc5 /digital/io/src/getsamples/getsamples.c
parent164ac3a34cbac441e82b256c97cb8784ea9d482c (diff)
First dfagen for the getsamples fsm. This is only a first shoot, all the
transitions are not presents.
Diffstat (limited to 'digital/io/src/getsamples/getsamples.c')
-rw-r--r--digital/io/src/getsamples/getsamples.c71
1 files changed, 71 insertions, 0 deletions
diff --git a/digital/io/src/getsamples/getsamples.c b/digital/io/src/getsamples/getsamples.c
new file mode 100644
index 00000000..6044d092
--- /dev/null
+++ b/digital/io/src/getsamples/getsamples.c
@@ -0,0 +1,71 @@
+/*
+ * THIS IS AN AUTOMATICALLY GENERATED FILE, DO NOT EDIT!
+ *
+ * get_samples
+ *
+ *
+ */
+#include "getsamples_cb.h"
+#include <stddef.h>
+#include <assert.h>
+
+struct getsamples_t { getsamples_state_t fsm; };
+
+/* get_samples transition table. */
+static const getsamples_transition_t
+getsamples_transition_table[GETSAMPLES_STATE_NB][GETSAMPLES_EVENT_NB] = {
+ { getsamples__PREPARE_ARM__arm_prepared,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL },
+ { NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL },
+ { NULL,
+ getsamples__FORWARD_CONTROL__move_finished,
+ NULL,
+ NULL,
+ NULL,
+ NULL },
+ { NULL,
+ getsamples__GO_TO_POSITION__move_finished,
+ NULL,
+ getsamples__GO_TO_POSITION__move_blocked,
+ NULL,
+ NULL },
+ { NULL,
+ NULL,
+ NULL,
+ NULL,
+ getsamples__PREPARE_CLASSIFIER__classifer_prepared,
+ NULL },
+};
+
+/* Initialise get_samples automaton. */
+void
+getsamples_init (getsamples_t *user)
+{
+ user->fsm = GETSAMPLES_STATE_GO_TO_POSITION;
+}
+
+/* Handle events on get_samples automaton. */
+void
+getsamples_handle_event (getsamples_t *user, getsamples_event_t event)
+{
+ assert (user);
+ getsamples_state_t state = user->fsm;
+ assert (state < GETSAMPLES_STATE_NB);
+ assert (event < GETSAMPLES_EVENT_NB);
+ getsamples_transition_t tr = getsamples_transition_table[state][event];
+ assert (tr);
+ getsamples_branch_t br = tr (user);
+ assert (((br >> 16) & 0xff) == state);
+ assert (((br >> 8) & 0xff) == event);
+ user->fsm = br & 0xff;
+}
+