#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); //缓冲区清零
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);
}
网上找的例程驱动256 颗WS2812 灯珠,显示正常。所需的字节是(24*PIXEL_NUM + 300)*4 =25776 ,内存浪费严重。请教下如何精简?修改uint32_t WS281xBuf[NUM] 数组为uint16_t 类型,灯不亮了