# Mux¶

class brainstem.stem.Mux(module, index)[source]

Access MUX specialized entities on certain BrainStem modules.

A MUX is a multiplexer that takes one or more similar inputs (bus, connection, or signal) and allows switching to one or more outputs. An analogy would be the switchboard of a telephone operator. Calls (inputs) come in and by re-connecting the input to an output, the operator (multiplexor) can direct that input to on or more outputs.

One possible output is to not connect the input to anything which essentially disables that input’s connection to anything.

Not every MUX has multiple inputs. Some may simply be a single input that can be enabled (connected to a single output) or disabled (not connected to anything).

Useful Constants:
• UPSTREAM_STATE_ONBOARD (0)
• UPSTREAM_STATE_EDGE (1)
• UPSTREAM_MODE_AUTO (0)
• UPSTREAM_MODE_ONBOARD (1)
• UPSTREAM_MODE_EDGE (2)
• DEFAULT_MODE (UPSTREAM_MODE_AUTO)
getChannel()[source]

Gets the current selected channel.

Param:
channel (int): The channel of the mux to enable.
Returns: Return NO_ERROR on success, or one of the common sets of return error codes on failure. Result.error
getConfiguration()[source]

Gets the configuration of the Mux.

Returns: Return result object with NO_ERROR set and the current mux voltage setting in the Result.value or an Error. Result
getEnable()[source]

Gets the enable/disable status of the mux.

Returns: Return NO_ERROR on success, or one of the common sets of return error codes on failure. Result.error
getSplitMode()[source]

Gets the bit packed mux split configuration.

Returns: Return result object with NO_ERROR set and the current mux voltage setting in the Result.value or an Error. Result
getVoltage(channel)[source]

Gets the voltage of the specified channel.

On some modules this is a measured value so may not exactly match what was previously set via the setVoltage interface. Refer to the module datasheet to to determine if this is a measured or stored value.

Returns: Return result object with NO_ERROR set and the current mux voltage setting in the Result.value or an Error. Result
setChannel(channel)[source]

Enables the specified channel of the mux.

Param:
channel (int): The channel of the mux to enable.
Returns: Return NO_ERROR on success, or one of the common sets of return error codes on failure. Result.error
setConfiguration(config)[source]

Sets the configuration of the mux.

Returns: Return NO_ERROR on success, or one of the common sets of return error codes on failure. Result.error
setEnable(bEnable)[source]

Enables or disables the mux based on the param.

Param:
bEnable (bool): True = Enable, False = Disable
Returns: Return NO_ERROR on success, or one of the common sets of return error codes on failure. Result.error
setSplitMode(splitMode)[source]

Sets the mux split configuration

Returns: Return NO_ERROR on success, or one of the common sets of return error codes on failure. Result.error