Commit graph

14 commits

Author SHA1 Message Date
Benjamin Cabé
7b001ed059 drivers: led: adopt SHELL_HELP
Adopt SHELL_HELP macro for LED shell

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-18 07:38:17 +02:00
Benjamin Cabé
f72942067a drivers: led: fix LED_BRIGTHNESS_MAX typo
Renames LED_BRIGTHNESS_MAX to LED_BRIGHTNESS_MAX in led.h and all
in-tree users of the macro.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-09 14:50:33 -07:00
Fabio Baltieri
551c1363dd led: add and use a LED_BRIGTHNESS_MAX definition
The led_set_brightness API says that brightness is defined as
percentage, add a macro from the max and use it everywhere.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2025-05-14 16:27:18 +02:00
Fabio Baltieri
0bc123da11 drivers: drop few redundant device_is_ready
Drop few redundant device_is_ready for functions that are only used as
argument to shell_device_filter, as shell_device_filter checks for that
alrady.

Suggested-by: Yishai Jaffe <yishai1999@gmail.com>
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2025-01-22 05:40:11 +01:00
Yishai Jaffe
1b4cef325b shell: use shell_device_get_binding
Use shell_device_get_binding() instead of device_get_binding() so that
we get the device based on its name and in addition by its label.

Signed-off-by: Yishai Jaffe <yishai1999@gmail.com>
2024-12-18 15:32:10 +01:00
Yishai Jaffe
589be4e49c led: shell: filter device lookup using DEVICE_API macros
Filter for led devices when looking them up in dynamic shell commands.

Signed-off-by: Yishai Jaffe <yishai1999@gmail.com>
2024-12-02 22:07:36 +00:00
Nick Ward
2576458dce drivers: led: shell: print color as string
Human readable.

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2024-06-11 19:43:15 -04:00
Hans Binderup
ed06b0ba74 drivers: led: shell: Add devices as sub commands
Currently you have to manually type out the device name for each command.

This commit adds support for <device> entry tab completion and device
lookup if help is enabled.

Signed-off-by: Hans Binderup <habi@bang-olufsen.dk>
2024-04-11 11:36:09 -05:00
Chen Xingyu
1939a46629 drivers: led: shell: Correct command help of set_brightness
The help text indicates the range of value is 0-255, while the actual
maximum value acceptable is 100.

This commit updates the text to accurately reflect the acceptable
value range for the set_brightness API.

Signed-off-by: Chen Xingyu <hi@xingrz.me>
2023-04-24 16:29:30 +02:00
Gerard Marull-Paretas
667eeb11fb shell: fix MISRA 5.7 violations on struct shell
MISRA Rule 5.7 requires uniqueness of tag identifiers. Shell is
frequently problematic because many code uses `const struct shell
*shell`. This causes CI noise every time one of these shell files is
edited, so let's update all of them with `const struct shell *sh`
instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-14 12:21:08 +02:00
Gerard Marull-Paretas
fb60aab245 drivers: migrate includes to <zephyr/...>
In order to bring consistency in-tree, migrate all drivers to the new
prefix <zephyr/...>. Note that the conversion has been scripted, refer
to #45388 for more details.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-06 19:58:21 +02:00
Daniel Schultz
dbf2d02747 drivers: led: Fix warnings in shell_print
Change format in various shell_error calls from int to long unsigned
int.

Warning:

    warning: format '%d' expects argument of type 'int', but argument
    6 has type 'long unsigned int'

Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
2021-10-28 10:38:01 -04:00
Tomasz Bursztyka
e18fcbba5a device: Const-ify all device driver instance pointers
Now that device_api attribute is unmodified at runtime, as well as all
the other attributes, it is possible to switch all device driver
instance to be constant.

A coccinelle rule is used for this:

@r_const_dev_1
  disable optional_qualifier
@
@@
-struct device *
+const struct device *

@r_const_dev_2
 disable optional_qualifier
@
@@
-struct device * const
+const struct device *

Fixes #27399

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-09-02 13:48:13 +02:00
Simon Guinot
21f4fef78b drivers: led: add shell support
This patch introduces the "led" shell command. This allows to run the
LED API functions (and to test the LED drivers) from the Zephyr shell.
The following subcommands are supported:

- on
- off
- get_info
- set_brightness
- set_color
- set_channel
- write_channels

Signed-off-by: Simon Guinot <simon.guinot@seagate.com>
2020-08-28 15:04:35 +02:00