-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Get started example update for addressable LED compatibility.
Added the RMT/addr LED blink to the example and more detailed README.md Moved component/led_strip to common_components Added missing README file to common_components/led_strip README file update Makefile and Kconfig fixed for led_strip component Fixing end-of-line on main/blink.c Component updated to handle multiple instances Added note on the RMT channel number (ESP32 and ESP32-S2) Removed components folder from rmt/led_strip example and README updated Changed the led_strip_denit function and added ESP32-C3 RMT info on channel configuration Updates on README, Kconfig default settings and configure_led() function added
- Loading branch information
1 parent
2c0962f
commit cccdb3e
Showing
15 changed files
with
241 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
idf_component_register(SRCS "led_strip_rmt_ws2812.c" | ||
INCLUDE_DIRS "include" | ||
PRIV_REQUIRES "driver" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# LED Strip Component | ||
|
||
This directory contains an implementation for addressable LEDs using the RMT peripheral. | ||
|
||
It's compatible with: | ||
|
||
* [WS2812](http://www.world-semi.com/Certifications/WS2812B.html) | ||
* SK68XX | ||
|
||
This component is used as part of the following ESP-IDF examples: | ||
- [Blink Example](../../get-started/blink). | ||
- [LED Strip Example](../../peripherals/rmt/led_strip). | ||
|
||
To learn more about how to use this component, please check API Documentation from header file [led_strip.h](./include/led_strip.h). | ||
|
||
Please note that this component is not considered to be a part of ESP-IDF stable API. It may change and it may be removed in the future releases. |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,63 @@ | ||
# Blink Example | ||
|
||
Starts a FreeRTOS task to blink an LED | ||
(See the README.md file in the upper level 'examples' directory for more information about examples.) | ||
|
||
See the README.md file in the upper level 'examples' directory for more information about examples. | ||
This example demonstrates how to blink a LED using GPIO or RMT for the addressable LED, i.e. [WS2812](http://www.world-semi.com/Certifications/WS2812B.html). | ||
|
||
See the RMT examples in the [RMT Peripheral](../../peripherals/rmt) for more information about how to use it. | ||
|
||
## How to Use Example | ||
|
||
Before project configuration and build, be sure to set the correct chip target using `idf.py set-target <chip_name>`. | ||
|
||
### Hardware Required | ||
|
||
* A development board with ESP32/ESP32-S2/ESP32-C3 SoC (e.g., ESP32-DevKitC, ESP-WROVER-KIT, etc.) | ||
* A USB cable for Power supply and programming | ||
|
||
Some development boards use an addressable LED instead of a regular one. These development boards include: | ||
|
||
| Board | LED type | Pin | | ||
| -------------------- | -------------------- | -------------------- | | ||
| ESP32-C3-DevKitC-1 | Addressable | GPIO8 | | ||
| ESP32-C3-DevKitM-1 | Addressable | GPIO8 | | ||
| ESP32-S2-DevKitM-1 | Addressable | GPIO18 | | ||
| ESP32-S2-Saola-1 | Addressable | GPIO18 | | ||
|
||
See [Development Boards](https://www.espressif.com/en/products/devkits) for more information about it. | ||
|
||
### Configure the Project | ||
|
||
Open the project configuration menu (`idf.py menuconfig`). | ||
|
||
In the `Example Configuration` menu: | ||
|
||
* Select the LED type in the `Blink LED type` option. | ||
* * Use `GPIO` for regular LED blink. | ||
* * Use `RMT` for addressable LED blink. | ||
* * * Use `RMT Channel` to select the RMT peripheral channel. | ||
* Set the GPIO number used for the signal in the `Blink GPIO number` option. | ||
* Set the blinking period in the `Blink period in ms` option. | ||
|
||
|
||
### Build and Flash | ||
|
||
Run `idf.py -p PORT flash monitor` to build, flash and monitor the project. | ||
|
||
(To exit the serial monitor, type ``Ctrl-]``.) | ||
|
||
See the [Getting Started Guide](https://docs.espressif.com/projects/esp-idf/en/latest/get-started/index.html) for full steps to configure and use ESP-IDF to build projects. | ||
|
||
## Example Output | ||
|
||
As you run the example, you will see the LED blinking, according to the previously defined period. For the addressable LED, you can also change the LED color by setting the `pStrip_a->set_pixel(pStrip_a, 0, 16, 16, 16);` (LED Strip, Pixel Number, Red, Green, Blue) with values from 0 to 255 in the `blink.c` file. | ||
|
||
Note: The color order could be different according to the LED model. | ||
|
||
The pixel number indicates the pixel position in the LED strip. For a single LED, use 0. | ||
|
||
## Troubleshooting | ||
|
||
* If the LED isn't blinking, check the GPIO or the LED type selection in the `Example Configuration` menu. | ||
|
||
For any technical queries, please open an [issue] (https://github.com/espressif/esp-idf/issues) on GitHub. We will get back to you soon. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,46 @@ | ||
menu "Example Configuration" | ||
|
||
choice BLINK_LED | ||
prompt "Blink LED type" | ||
default BLINK_LED_RMT if IDF_TARGET_ESP32C3 | ||
default BLINK_LED_RMT if IDF_TARGET_ESP32S2 | ||
default BLINK_LED_GPIO | ||
help | ||
Defines the default peripheral for blink example | ||
|
||
config BLINK_LED_GPIO | ||
bool "GPIO" | ||
config BLINK_LED_RMT | ||
bool "RMT - Addressable LED" | ||
endchoice | ||
|
||
config BLINK_LED_RMT_CHANNEL | ||
depends on BLINK_LED_RMT | ||
int "RMT Channel" | ||
range 0 7 | ||
default 0 | ||
help | ||
Set the RMT peripheral channel. | ||
ESP32 RMT channel from 0 to 7 | ||
ESP32-S2 RMT channel from 0 to 3 | ||
ESP32-C3 RMT channel from 0 to 1 | ||
|
||
config BLINK_GPIO | ||
int "Blink GPIO number" | ||
range 0 34 | ||
default 8 if IDF_TARGET_ESP32C3 | ||
default 18 if IDF_TARGET_ESP32S2 | ||
default 5 | ||
help | ||
GPIO number (IOxx) to blink on and off. | ||
|
||
GPIO number (IOxx) to blink on and off or the RMT signal for the addressable LED. | ||
Some GPIOs are used for other purposes (flash connections, etc.) and cannot be used to blink. | ||
|
||
GPIOs 35-39 are input-only so cannot be used as outputs. | ||
|
||
config BLINK_PERIOD | ||
int "Blink period in ms" | ||
range 10 3600000 | ||
default 1000 | ||
help | ||
Define the blinking period in milliseconds. | ||
|
||
endmenu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 0 additions & 7 deletions
7
examples/peripherals/rmt/led_strip/components/led_strip/CMakeLists.txt
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
examples/peripherals/rmt/led_strip/components/led_strip/component.mk
This file was deleted.
Oops, something went wrong.