I like to write a driver for the parallax ws2812b led stripe. The D_in signal line is used to send the led colour information bit wise. There are 3 possible High-Low pattern:
// single line protocol // GRB @ 8Bit // MSB first LSB last send // led_x = <8Bit green><8Bit red><8Bit blue> // 1 bit: // - [0] T0H, T0L // - [1] T1H, T1L // timings: // T0H = 1 for 0.4us // T0L = 0 for 0.8us // T1H = 1 for 0.45us // T1L = 0 for 0.85us // // reset: // H -> L for 50us
I like to realize that through the PF4 pin. So I can use the PWM but I may use the T2CCP0 pin function.
The led strip has 30 rgb leds. I have enough memory. So I can easily allocate 24 * 30 = 720Bytes. Each byte represents the pwm pattern.
Ideally I like to use the DMA to transfer the data in the background.
How I have to setup ?Timer2? to generate different pwms? What is your advice on that? Maybe only pin toggling is better?