Mux Class

class MuxClass : public Acroname::BrainStem::EntityClass

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 (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).

Public Functions

MuxClass(void)

Constructor.

~MuxClass(void)

Destructor.

void init(Module *pModule, const uint8_t index)

Initialize the class.

Parameters
  • pModule: The module to which this entity belongs.
  • index: The index of the entity, i.e. aMUX_UART or aMUX_USB.

aErr getEnable(uint8_t *bEnabled)

Get the mux enable/disable status

Return
Returns common entity return values
Parameters
  • bEnabled: true: mux is enabled, false: the mux is disabled.

aErr setEnable(const uint8_t bEnable)

Enable the mux.

Return
Returns common entity return values
Parameters
  • bEnable: true: enables the mux for the selected channel.

aErr getChannel(uint8_t *channel)

Get the current selected mux channel.

Return
Returns common entity return values
Parameters
  • channel: Indicates which chanel is selected.

aErr setChannel(const uint8_t channel)

Set the current mux channel.

Return
Returns common entity return values
Parameters
  • channel: mux channel to select.

aErr getChannelVoltage(const uint8_t channel, int32_t *microVolts)

Get the voltage of the indicated mux channel.

Note
Not all modules provide 32 bits of accuracy; Refer to the module’s datasheet to determine the analog bit depth and reference voltage.
Return
Returns common entity return values
Parameters
  • channel: The channel in which voltage was requested.
  • microVolts: 32 bit signed integer (in microVolts) based on the board’s ground and reference voltages.

aErr getConfiguration(int32_t *config)

Get the configuration of the mux.

Return
Returns common entity return values
Parameters
  • config: integer representing the mux configuration either default, or split-mode.

aErr setConfiguration(const int32_t config)

Set the configuration of the mux.

Return
Returns common entity return values
Parameters
  • config: integer representing the mux configuration either muxConfig_default, or muxConfig_splitMode.

aErr getSplitMode(int32_t *splitMode)

Get the current mux mode.

Return
Returns common entity return values
Parameters
  • splitMode: integer representing the channel selection for each sub-channel within the mux. See the data-sheet for the device for specific information.

aErr setSplitMode(const int32_t splitMode)

Set the current mux mode.

Return
Returns common entity return values
Parameters
  • splitMode: integer representing the channel selection for each sub-channel within the mux. See the data-sheet for the device for specific information.