LED.c 812 B

123456789101112131415161718192021222324252627282930
  1. #include <stdio.h>
  2. #include "freertos/FreeRTOS.h"
  3. #include "freertos/task.h"
  4. #include "driver/gpio.h"
  5. #include "esp_log.h"
  6. #include "led_strip.h"
  7. #include "sdkconfig.h"
  8. #include "LED.h"
  9. static const char *TAG = "LED_Control";
  10. led_strip_handle_t led_strip = NULL;
  11. led_strip_handle_t configure_led(void)
  12. {
  13. led_strip_config_t strip_config = {
  14. .strip_gpio_num = 38,
  15. .max_leds = 1,
  16. };
  17. // LED strip backend configuration: RMT
  18. led_strip_rmt_config_t rmt_config = {
  19. .clk_src = RMT_CLK_SRC_DEFAULT,
  20. .resolution_hz = (10 * 1000 * 1000),
  21. };
  22. led_strip_handle_t handle = NULL;
  23. ESP_ERROR_CHECK(led_strip_new_rmt_device(&strip_config, &rmt_config, &handle));
  24. ESP_LOGI(TAG, "Created LED strip object with RMT backend");
  25. return handle;
  26. }