summaryrefslogtreecommitdiffhomepage
path: root/digital/io/src/main.c
diff options
context:
space:
mode:
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 */
}
}