Stateflow | ![]() ![]() |
Exporting Events
Stateflow allows a state machine to export events. Exporting events enables external code to trigger events in the state machine. To export an event, first add the event to the data dictionary as a child of the state machine (see Adding Events to the Data Dictionary). Then set the new event's Scope
property to Exported
.
When encoding a state machine that parents exported events, the Stateflow code generator generates a function for each exported event. The C prototype for the exported event function has the form
void external_broadcast_EVENT()
where EVENT
is the name of the exported event. External code built into the target containing the state machine can trigger the event by invoking the event function. For example, suppose you define an exported event named switch_on
. External code can trigger this event by invoking the generated function external_broadcast_trigger_on
. See Exported Events for an example of how to trigger an exported event.
![]() | Defining Output Events | Importing Events | ![]() |