44
13 Ember+ Interface
Virtual GPIO Control
The virtual GPIO branch of the Ember+ provider interface allows monitoring
and control of the virtual GPIO ports. Fig 13-4 shows the structure of each
virtual GPIO child node. For further details on the configuration options,
refer to page 38.
Fig 13-4: Ember+ Virtual GPIO Branch Structure
Type Parameter
This enumerated integer parameter is the current virtual GPIO port type.
Input Function Parameter
This enumerated integer parameter is the function that will be activated
when the virtual GPIO port, when configured as an input, is asserted.
Input Driver Name Parameter
This string parameter is the name of the virtual output on a remote unit
that drives the virtual GPIO port when it is configured as an input.
Output Trigger Parameter
This enumerated integer parameter is the function that triggers the GPIO
port when it is configured as an output.
Status Parameter
The status parameter shown in Fig 13-4 represents the current state of the
virtual GPIO port regardless of whether the port is set as an input or an
output. A value of 0 indicates the port is inactive and a 1 indicates the port
is active. This parameter has an Ember+ stream identifier and a consumer
can subscribe to it to automatically receive updates when the status
changes.
Set Output Function
The set output leaf shown in Fig 13-4 is a function that allows control of the
virtual GPIO port when it is configured as an output. To use this function,
the output trigger must be set to ember-consumer, and at least one remote
unit must have this output selected as the driver for a virtual input. The
function exposes 1 argument called enable, which is an integer with a value
of non-zero for assert the output, or zero for de-assert the output. The
function also returns an integer result which reflects the current state of
the virtual GPIO output similar to the status parameter. A return value of -1
indicates there was an error invoking the function. If the virtual GPIO port is
configured as an input, invoking this function has no effect.