Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

samples: led: consolidate LED samples under same directory #77840

Merged
merged 1 commit into from
Sep 5, 2024

Conversation

kartben
Copy link
Collaborator

@kartben kartben commented Aug 31, 2024

With over a dozen LED samples, grouping them in a common samples/drivers/led/ folder helps keep things tidy and lays the groundwork for further improvements in the way samples are showing up in the docs.

@glenn-andrews
Copy link
Collaborator

I'd like to see a samples/drivers/led/led_apa102c_bitbang/README.rst file created, but otherwise LGTM.

@kartben
Copy link
Collaborator Author

kartben commented Sep 1, 2024

I'd like to see a samples/drivers/led/led_apa102c_bitbang/README.rst file created, but otherwise LGTM.

Ya, good catch, but different topic :)
#27805

glenn-andrews
glenn-andrews previously approved these changes Sep 1, 2024
Copy link
Collaborator

@glenn-andrews glenn-andrews left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

pdgendt
pdgendt previously approved these changes Sep 2, 2024
Copy link
Collaborator

@simonguinot simonguinot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this patch @kartben !

Please see below for some comments and questions.

@@ -68,7 +68,7 @@ modified by changing the :kconfig:option:`CONFIG_SAMPLE_LED_UPDATE_DELAY`.
Then build and flash the application:

.. zephyr-app-commands::
:zephyr-app: samples/drivers/led_strip
:zephyr-app: samples/drivers/led/led_strip
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't you think we should put led_strip at the same level than led ?

samples/drivers/led
samples/drivers/led_strip

After all led_strip is a distinct subsystem, with its own API. Also, this would mirror the drivers tree:

drivers/led
drivers/led_strip

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe, yes. My reasoning was based on how things are presented in: https://docs.zephyrproject.org/latest/hardware/peripherals/led.html , i.e. everything under LED.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am happy to do a follow-up PR but hopefully this is good enough for a first pass at cleaning things up.
I just rebased to address a conflict in redirects.py

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would vote for led_strip being at the same level as led not inside of it, they are different drivers

MAINTAINERS.yml Show resolved Hide resolved
Copy link
Collaborator

@simonguinot simonguinot Sep 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And eventually it is the opportunity to remove some of the led_ prefixes now that we have a leading led directory ?
For example:
samples/drivers/led/led_is31fl3194 -> samples/drivers/led/is31fl3194
It would be nice to have the same name for a sample and its drivers.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or should we keep the led_ prefix when it is used in the driver name ?

drivers/led/led_pwm -> samples/drivers/led/led_pwm
drivers/led/is31fl3194 -> samples/drivers/led/is31fl3194

There is maybe some value to allow a script to retrieve the sample name from the exact driver name ? Or am I overthinking this ? :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

define "driver_name" :) I would hope that the name of the C file implementing a particular driver is mostly irrelevant. The names of the source files are a bit all over the place, and I am not sure they go through as much scrutiny as the compatibles do.

If anything, the samples could maybe be named after the compatibles, but this is probably overthinking (at this point at least), yes :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes you are right.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that some drivers and samples support several compatibles. We have the lp50xx LED driver in that case. This doesn't help for a generic naming...

@kartben kartben dismissed stale reviews from pdgendt and glenn-andrews via 86619ac September 2, 2024 10:18
@zephyrbot zephyrbot added the Release Notes To be mentioned in the release notes label Sep 2, 2024
With over a dozen LED samples, grouping them in a common drivers/led/
folder helps keep things tidy and lays the groundwork for further
improvements in the way samples are showing up in the docs.

Signed-off-by: Benjamin Cabé <[email protected]>
@simonguinot simonguinot self-requested a review September 4, 2024 17:53
Copy link
Collaborator

@simonguinot simonguinot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks !

Copy link
Collaborator

@glenn-andrews glenn-andrews left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm but will testing be able to confirm all the redirected links are correct?

I'm a) new to this and b) stick on my phone without a computer for the next few days.

@carlescufi carlescufi merged commit 55d9d1c into zephyrproject-rtos:main Sep 5, 2024
17 checks passed
@kartben kartben deleted the move_led_samples branch September 10, 2024 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Documentation Infrastructure area: LED Label to identify LED subsystem area: Process area: Samples Samples area: Shields Shields (add-on boards) Release Notes To be mentioned in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants