Skip to content

Comments

drivers/leds: Add support for KTD2052#16217

Merged
acassis merged 1 commit intoapache:masterfrom
stbenn:ktd2052
Jul 7, 2025
Merged

drivers/leds: Add support for KTD2052#16217
acassis merged 1 commit intoapache:masterfrom
stbenn:ktd2052

Conversation

@stbenn
Copy link
Contributor

@stbenn stbenn commented Apr 15, 2025

This commit adds support for the KTD2052 LED driver chip.

Summary

Driver implementation necessary to interface with KTD2052 LED driver chips.

Originally authored by @ArrestedLightning : https://github.com/ArrestedLightning/nuttx/tree/ktd2052

Impact

Adds Kconfig option to LED driver configuration. Does not change compatibility of existing drivers.

Testing

This driver was tested on a custom KTD2052 driver board.

@github-actions github-actions bot added Area: Drivers Drivers issues Size: L The size of the change in this PR is large labels Apr 15, 2025
@nuttxpr
Copy link

nuttxpr commented Apr 15, 2025

[Experimental Bot, please feedback here]

No, this PR description does not fully meet the NuttX requirements. Here's why and how to fix it:

  • Summary: While it states what was changed, it lacks crucial details:

    • Why? What problem does this solve? Why is this driver needed? (e.g., "Enables control of LEDs connected to a KTD2052 driver, allowing for..." or "Adds support for a commonly used LED driver, expanding hardware compatibility.")
    • How? "Driver implementation" is too vague. Briefly explain the mechanism. (e.g., "Uses I2C to communicate with the KTD2052, setting brightness levels through registers...")
    • Issues: Are there any related NuttX or NuttX Apps issues this addresses? Even if not, explicitly stating "N/A" is helpful.
  • Impact: While some impacts are addressed, others are missing or incomplete:

    • New Feature: Explicitly say "YES".
    • User Impact: Even if the answer is NO, briefly explain why. (e.g., "NO, this adds a new driver and does not affect existing LED functionality.")
    • Build Impact: YES - You added a Kconfig option. Describe how the build process is affected. (e.g., "YES, a new Kconfig option CONFIG_LED_KTD2052 enables the driver.")
    • Hardware Impact: Be specific about which architectures and boards are supported. (e.g., "YES, supports the KTD2052 on [architecture] platforms, tested on a custom board.")
    • Documentation: If no documentation was added, state that and why. (e.g., "NO, documentation will be added in a follow-up commit.") or "YES, a README.md file describing the driver usage has been added."
    • Security, Compatibility: Explicitly state "NO" (if applicable) with a brief explanation. (e.g., "NO, this driver does not introduce any new security concerns." / "NO, this is a new driver and maintains backward compatibility.")
  • Testing: Severely lacking detail.

    • Build Host: Provide specifics. (e.g., "Linux Ubuntu 22.04, x86_64, GCC 11.2")
    • Target: Provide specific architecture, board, and configuration. (e.g., "ARM Cortex-M4, Custom KTD2052 board, stm32f4discovery:nsh config")
    • Logs: The "before" logs might not be relevant for a new driver, but "after" logs demonstrating the driver's functionality are essential. Include examples showing successful LED control. If the logs are extensive, consider attaching a file instead of pasting them directly.

Example of Improved PR Description:

This commit adds support for the KTD2052 LED driver chip, expanding hardware compatibility for LED control within NuttX.

## Summary

This change adds a driver for the KTD2052 LED driver chip, allowing users to control LEDs connected to this chip. The driver communicates with the KTD2052 via I2C, setting brightness levels through specific registers. This addresses the need to support this commonly used LED driver chip.

Related NuttX Issue: N/A
Related NuttX Apps Issue/PR: N/A

## Impact

* New feature added? YES
* Impact on user: NO, this adds a new driver and does not affect existing LED functionality. Users wishing to use this new driver will need to configure their .config file appropriately.
* Impact on build: YES, a new Kconfig option `CONFIG_LED_KTD2052` enables the driver.
* Impact on hardware: YES, supports the KTD2052 on ARM platforms, tested on a custom KTD2052 board.
* Impact on documentation: NO, documentation will be added in a follow-up commit.
* Impact on security: NO, this driver does not introduce any new security concerns.
* Impact on compatibility: NO, this is a new driver and maintains backward compatibility.

## Testing

I confirm that changes are verified on a local setup and work as intended:

* Build Host(s): Linux Ubuntu 22.04, x86_64, GCC 11.2
* Target(s): ARM Cortex-M4, Custom KTD2052 board, `stm32f4discovery:nsh` config (adapted for the custom board)

Testing logs after change:

nsh> ktd2052_test # Example test application
Initializing KTD2052... Success!
Setting LED 1 to 50% brightness... Success!
Setting LED 2 to 100% brightness... Success!
...

By providing more detail and addressing all the required points, your PR will be much easier to review and merge.

acassis
acassis previously approved these changes Apr 15, 2025
@acassis
Copy link
Contributor

acassis commented Apr 15, 2025

@stbenn please include a Documentation to https://nuttx.apache.org/docs/latest/components/drivers/character/leds/index.html and an app testing application, this way users could use it without facing issues

@stbenn
Copy link
Contributor Author

stbenn commented Apr 15, 2025

@acassis I can add those, but it may be a little bit until I get around to it. If you would prefer to wait on this PR until those are implemented, that is understandable.

@acassis
Copy link
Contributor

acassis commented Apr 15, 2025

@stbenn we can merge it, but I think it is better wait for your commit with Documentation and apps example, it avoids we losing track of it. I will move this PR to draft, ok?

@stbenn
Copy link
Contributor Author

stbenn commented Apr 15, 2025

@acassis, sounds good to me 👍

@acassis acassis marked this pull request as draft April 15, 2025 22:49
@github-actions github-actions bot added Area: Documentation Improvements or additions to documentation Size: XL The size of the change in this PR is very large. Consider breaking down the PR into smaller pieces. labels Jul 3, 2025
@acassis acassis marked this pull request as ready for review July 3, 2025 15:08
@stbenn
Copy link
Contributor Author

stbenn commented Jul 3, 2025

@acassis documentation has been added for this driver

@acassis
Copy link
Contributor

acassis commented Jul 3, 2025

@stbenn please fix these issues:

Error: /home/runner/work/nuttx/nuttx/nuttx/drivers/leds/ktd2052.c:85:79: error: Long line found
Error: /home/runner/work/nuttx/nuttx/nuttx/drivers/leds/ktd2052.c:89:81: error: Long line found
Error: /home/runner/work/nuttx/nuttx/nuttx/drivers/leds/ktd2052.c:135:79: error: Long line found
Error: /home/runner/work/nuttx/nuttx/nuttx/drivers/leds/ktd2052.c:208:80: error: Long line found
Error: /home/runner/work/nuttx/nuttx/nuttx/drivers/leds/ktd2052.c:240:81: error: Long line found
Error: /home/runner/work/nuttx/nuttx/nuttx/drivers/leds/ktd2052.c:241:80: error: Long line found
Error: /home/runner/work/nuttx/nuttx/nuttx/drivers/leds/ktd2052.c:249:78: error: Long line found
Error: /home/runner/work/nuttx/nuttx/nuttx/drivers/leds/ktd2052.c:384:79: error: Long line found
Error: /home/runner/work/nuttx/nuttx/nuttx/drivers/leds/ktd2052.c:458:81: error: Long line found
Error: /home/runner/work/nuttx/nuttx/nuttx/drivers/leds/ktd2052.c:524:79: error: Long line found
Error: /home/runner/work/nuttx/nuttx/nuttx/drivers/leds/ktd2052.c:553:78: error: Long line found
Error: /home/runner/work/nuttx/nuttx/nuttx/drivers/leds/ktd2052.c:572:80: error: Long line found
Error: /home/runner/work/nuttx/nuttx/nuttx/drivers/leds/ktd2052.c:639:78: error: Long line found
Error: /home/runner/work/nuttx/nuttx/nuttx/drivers/leds/ktd2052.c:640:78: error: Long line found
Error: /home/runner/work/nuttx/nuttx/nuttx/drivers/leds/ktd2052.c:648:80: error: Long line found

This commit adds support for the KTD2052 LED driver chip.

Signed-off-by: Tyler Bennett <tbennett@2g-eng.com>
@stbenn
Copy link
Contributor Author

stbenn commented Jul 3, 2025

@acassis done. Sorry about that, selected the wrong file from a merge conflict. Thought I selected the one that had those fixes.

@acassis
Copy link
Contributor

acassis commented Jul 3, 2025

@acassis done. Sorry about that, selected the wrong file from a merge conflict. Thought I selected the one that had those fixes.

Don't worry, it happens with me all the time!

@acassis acassis merged commit d5eda10 into apache:master Jul 7, 2025
40 checks passed
@stbenn stbenn deleted the ktd2052 branch July 8, 2025 17:16
simbit18 added a commit to simbit18/nuttx that referenced this pull request Aug 20, 2025
Add:

KTD2052 led driver

apache#16217

Signed-off-by: simbit18 <simbit18@gmail.com>
simbit18 added a commit to simbit18/nuttx that referenced this pull request Aug 20, 2025
Add:

KTD2052 led driver

apache#16217

Signed-off-by: simbit18 <simbit18@gmail.com>
lupyuen pushed a commit that referenced this pull request Aug 21, 2025
Add:

KTD2052 led driver

#16217

Signed-off-by: simbit18 <simbit18@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: Documentation Improvements or additions to documentation Area: Drivers Drivers issues Size: L The size of the change in this PR is large Size: XL The size of the change in this PR is very large. Consider breaking down the PR into smaller pieces.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants