#define PIXEL_NUM? ? ? ?256
#define END_LED_NUM? ? ?(PIXEL_NUM-1)
#define PIXEL_COLUMN 16
#define PIXEL_ROW ? ? 16
#define BRINGNESS? ? ? ?64
#define NUM? ? ? ? ? ? ?(24*PIXEL_NUM + 300)? ? ? ? // Reset 280us / 1.25us = 224
#define WS1? ? ? ? ? ? ?37
#define WS0? ? ? ? ? ? ?18
__attribute__((aligned(4))) uint32_t WS281xBuf[NUM];
void WS2812B_Init(void)
{
? ? GPIOB_ModeCfg(GPIO_Pin_11, GPIO_ModeOut_PP_5mA);
? ? GPIOPinRemap(ENABLE, RB_PIN_TMR2);
? ? PRINT("TMR2 DMA PWM\n");
? ? TMR2_PWMCycleCfg(75); // 周期 1.25us
? ? ARGB_FillRGB(0,0,0);
? //? WS281X_ALL_LED(0); //緩沖區(qū)清零
? ? TMR2_DMACfg(ENABLE,(uint16_t)(uint32_t)&WS281xBuf[0],(uint16_t)(uint32_t)&WS281xBuf[NUM], Mode_LOOP);
? ? TMR2_PWMInit(High_Level, PWM_Times_1);
? ? TMR2_ClearITFlag(TMR1_2_IT_DMA_END);
//? ? PFIC_EnableIRQ(TMR2_IRQn);
//
//? ? TMR2_ITCfg(ENABLE, TMR1_2_IT_DMA_END);
}
網(wǎng)上找的例程驅(qū)動256 顆WS2812 燈珠,顯示正常。所需的字節(jié)是(24*PIXEL_NUM + 300)*4 =25776 ,內(nèi)存浪費(fèi)嚴(yán)重。請教下如何精簡?修改uint32_t WS281xBuf[NUM] 數(shù)組為uint16_t 類型,燈不亮了