Loodan:
After calculating ARR 100, we got arr 104 when calculating “neonpixel_one” and “neonpixel_zero” (for ws2812).why?
Because for the WS2812, T_{PWM} = 1.25\mu{}s , so
ARR = \frac{1.25 \times 10^{-6}}{\frac{1}{84 \times 10^6}} - 1 = 104
Loodan:
Where did the 24 in #define DMA_BUF_SIZE ((numpixel*24)+1) come from?(about 24 bit?)
Yes, 24 bits. Recall Step 3c in the Procedure:
Matt_Mielke:
c. In addition to the CCRx values, the number of NeoPixel LEDs being controlled and the DMA buffer size should be defined in the Private defines section as well. As shown in Figure 11, simply multiply the number of LEDs by the number of bits in the corresponding NeoPixel data structure (recall Figures 1 and 3). An extra buffer element must be allotted as well because the last CCRx value should be zero (the reset signal).
Loodan:
As far as I understand, the purpose of these codes is to send a signal, we need to create a function to light the led, right?
No. Assuming the LEDs are powered, the control signal itself dictates their illumination. Recall from the WS2812 description:
Matt_Mielke:
The transmitted bytes are organized according the the protocol shown in Figure 1. The first byte (G7-G0) represents the 8-bit PWM intensity of the green LED, where 0x00 is fully off and 0xFF is fully on . Similarly, the second byte (R7-R0) controls the intensity of the red LED and the third (B7-B0) does the same for the blue LED.
1 Like