47 lines
1.0 KiB
C
47 lines
1.0 KiB
C
#pragma once
|
|
|
|
#include "esp_err.h"
|
|
#include "driver/rmt_tx.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/**
|
|
* @brief Handle para a instância de LED strip
|
|
*/
|
|
typedef struct led_strip_t *led_strip_handle_t;
|
|
|
|
/**
|
|
* @brief Configuração para criar um LED strip
|
|
*/
|
|
typedef struct {
|
|
uint32_t strip_length; // número de LEDs
|
|
uint32_t resolution_hz; // resolução do RMT
|
|
rmt_channel_handle_t rmt_channel;// canal RMT a usar
|
|
} led_strip_config_t;
|
|
|
|
/**
|
|
* @brief Cria uma nova instância de LED strip
|
|
*/
|
|
esp_err_t led_strip_new_rmt_device(const led_strip_config_t *config, led_strip_handle_t *ret_strip);
|
|
|
|
/**
|
|
* @brief Define a cor de um LED (index base 0)
|
|
*/
|
|
esp_err_t led_strip_set_pixel(led_strip_handle_t strip, uint32_t index, uint8_t red, uint8_t green, uint8_t blue);
|
|
|
|
/**
|
|
* @brief Atualiza os LEDs com as cores definidas
|
|
*/
|
|
esp_err_t led_strip_refresh(led_strip_handle_t strip);
|
|
|
|
/**
|
|
* @brief Limpa todos os LEDs (define para preto)
|
|
*/
|
|
esp_err_t led_strip_clear(led_strip_handle_t strip);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|