-
Your event is an integer. What was your intention if the event/signal came with some data? For example:
Did you intend that these would be members of the machine structure? Did you consider adding a pointer next to event integer as |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hello, Yes, event is an unsigned integer in this state machine framework. It is a member of state machine structure as shown below, //! Abstract state machine structure
struct state_machine_t
{
uint32_t Event; //!< Pending Event for state machine
const state_t* State; //!< State of state machine.
}; Here the intention is, user shall inherit // Derived state machine
struct user_state_machine
{
state_machine_t; // Base state machine. Must be the first member of user derived state machine.
// User specific state machine members
uint32_t data1;
uint32_t data2;
uint32_t data3;
}; This framework doesn't mix event and the data. handling of data shall be part of user specific state machine members in the
For example, in toaster_oven state machine provides several APIs. These API can be extended to accept additional data as arguments. void start_oven(oven_t* const pOven, uint32_t toastTime)
{
pOven->Set_Time = toastTime;
pOven->Machine.Event = EN_START;
}
|
Beta Was this translation helpful? Give feedback.
Hello,
Yes, event is an unsigned integer in this state machine framework. It is a member of state machine structure as shown below,
Here the intention is, user shall inherit
state_machine_t
structure as shown below,This framework doesn't mix event and the …