#define STM_EVT_NO_RESTRICTION_MODE_ON 0x0F
// Category number
-#define STM_CTG_NO_NONE 0x0100
-#define STM_CTG_NO_HOMESCREEN 0x0200
-#define STM_CTG_NO_MAP 0x0300
-#define STM_CTG_NO_GENERAL 0x0400
-#define STM_CTG_NO_SPLITABLE 0x0500
-#define STM_CTG_NO_POPUP 0x0600
-#define STM_CTG_NO_SYSTEM_ALERT 0x0700
-#define STM_CTG_NO_RESTRICTION 0x0800
+#define STM_CTG_NO_HOMESCREEN 0x0100
+#define STM_CTG_NO_MAP 0x0200
+#define STM_CTG_NO_GENERAL 0x0300
+#define STM_CTG_NO_SPLITABLE 0x0400
+#define STM_CTG_NO_POPUP 0x0500
+#define STM_CTG_NO_SYSTEM_ALERT 0x0600
+#define STM_CTG_NO_RESTRICTION 0x0700
+#define STM_CTG_NO_SYSTEM 0x0800
// Area number
-#define STM_ARA_NO_FULL 0x010000
-#define STM_ARA_NO_NORMAL 0x020000
-#define STM_ARA_NO_SPLIT_MAIN 0x030000
-#define STM_ARA_NO_SPLIT_SUB 0x040000
-#define STM_ARA_NO_ON_SCREEN 0x050000
-#define STM_ARA_NO_RESTRICTION_NORMAL 0x060000
-#define STM_ARA_NO_RESTRICTION_SPLIT_MAIN 0x070000
-#define STM_ARA_NO_RESTRICTION_SPLIT_SUB 0x080000
+#define STM_ARA_NO_NONE 0x010000
+#define STM_ARA_NO_FULL 0x020000
+#define STM_ARA_NO_NORMAL 0x030000
+#define STM_ARA_NO_SPLIT_MAIN 0x040000
+#define STM_ARA_NO_SPLIT_SUB 0x050000
+#define STM_ARA_NO_POP_UP 0x060000
+#define STM_ARA_NO_RESTRICTION_NORMAL 0x070000
+#define STM_ARA_NO_RESTRICTION_SPLIT_MAIN 0x080000
+#define STM_ARA_NO_RESTRICTION_SPLIT_SUB 0x090000
// Mask
#define STM_MSK_EVT_NO 0x0000FF
#define STM_MSK_CTG_NO 0x00FF00
#define STM_MSK_ARA_NO 0xFF0000
-// Number of events, categories and areas
-#define STM_NUM_EVT 15
-//#define STM_NUM_CTG 7
-#define STM_NUM_ARA 8
-
// Enum for state
enum stm_trans_gear_state_ {
gStmTransGearStateNoN = 0,
};
enum stm_car_state_ {
- gStmCarStateNoStop = 0,
- gStmCarStateNoRun
+ gStmRunningNoStop = 0,
+ gStmRunningNoRun
};
enum stm_lamp_state_ {
gStmLayoutNoRestriction,
gStmLayoutNoRestrictionSplitMain,
gStmLayoutNoRestrictionSplitSub,
+ gStmLayoutNoSystem,
+};
+
+enum stm_event_ {
+ gStmEventNoActive = 0,
+ gStmEventNoDeactive,
+ gStmEventNoTransGearN,
+ gStmEventNoTransGearNotN,
+ gStmEventNoParkingBrakeOff,
+ gStmEventNoParkingBrakeOn,
+ gStmEventNoAccelPedalOff,
+ gStmEventNoAccelPedalOn,
+ gStmEventNoTimerExpired,
+ gStmEventNoLampOff,
+ gStmEventNoLampOn,
+ gStmEventNoLightstatusBrakeOff,
+ gStmEventNoLightstatusBrakeOn,
+ gStmEventNoRestrictionModeOff,
+ gStmEventNoRestrictionModeOn,
+
+ gStmEventNoNum,
+
+ gStmEventNoMin = gStmEventNoActive,
+ gStmEventNoMax = gStmEventNoNum - 1,
};
enum stm_category_ {
- gStmCategoryNoNone = 0,
- gStmCategoryNoHomescreen,
+ gStmCategoryNoHomescreen = 0,
gStmCategoryNoMap,
gStmCategoryNoGeneral,
gStmCategoryNoSplitable,
gStmCategoryNoNum,
- gStmCategoryNoMin = gStmCategoryNoNone,
+ gStmCategoryNoMin = gStmCategoryNoHomescreen,
gStmCategoryNoMax = gStmCategoryNoNum - 1,
};
+enum stm_area_ {
+ gStmAreaNoNone = 0,
+ gStmAreaNoFullscreen,
+ gStmAreaNoNormal,
+ gStmAreaNoSplitMain,
+ gStmAreaNoSplitSub,
+ gStmAreaNoOnScreen,
+ gStmAreaNoRestrictionNormal,
+ gStmAreaNoRestrictionSplitMain,
+ gStmAreaNoRestrictionSplitSub,
+
+ gStmAreaNoNum,
+
+ gStmAreaNoMin = gStmAreaNoNone,
+ gStmAreaNoMax = gStmAreaNoNum - 1,
+};
+
enum stm_layer_ {
- gStmLayerNoNone = 0,
- gStmLayerNoHomescreen,
+ gStmLayerNoHomescreen = 0,
gStmLayerNoApps,
gStmLayerNoRestriction,
gStmLayerNoOnScreen,
gStmLayerNoNum,
- gStmLayerNoMin = gStmLayerNoNone,
+ gStmLayerNoMin = gStmLayerNoHomescreen,
gStmLayerNoMax = gStmLayerNoNum - 1,
};
+enum stm_car_element_ {
+ gStmCarElementNoTransGear = 0,
+ gStmCarElementNoParkingBrake,
+ gStmCarElementNoAccelPedal,
+ gStmCarElementNoRunning,
+ gStmCarElementNoLamp,
+ gStmCarElementNoLightstatusBrake,
+ gStmCarElementNoRestrictionMode,
+
+ gStmCarElementNoNum,
+
+ gStmCarElementNoMin = gStmCarElementNoTransGear,
+ gStmCarElementNoMax = gStmCarElementNoNum - 1,
+};
+
+// String for state
extern const char* gStmEventName[];
extern const int gStmEventNo[];
extern const char* gStmCategoryName[];
extern const int gStmCategoryNo[];
extern const char* gStmAreaName[];
extern const int gStmAreaNo[];
+extern const char* gStmLayoutName[];
extern const char* gStmLayerName[];
-
-// String for state
-extern const char* gStmParkingBrakeStateNo2Name[];
-extern const char* gStmAccelPedalStateNo2Name[];
-extern const char* gStmCarStateNo2Name[];
-extern const char* gStmLampStateNo2Name[];
-extern const char* gStmLayoutNo2Name[];
-extern const char* gStmLightstatusBrakeStateNo2Name[];
-extern const char* gStmRestrictionModeStateNo2Name[];
+extern const char* gStmCarElementName[];
+extern const char** gStmCarStateNameList[];
// Struct for state
typedef struct stm_base_state_ {
- int is_changed;
+ int changed;
int state;
} stm_base_state;
-typedef struct stm_layer_state_ {
- stm_base_state on_screen;
- stm_base_state restriction;
- stm_base_state apps;
- stm_base_state homescreen;
-} stm_layer_state;
-
typedef struct {
- stm_base_state trans_gear;
- stm_base_state parking_brake;
- stm_base_state accel_pedal;
- stm_base_state car;
- stm_base_state lamp;
- stm_base_state lightstatus_brake;
- stm_base_state restriction_mode;
+ stm_base_state car_element[gStmCarElementNoNum];
stm_base_state layer[gStmLayerNoNum];
-// stm_layer_state layer;
} stm_state_t;
void stmInitialize();
int stmTransitionState(int event_no, stm_state_t* state);
+void stmUndoState();
#endif // TMCAGLWM_DUMMY_STM_HPP