PWM now works.

Generally software PWM for all pins now works with using just a single
thread. Also PWM is done with "Programs" instead of just pulse length
and frequency settings. This allows very flexible behaviour of
brightness control.

C++ code still needs some tweaks, but I leave it for now.