Constructs a channel using the given num using the given pin. Note: only the ESP32 and the ESP32S2 support configuring the channel direction at a later time. For all other platforms, this constructor will give a TX channel, unless the channel-id is provided.
The memory-block-count determines how many memory blocks are assigned to this channel. See the Advanced section for more information.
The channel-id should generally be left as default. If provided, it selects the channel with that physical id. On a standard ESP32, there are 8 channels which can be selected by providing a channel id in the range [0,7]. See the advanced section for when this can be useful.
This constructor does not configure the channel for input or output yet. Call configure (either --input or --output) to do so. Deprecated. Use the --input or --output constructor instead.
Advanced
The memory-block-count determines how many memory blocks are assigned to this channel. Memory blocks are of size 256 bytes or 128 signals. They are in continuous memory and there are only a limited number of them.
Generally, output channels don't need extra blocks as interrupts will copy data into the buffer when necessary. However, input channels can only receive as many signals (in one sequence) as there is space in the memory blocks.
If a channel requests more than one memory block, then the following internal channel id is marked as used as well.
Users might run into fragmentation issues as well: there might still be more than 1 free memory block, but if they are not next to each other, then a channel can't use them at the same time. The given channel-id parameter may be used to force the constructor to use a certain channel. Internally, channels always use their own memory block, plus the required additional memory blocks. The additional memory blocks come from the channels with the next-higher ids.
Example
Say a program starts by allocating two channels, A and then B.
It then releases channel A. If the program now wants to allocate a channel with 7 memory blocks, it would fail, as there are only 6 continuous memory blocks available.
The developer could force channel A to use channel id 1, and channel B to use id 0. This way releasing channel A would free the second memory block (at location 1) and thus allow the creation of a channel with 7 memory blocks.