mirror of
https://github.com/apache/nuttx.git
synced 2026-08-18 01:49:24 +08:00
drivers/lcd/Kconfig offers CONFIG_LCD_APA102_XRES, CONFIG_LCD_APA102_YRES and CONFIG_LCD_APA102_FREQUENCY under "if LCD_APA102", but apa102_lcd.c tests for CONFIG_APA102_XRES, CONFIG_APA102_YRES and CONFIG_APA102_FREQUENCY, which no Kconfig file defines. The #ifndef fallbacks therefore always win and the matrix geometry is hard-wired to 16x16 no matter what is configured. The frequency setting is doubly dead: even the fallback is unused, because apa102_configspi() calls SPI_SETFREQUENCY() with APA102_SPI_MAXFREQUENCY from include/nuttx/leds/apa102.h, which is 100 kHz (its "Default 4MHz" comment notwithstanding), so the chain is always clocked at 100 kHz. Use the names the Kconfig actually defines and drive the bus at the configured frequency. The fallback definitions are kept for an out-of-Kconfig build and given the Kconfig defaults; 16x16 keeps the previous geometry for anyone who never set the options. Verified on stm32f4discovery:nsh with CONFIG_LCD_APA102_XRES=8, CONFIG_LCD_APA102_YRES=4 and CONFIG_LCD_APA102_FREQUENCY=4000000: the shadow framebuffer in g_apa102dev shrinks to 8x4 LEDs and the SPI frequency argument is 0x003d0900, where before the settings had no effect at all. Signed-off-by: Ricard Rosson <ricard@groundbits.com> Assisted-by: Claude Opus 5 (Claude Code)