MUX_GENERIC(9)
π NAME π
mux_generic β bestie, it picks one from several input values. like a lil choose-your-own-adventure for signals π
β¨ SYNOPSIS β¨
loadrt mux_generic config="bb8,fu12...."
okay so that's the whole vibe. one line. iconic. π
π FUNCTIONS π
mux-gen.NNβ depending on the data types, this can run in either a floating point thread or a non-floating point thread. it's giving versatile π
π¦ PINS π¦
mux-gen.NN.suppress-no-inputbit in β this suppresses changing the output if all select lines are false. it stops those unwanted jumps in the output between transitions of input, but heads up: it makesin00unavailable. so, tradeoff, bestie πmux-gen.NN.debounce-usunsigned in β sets the debounce time in microseconds, e.g.100000= a tenth of a second. the selection inputs have to be stable for that long before the output actually changes. it helps you ignore 'noisy' switches β very demure, very mindful β¨mux-gen.NN.sel-bit-MMbit in (M=0..N)mux-gen.NN.sel-intunsigned in β together, these two decide whichinNvalue gets copied tooutput. the bit pins are interpreted as binary bits, and the result is just added on to the integer pin input. the expectation is that you'd normally use one or the other. however β and this is the fun part β you can use a higher-order bit to "shift" the values set by the integer pin. π thesel-bitpins are only created when the size of themux_gencomponent is an integer power of two. also, this component (unlikemux16) does not offer the option of decoding Gray-code β but no worries, you can get the same effect by arranging the order of the input values to suit. problem solved, periodt πmux-gen.NN.out-[bit/float/s32/u32]variable-type out β follows the value of one of theinNvalues according to the selection bits and/or the selection number. values get converted/truncated according to standard C rules. which means, for example, that a float input greater than2147483647will give anS32output of-2147483648. yes really. the math said what it said πmux-gen.NN.in-[bit/float/s32/u32]-MMvariable-type in β the possible output values that get selected by the selection pins. the whole menu, basically π
π PARAMETERS π
mux-gen.N.elapsedfloat r β current value of the internal debounce timer. for debugging. peak nosy bestie energy πmux-gen.N.selecteds32 r β current value of the internal selection variable after conversion, for debugging. possibly useful for setting up gray-code switches. lowkey a little treat π«Ά
π DESCRIPTION π
this component is a more general version of the other multiplexing components. it lets you create arbitrary-size multiplexers (up to 1024 entries) and it also supports differing data types on the input and output pins. main character energy, honestly π
the configuration string is a comma-separated list of code-letters and numbers, such as "bb4,fu12".
that would create a 4-element bit-to-bit mux and a 12-element float-to-unsigned mux.
the code letters are:
b= bitf= floats= signed integeru= unsigned integer
the first letter code is the input type, the second is the output type. the codes are not case-sensitive. the order of the letters is significant, but the position in the string is not.
π¨ do not insert any spaces in the config string. fr fr.
any non-zero float value will be converted to a "true" output in bit form. and be wary, bestie: float datatypes can be very, very, close to zero and not actually be equal to zero. it's giving deceptive π
each mux has its own HAL function and must be added to a thread separately. if neither the input nor the output is of type float, then the function is base-thread (non floating-point) safe. any mux_generic with a floating point input or output can only be added to a floating-point thread. no exceptions, that's the rule π
πΈ SEE ALSO πΈ
mux2(9), mux4(9), mux8(9), mux16(9).
the whole mux fam, go say hi π
β AUTHOR β
Andy Pugh
π§ LICENSE π§
GPL
okay that's the whole page, you ate that π«Ά this was the LinuxCNC Documentation version, dated 2013-05-27, and yes it lives under the MUX_GENERIC(9) name in the HAL Component manual. bye bestie, go build a mux πβ¨π
π¦ where this page comes from
- debian trixie: linuxcnc-uspace 1:2.9.4-2+deb13u1 Β· GFDL-1.1-or-later
- ubuntu questing: linuxcnc-uspace 1:2.9.4-2ubuntu2
- ubuntu resolute: linuxcnc-uspace 1:2.9.4-2ubuntu4 Β· GFDL-1.1-or-later
- ubuntu stonking: linuxcnc-uspace 1:2.9.4-2ubuntu4 Β· GFDL-1.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms