There are times with a PIO state machine using sideset values that the jump to the _initialpc should also have the sideset value specified for it as well to ensure the state of any sideset pins. Currently, in _pio_sminit(), when it sets the jump to the _initialpc, it appears to set the sideset pin states to 0. In some situations, this can lead to a momentary glitch on the sideset pins as the PIO state machine starts.
In addition to _pio_sminit(), suggest an alternate _pio_sm_init_sideset()_ allowing the initial state of the sideset pins to be specified.
In that function, the final call to _pio_smexec() would be similar to the following:
pio_sm_exec(pio, sm, pio_encode_sideset(sideset_bit_count, sideset_value) | pio_encode_jmp(initial_pc));
An example call to the added function:
// Load the configuration, and jump to the start of the program, with initial sideset states
pio_sm_init_sideset(pio, sm, entry_point, 2, 0b10, &config);
There are times with a PIO state machine using sideset values that the jump to the _initialpc should also have the sideset value specified for it as well to ensure the state of any sideset pins. Currently, in _pio_sminit(), when it sets the jump to the _initialpc, it appears to set the sideset pin states to 0. In some situations, this can lead to a momentary glitch on the sideset pins as the PIO state machine starts.
In addition to _pio_sminit(), suggest an alternate _pio_sm_init_sideset()_ allowing the initial state of the sideset pins to be specified.
For example:
void pio_sm_init_sideset(PIO pio, uint sm, uint initial_pc, uint sideset_bit_count, uint sideset_value, const pio_sm_config * config)
In that function, the final call to _pio_smexec() would be similar to the following:
pio_sm_exec(pio, sm, pio_encode_sideset(sideset_bit_count, sideset_value) | pio_encode_jmp(initial_pc));
An example call to the added function: