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 (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).
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
- Parameters:
bEnabled – true: mux is enabled, false: the mux is disabled.
- Returns:
Returns common entity return values
- aErr setEnable(const uint8_t bEnable)¶
Enable the mux.
- Parameters:
bEnable – true: enables the mux for the selected channel.
- Returns:
Returns common entity return values
- aErr getChannel(uint8_t *channel)¶
Get the current selected mux channel.
- Parameters:
channel – Indicates which chanel is selected.
- Returns:
Returns common entity return values
- aErr setChannel(const uint8_t channel)¶
Set the current mux channel.
- Parameters:
channel – mux channel to select.
- Returns:
Returns common entity return values
- 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.
- 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.
- Returns:
Returns common entity return values
- aErr getConfiguration(int32_t *config)¶
Get the configuration of the mux.
- Parameters:
config – integer representing the mux configuration either default, or split-mode.
- Returns:
Returns common entity return values
- aErr setConfiguration(const int32_t config)¶
Set the configuration of the mux.
- Parameters:
config – integer representing the mux configuration either muxConfig_default, or muxConfig_splitMode.
- Returns:
Returns common entity return values
- aErr getSplitMode(int32_t *splitMode)¶
Get the current split mode mux configuration.
- Parameters:
splitMode – integer representing the channel selection for each sub-channel within the mux. See the data-sheet for the device for specific information.
- Returns:
Returns common entity return values
- aErr setSplitMode(const int32_t splitMode)¶
Sets the mux’s split mode configuration.
- Parameters:
splitMode – integer representing the channel selection for each sub-channel within the mux. See the data-sheet for the device for specific information.
- Returns:
Returns common entity return values