aboutsummaryrefslogtreecommitdiff
path: root/robot/modes.h
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2022-05-26 14:05:53 +0200
committerlonkaars <loek@pipeframe.xyz>2022-05-26 14:05:53 +0200
commitd70f4f44f927281d6c9bfff64264bd754d682dc8 (patch)
treeff0ed034fba83a8f4d3c00cd0b7e1e6d78d75082 /robot/modes.h
parentf7387fd6af14a740f474620555de379bc9ba69db (diff)
implement mode command
Diffstat (limited to 'robot/modes.h')
-rw-r--r--robot/modes.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/robot/modes.h b/robot/modes.h
index dd34690..fe81043 100644
--- a/robot/modes.h
+++ b/robot/modes.h
@@ -1,5 +1,11 @@
#pragma once
+#include "mode_grid.h"
+#include "mode_halt.h"
+#include "mode_lcal.h"
+#include "mode_maze.h"
+
+/** function pointer to current mode */
extern void (*g_w2_current_mode)();
/**
@@ -8,3 +14,27 @@ extern void (*g_w2_current_mode)();
* executes mode in g_w2_current_mode
*/
void w2_modes_main();
+
+/** mode constants */
+typedef enum {
+ W2_M_PREV = -1,
+ W2_M_MAZE = 0,
+ W2_M_GRID = 1,
+ W2_M_HALT = 2,
+ W2_M_LCAL = 3,
+ W2_M_CHRG = 4,
+ W2_M_DIRC = 5,
+ W2_M_SPIN = 6,
+ W2_M_SCAL = 7,
+} w2_e_mode;
+
+/** array that maps w2_e_mode to mode function pointers */
+static const void(*const W2_MODES[]) = {
+ &w2_mode_maze,
+ &w2_mode_grid,
+ &w2_mode_grid,
+ &w2_mode_halt,
+};
+
+/** switch the current mode */
+void w2_modes_switch(w2_e_mode new_mode);