Commit graph

7 commits

Author SHA1 Message Date
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