Mux

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

MuxClass: 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 (multiplexer) 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).

getChannel()[source]

Get the current selected mux channel. Indicates which chanel is selected.

Returns:

Result object containing the requested value when the results error is set to NO_ERROR(0)

Return type:

Result

getChannelVoltage(channel)[source]

Get the voltage of the indicated mux channel. 32 bit signed integer (in microvolts) based on the board’s ground and reference voltages. Note: Not all modules provide 32 bits of accuracy; Refer to the module’s datasheet to determine the analog bit depth and reference voltage.

Parameters:

channel (const unsigned char) – The channel in which voltage was requested.

Returns:

Result object containing the requested value when the results error is set to NO_ERROR(0)

Return type:

Result

getConfiguration()[source]

Get the configuration of the mux. integer representing the mux configuration either default, or split-mode.

Returns:

Result object containing the requested value when the results error is set to NO_ERROR(0)

Return type:

Result

getEnable()[source]

Get the mux enable/disable status true: mux is enabled, false: the mux is disabled.

Returns:

Result object containing the requested value when the results error is set to NO_ERROR(0)

Return type:

Result

getSplitMode()[source]

Get the current split mode mux configuration. integer representing the channel selection for each sub-channel within the mux. See the data-sheet for the device for specific information.

Returns:

Result object containing the requested value when the results error is set to NO_ERROR(0)

Return type:

Result

setChannel(channel)[source]

Set the current mux channel.

Parameters:

channel (const unsigned char) – mux channel to select.

Returns:

An error result from the list of defined error codes in brainstem.result

Return type:

unsigned byte

setConfiguration(config)[source]

Set the configuration of the mux.

Parameters:

config (const int) – integer representing the mux configuration either muxConfig_default, or muxConfig_splitMode.

Returns:

An error result from the list of defined error codes in brainstem.result

Return type:

unsigned byte

setEnable(bEnable)[source]

Enable the mux.

Parameters:

bEnable (const unsigned char) – true: enables the mux for the selected channel.

Returns:

An error result from the list of defined error codes in brainstem.result

Return type:

unsigned byte

setSplitMode(splitMode)[source]

Sets the mux’s split mode configuration.

Parameters:

splitMode (const int) – integer representing the channel selection for each sub-channel within the mux. See the data-sheet for the device for specific information.

Returns:

An error result from the list of defined error codes in brainstem.result

Return type:

unsigned byte