Stateflow | ![]() ![]() |
Importing Events
The Stateflow machine can import events defined by external code. Importing an event allows the Stateflow machine built into a stand-alone or Real-Time Workshop target to trigger the event in external code. To import an event, first add the event to the data dictionary as a child of the Stateflow machine that needs to trigger the event (see Adding Events to the Data Dictionary). Then set the new event's Scope
property to Imported
.
Note The Stateflow machine serves as a surrogate parent for imported events. This means that you must use the Explorer to add imported events to the data dictionary. |
Stateflow assumes that external code defines each imported event as a function whose prototype is of the form
where EVENT
is the Stateflow name of the imported event. For example, suppose that the Stateflow machine imports an external event named switch_on
. Then Stateflow assumes that external code defines a function named external_broadcast_switch_on
that broadcasts the event to external code. When building a target for the Stateflow machine, the Stateflow code generator encodes actions that signal imported events as calls to the corresponding external broadcast event functions defined by the external code.
![]() | Exporting Events | Specifying Trigger Types | ![]() |