Mux¶
See the Mux Entity for generic information.
- class brainstem.entity.Mux(module, index)[source]¶
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.
- Returns:
- Object containing error code and returned value on success.
- errorunsigned byte
An error result from the list of defined error codes
- valueunsigned char
Indicates which chanel is selected.
- Return type:
- getChannelVoltage(channel)[source]¶
Get the voltage of the indicated mux channel.
- Parameters:
channel (unsigned char) – The channel in which voltage was requested.
Note
Not all modules provide 32 bits of accuracy; Refer to the module’s datasheet to determine the analog bit depth and reference voltage.
- Returns:
- Object containing error code and returned value on success.
- errorunsigned byte
An error result from the list of defined error codes
- valueint
32 bit signed integer (in microvolts) based on the board’s ground and reference voltages.
- Return type:
- getConfiguration()[source]¶
Get the configuration of the mux.
- Returns:
- Object containing error code and returned value on success.
- errorunsigned byte
An error result from the list of defined error codes
- valueint
integer representing the mux configuration either default, or split-mode.
- Return type:
- getEnable()[source]¶
Get the mux enable/disable status
- Returns:
- Object containing error code and returned value on success.
- errorunsigned byte
An error result from the list of defined error codes
- valuebool
true: mux is enabled, false: the mux is disabled.
- Return type:
- getSplitMode()[source]¶
Get the current split mode mux configuration.
- Returns:
- Object containing error code and returned value on success.
- errorunsigned byte
An error result from the list of defined error codes
- valueint
integer representing the channel selection for each sub-channel within the mux. See the data-sheet for the device for specific information.
- Return type:
- setChannel(channel)[source]¶
Set the current mux channel.
- Parameters:
channel (unsigned char) – mux channel to select.
- Returns:
An error result from the list of defined error codes in brainstem.result.Result
- Return type:
unsigned byte
- setConfiguration(config)[source]¶
Set the configuration of the mux.
- Parameters:
config (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.Result
- Return type:
unsigned byte
- setEnable(enable)[source]¶
Enable the mux.
- Parameters:
enable (bool) – true: enables the mux for the selected channel.
- Returns:
An error result from the list of defined error codes in brainstem.result.Result
- Return type:
unsigned byte
- setSplitMode(split_mode)[source]¶
Sets the mux’s split mode configuration.
- Parameters:
split_mode (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.Result
- Return type:
unsigned byte