Skip to main content
. 2017 May 30;13(5):e1005430. doi: 10.1371/journal.pcbi.1005430

Fig 3. Example template code available (S3 File) to users for writing custom modules, and corresponding module loaded within RTXI.

Fig 3

(A) Basic C++ header (plugin_template.h) for an RTXI module. (B) Users can declare inputs, outputs, states, parameters, and events for custom modules through the DefaultGUIModel struct and (C) implement hard RT code within the execute function. (D) The update function allows execution of state-specific code for the module. (E) The module after it is compiled with the provided Makefile and loaded into RTXI. Each element of the module GUI is tied to a specific line of code. For example, when “Button A” is clicked, the aBttn_event() (line 35, A) code is executed. Similarly, the “GUI label” (lines 5–6, B) and “A State” (lines 11–13, B) components of the GUI are created by the vars struct and their values are initialized from the INIT block of the update() function (lines 8–9, C). Visit the GitHub repository (S3 File) for complete corresponding C++ implementation (plugin_template.cpp) file.