inc/ecu/hsm.h Source File
|
ECU
|
hsm.h
Go to the documentation of this file.
const struct ecu_hsm_state ECU_HSM_TOP_STATE
The default top state. Serves as the root of every hsm.
void ecu_hsm_start(struct ecu_hsm *me)
Starts the hsm by entering from ECU_HSM_TOP_STATE to the target state supplied in ecu_hsm_ctor()....
void ecu_hsm_ctor(struct ecu_hsm *me, const struct ecu_hsm_state *state, uint8_t height)
Hsm constructor.
void ecu_hsm_dispatch(struct ecu_hsm *me, const void *event)
Relays event to hsm where it is processed by the current state's handler function....
void ecu_hsm_change_state(struct ecu_hsm *me, const struct ecu_hsm_state *state)
Transitions hsm into a new state.
Single state in hsm, initialized via ECU_HSM_STATE_CTOR(). Pointers are const-qualified to only allow...
Definition: hsm.h:122
bool(*const handler)(struct ecu_hsm *me, const void *event)
Processes events dispatched to this state. Mandatory. Return true if the dispatched event is processe...
Definition: hsm.h:160
void(*const entry)(struct ecu_hsm *me)
Executes when state first entered. Optional.
Definition: hsm.h:147
const struct ecu_hsm_state *const parent
This state's parent.
Definition: hsm.h:163
void(*const exit)(struct ecu_hsm *me)
Executes when state exits. Optional.
Definition: hsm.h:150
void(*const initial)(struct ecu_hsm *me)
Transitions to starting (child) state when a transition targets a composite state....
Definition: hsm.h:155
Hierarchical state machine. Users create their own HSMs by containing this as an intrusive member.
Definition: hsm.h:175
uint8_t height
Number of levels in the hsm, starting at 0. Used as a fail safe to avoid infinite loops when traversi...
Definition: hsm.h:182
uint32_t transition
Bitmap representing hsm's state transition context.
Definition: hsm.h:185
Generated by