summaryrefslogtreecommitdiff
path: root/digital/io/src/main.c
diff options
context:
space:
mode:
authorJérémy Dufour2008-04-24 23:47:40 +0200
committerJérémy Dufour2008-04-24 23:47:40 +0200
commit4d88c551ef61836af59f86ca1dd41c47ed2ead9a (patch)
tree54816330083f6340665b565ac34b3276ee0bb1dc /digital/io/src/main.c
parent457485aebff5c6bbe9e4075dd0f61bbafa9dc8d9 (diff)
* digital/io/src
- when a sub FSM finished, it posts an event for the top FSM which will be notified in the next main loop iteration (rather than the actual one).
Diffstat (limited to 'digital/io/src/main.c')
-rw-r--r--digital/io/src/main.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/digital/io/src/main.c b/digital/io/src/main.c
index 81928cd6..0baf8738 100644
--- a/digital/io/src/main.c
+++ b/digital/io/src/main.c
@@ -64,6 +64,11 @@ static void main_loop (void);
enum team_color_e bot_color;
/**
+ * Post a event to the top FSM in the next iteration of main loop.
+ */
+uint8_t main_post_event_for_top_fsm;
+
+/**
* Initialize the main and all its subsystems.
*/
static void
@@ -197,6 +202,14 @@ main_loop (void)
{
FSM_HANDLE_EVENT (&gutter_fsm, GUTTER_EVENT_wait_finished);
}
+ /* Event generated at the end of the sub FSM to post to the top FSM */
+ if (main_post_event_for_top_fsm)
+ {
+ /* Post the event */
+ FSM_HANDLE_EVENT (&top_fsm, main_post_event_for_top_fsm - 1);
+ /* Reset */
+ main_post_event_for_top_fsm = 0;
+ }
/* TODO: Check other sensors */
}
}