ws2812.pio (455B)
1.program ws2812 2.side_set 1 3 4.define public T1 2 5.define public T2 5 6.define public T3 3 7 8.wrap_target 9bitloop: 10 out x, 1 side 0 [T3 - 1] ; Side-set still takes place when instruction stalls 11 jmp !x do_zero side 1 [T1 - 1] ; Branch on the bit we shifted out. Positive pulse 12do_one: 13 jmp bitloop side 1 [T2 - 1] ; Continue driving high, for a long pulse 14do_zero: 15 nop side 0 [T2 - 1] ; Or drive low, for a short pulse 16.wrap