drivers/lcd: rename apa102.c/max7219.c to unique object names

drivers/ is built by a single flat Makefile: every per-directory Make.defs
appends its sources to one CSRCS list and its directory to one VPATH, and the
objects all land in drivers/ named after the source basename.  Two sources
with the same basename in different subdirectories therefore map to the same
object, and make resolves the prerequisite through VPATH, which is searched
in the order drivers/Makefile includes the Make.defs files.  lcd is included
before leds, so drivers/lcd always wins.

Both apa102 and max7219 exist twice, once as an LCD front-end and once as an
LED driver:

  drivers/lcd/apa102.c   CONFIG_LCD_APA102    drivers/leds/apa102.c   CONFIG_LEDS_APA102
  drivers/lcd/max7219.c  CONFIG_LCD_MAX7219   drivers/leds/max7219.c  CONFIG_LEDS_MAX7219

drivers/lcd/Make.defs puts lcd on the VPATH for the whole directory whenever
CONFIG_LCD=y, so selecting only the LED driver still builds apa102.o from
drivers/lcd/apa102.c and the selected LED driver is never compiled at all.
Because the LCD front-ends take their constants from
include/nuttx/lcd/apa102.h and include/nuttx/lcd/max7219.h, which are behind
CONFIG_LCD_APA102 / CONFIG_LCD_MAX7219, the substituted source does not even
compile.  With CONFIG_LCD=y + CONFIG_LEDS_APA102=y and CONFIG_LCD_APA102
unset:

  lcd/apa102.c:701:20: error: 'APA102_BLACK' undeclared (first use in this
  function); did you mean 'APA102_BPP'?

and correspondingly for CONFIG_LEDS_MAX7219 without CONFIG_LCD_MAX7219:

  lcd/max7219.c:773:20: error: 'MAX7219_BLACK' undeclared (first use in this
  function); did you mean 'MAX7219_BPP'?

So neither LED driver can be built together with CONFIG_LCD, and there is no
diagnostic pointing at the real cause.

Give the LCD front-ends distinct basenames.  The LCD side is the adapted use
of these parts (an LED matrix driven as a display), and drivers/lcd already
names such variants for their role, e.g. ht16k33_14seg.c, so the suffix goes
there and the LED drivers keep the plain part names.  The CMake build derives
object paths from the source directory and was never affected; its source
lists are updated to match.

Signed-off-by: Ricard Rosson <ricard@groundbits.com>
Assisted-by: Claude Opus 5 (Claude Code)
This commit is contained in:
Ricard Rosson
2026-08-13 09:54:26 -03:00
committed by Alan C. Assis
parent 850ac5ca63
commit 0735bc16b9
5 changed files with 8 additions and 8 deletions
+2 -2
View File
@@ -13025,7 +13025,7 @@ drivers/ipcc/ipcc_register.c michal.lyszczek@bofc.pl xiaoxiang@xiaomi.com anjiah
drivers/ipcc/ipcc_unlink.c michal.lyszczek@bofc.pl devel@sumpfralle.de anjiahao@xiaomi.com alin.jerpelea@sony.com anchao@xiaomi.com
drivers/ipcc/ipcc_write.c michal.lyszczek@bofc.pl anjiahao@xiaomi.com anchao@xiaomi.com dongjiuzhu1@xiaomi.com xiaoxiang@xiaomi.com
drivers/lcd/Kconfig 101105604+simbit18@users.noreply.github.com acassis@gmail.com paul-a.patience@polymtl.ca
drivers/lcd/apa102.c acassis@gmail.com tiago.medicci@espressif.com petro.karashchenko@gmail.com gustavo.nihei@espressif.com raiden00@railab.me
drivers/lcd/apa102_lcd.c acassis@gmail.com tiago.medicci@espressif.com petro.karashchenko@gmail.com gustavo.nihei@espressif.com raiden00@railab.me
drivers/lcd/ft80x.c xiaoxiang@xiaomi.com anjiahao@xiaomi.com anchao@xiaomi.com yamamoto@midokura.com
drivers/lcd/ft80x.h alin.jerpelea@sony.com xiaoxiang@xiaomi.com anjiahao@xiaomi.com petro.karashchenko@gmail.com
drivers/lcd/ft80x_spi.c alin.jerpelea@sony.com xiaoxiang@xiaomi.com yamamoto@midokura.com
@@ -13041,7 +13041,7 @@ drivers/lcd/lcd_dev.c matias@protobits.dev jianglianfang@xiaomi.com rongyichang@
drivers/lcd/lcd_framebuffer.c xiaoxiang@xiaomi.com huangqi3@xiaomi.com jianglianfang@xiaomi.com akaliszan@altimetrik.com
drivers/lcd/lcddrv_spiif.c dave@marples.net alin.jerpelea@sony.com petro.karashchenko@gmail.com raiden00@railab.me
drivers/lcd/lpm013m091a.c alin.jerpelea@sony.com michael.jung@secore.ly xiaoxiang@xiaomi.com petro.karashchenko@gmail.com
drivers/lcd/max7219.c acassis@gmail.com alin.jerpelea@sony.com liaoao@xiaomi.com matias@protobits.dev michael.jung@secore.ly
drivers/lcd/max7219_lcd.c acassis@gmail.com alin.jerpelea@sony.com liaoao@xiaomi.com matias@protobits.dev michael.jung@secore.ly
drivers/lcd/memlcd.c jernej.turnsek@gmail.com juha.niskanen@haltian.com alin.jerpelea@sony.com liaoao@xiaomi.com
drivers/lcd/mio283qt2.c alin.jerpelea@sony.com yamamoto@midokura.com michael.jung@secore.ly
drivers/lcd/mio283qt9a.c alin.jerpelea@sony.com yamamoto@midokura.com michael.jung@secore.ly raiden00@railab.me
+2 -2
View File
@@ -50,7 +50,7 @@ if(CONFIG_LCD)
endif()
if(CONFIG_LCD_APA102)
list(APPEND SRCS apa102.c)
list(APPEND SRCS apa102_lcd.c)
endif()
if(CONFIG_LCD_P14201)
@@ -94,7 +94,7 @@ if(CONFIG_LCD)
endif()
if(CONFIG_LCD_MAX7219)
list(APPEND SRCS max7219.c)
list(APPEND SRCS max7219_lcd.c)
endif()
if(CONFIG_LCD_MIO283QT9A)
+2 -2
View File
@@ -48,7 +48,7 @@ ifeq ($(CONFIG_LCD_LPM013M091A),y)
endif
ifeq ($(CONFIG_LCD_APA102),y)
CSRCS += apa102.c
CSRCS += apa102_lcd.c
endif
ifeq ($(CONFIG_LCD_P14201),y)
@@ -92,7 +92,7 @@ ifeq ($(CONFIG_LCD_MIO283QT2),y)
endif
ifeq ($(CONFIG_LCD_MAX7219),y)
CSRCS += max7219.c
CSRCS += max7219_lcd.c
endif
ifeq ($(CONFIG_LCD_MIO283QT9A),y)
@@ -1,5 +1,5 @@
/****************************************************************************
* drivers/lcd/apa102.c
* drivers/lcd/apa102_lcd.c
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -1,5 +1,5 @@
/****************************************************************************
* drivers/lcd/max7219.c
* drivers/lcd/max7219_lcd.c
*
* SPDX-License-Identifier: Apache-2.0
*