MUX_GENERIC(9)

πŸ“¦
version 2.9.4 Β· 2 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– 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-input bit 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 makes in00 unavailable. so, tradeoff, bestie 😭
  • mux-gen.NN.debounce-us unsigned 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-MM bit in (M=0..N)
  • mux-gen.NN.sel-int unsigned in β€” together, these two decide which inN value gets copied to output. 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. πŸ‘€ the sel-bit pins are only created when the size of the mux_gen component is an integer power of two. also, this component (unlike mux16) 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 the inN values 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 than 2147483647 will give an S32 output of -2147483648. yes really. the math said what it said πŸ’€
  • mux-gen.NN.in-[bit/float/s32/u32]-MM variable-type in β€” the possible output values that get selected by the selection pins. the whole menu, basically πŸ“

πŸŽ€ PARAMETERS πŸŽ€

  • mux-gen.N.elapsed float r β€” current value of the internal debounce timer. for debugging. peak nosy bestie energy πŸ”
  • mux-gen.N.selected s32 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 = bit
  • f = float
  • s = signed integer
  • u = 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 πŸ’–βœ¨πŸŽ€