Trigger: GPIO
The GPIO trigger monitors one GPIO pin and can activate while the pin is low or high (state mode), or can activate briefly for one event tick when the pin changes state (edge mode). Among other things, state mode can be used to enable streaming by hardware, without having to send a MIP command. Edge mode can be used for obtaining precisely-timestamped data.
Configuration
State Mode
Mode = WHILE_HIGH or WHILE_LOW
State mode causes the trigger to be active as long as the pin remains in the specified state. The pin must be configured for the GPIO feature using the GPIO Configuration (0x0C,0x41) command. The pin behavior may be either input or output.
The pin state is sampled every event cycle.
For an example using this mode, see Gated Data Streaming using a GPIO.
Edge Mode
Mode = EDGE
Edge mode causes the trigger to activate for a single event cycle when the pin changes state. To use this mode, the pin must be configured for the TIMESTAMP feature with the GPIO Configuration (0x0C,0x41) command. The behavior setting determines the edge direction; it can be rising, falling, or both.
Because the pin is configured with the timestamp feature, the exact time of the edge is captured directly by the hardware. When combined with a Message action, the data packet will be emitted with data as if it were sampled at that time. If included, any timestamp field (such as the Reference Timestamp (0xFF,0xD5) ) will contain the time of the pin’s transition. Other data quantities will be interpolated using the nearest available samples. See the Message action for more details.
For an example using this mode, see Synchronizing Data Output with an External System.
GPIO Configuration
Since the event trigger relies on GPIO functionality, the pin must always be configured to the proper mode with the GPIO Configuration (0x0C,0x41) command. The following diagram illustrates how the signal is routed from the GPIO pin to the trigger state.
Notice that the signal is routed through different paths for state mode and edge mode. The GPIO feature setting must select the same path as the trigger or it will not work. Also notice that the edge direction is selected by the GPIO configuration and not the trigger mode. This is because the edge detector is a hardware feature of the GPIO controller.
Timing
Because the event system operates on a fixed timing cycle, only one transition per event tick can be registered. If two transitions are detected, only one trigger pulse and associated timestamp will occur. The timestamp feature allows very precise and accurate timing but does not allow data sampling or processing above the event tick rate.
See the Event Cycle rate in Protocol Support and Specifications.