raspberrypi / pico-examples

BSD 3-Clause "New" or "Revised" License
2.61k stars 778 forks source link

WS2812: Support more than 7 pins in parallel mode #455

Open adamgreen opened 6 months ago

adamgreen commented 6 months ago

ws2812_parallel_program_init() contained an unneeded call to sm_config_set_set_pins(). When this is called with the pin_count parameter set to a value larger than 7, the set pin count value in the pinctrl register overflows into the side-set pin count. This can result in hard to diagnose issues where low numbered GPIO pins don't work as expected.

There is an existing valid_params_if() check in sm_config_set_set_pins() which would catch this error but it is ignored in Release builds.

This PR just removes this sm_config_set_set_pins() call as SET commands aren't even used by the associated PIO code.

Discovered when trying to explain symptoms noted in this forum thread