SYNOPSIS

loadrt demux_generic config="<input_type><output_type><size>[,<input_type><output_type><size>],…"

Types: b = bit, f = float, s = signed integer, u = unsigned integer

Example: loadrt demux_generic config="bb8,fu12"

FUNCTIONS

demux-gen.NN Depending on the data types can run in either a floating point or non-floating point thread.

PINS

            demux-gen.NN.sel-bit-00 ───────────────────┐
                                ... ─────────────────┐ │
            demux-gen.NN.sel-bit-BB ───────────────┐ │ │
               demux-gen.NN.sel-int ─────────────┐ │ │ │
                                         ┌───────┴─┴─┴─┴───────┐
                                         │          / o─────   ├───── demux-gen.NN.out-[bit/float/s32/u32]-00
demux-gen.NN.in-[bit/float/s32/u32] ─────┤   ─────o   o─────   ├───── ...
                                         │            o─────   ├───── demux-gen.NN.out-[bit/float/s32/u32]-MM
     demux-gen.NN.suppress-no-input ─────┤                     │
           demux-gen.NN.debounce-us ─────┤                     │
                                         └─────────────────────┘
demux-gen.N.suppress-no-input bit in

This suppresses changing the output if all select lines are false. This stops unwanted jumps in output between transitions of input but makes in00 unavailable.

demux-gen.N.debounce-us unsigned in

sets debounce time in microseconds, e.g. 100000 = a tenth of a second. The selection inputs must be stable this long before the output changes. This helps to ignore noisy switches.

demux-gen.N.sel-bit-BB bit in (BB=0..bit width of size)
demux-gen.N.sel-int unsigned in

The sel-bit pins are only created when the size of the demux_gen component is an integer power of two. Together, these determine to which out-MM the in value is forwarded. The bit pins are interpreted as binary bits, and the result is simply added on to the integer pin input. It is expected that either one or the other would normally be used. However, the possibility exists to use a higher-order bit to "shift" the values set by the integer pin.

demux-gen.N.in-[bit/float/s32/u32] variable-type in

The input value which is routed to an output depending on the selection pins.

demux-gen.N.out-[bit/float/s32/u32]-MM variable-type out (M=0..size-1)

According to the selection bits and/or the selection number, the selected output follows the in value. The other outputs retain the values they had before resp. zero if they have not been selected yet. Values will be converted/truncated according to standard C rules. This means, for example that a float input greater than 2147483647 will give an S32 output of -2147483648.

PARAMETERS

demux-gen.N.elapsed float r

Current value of the internal debounce timer for debugging.

demux-gen.N.selected s32 r

Current value of the internal selection variable after conversion for debugging. Possibly useful for setting up gray-code switches.

DESCRIPTION

This component is a general demultiplexer component. It allows the creation of arbitrary-size demultiplexers (up to 1024 entries) and also supports differing data types on the input and output pins. The configuration string is a comma-separated list of code-letters and numbers, such as "bb4,fu12". This would create a 4-element bit-to-bit demux and a 12-element float-to-unsigned demux. The code letters are:

b = bit, f = float, s = signed integer and 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. Any non-zero float value will be converted to a "true" output in bit form. Be wary that float datatypes can be very, very, close to zero and not actually be equal to zero.

Each demux has its own HAL function and must be added to a thread separately. If neither input nor output is of type float then the function is base-thread (non floating-point) safe. Any demux_generic with a floating point input or output can only be added to a floating-point thread.

SEE ALSO

mux_generic(9)

AUTHOR

Hans Unzner

LICENSE

GPL