This repository contains a LED component. The LED component creates a software timer to flash the LED. The application in main/main.c
uses that LED component. See Espressif's documentation of the Build System to get an understanding of the directory structure.
The application creates three LED instances to control the RGB LED on Espressif's WROVER kit.
The LED initializer led_init()
passes the LED instance to the timer "constructor" xTimerCreate()
.
The LED flash function (static void blink(TimerHandle_t timer)
) then uses pvTimerGetTimerID()
to retrieve the LED instance from the passed timer handle.
idf.py menuconfig
The LED component has two configuration options in Component config -> My LED configuration
:
CONFIG_LED_DYNAMIC_INSTANCE
to enable functions for dynamic LED construction/destructionCONFIG_LED_PULL_CURRENT
to adjust for the wiring of the LED to the GPIO pin (push or pull)
idf.py build