52 lines
1.3 KiB
C
52 lines
1.3 KiB
C
#pragma once
|
|
|
|
#include <stdint.h>
|
|
#include <stdlib.h>
|
|
#include "led_strip_encoder.h"
|
|
#include "esp_log.h"
|
|
#include "driver/rmt_tx.h"
|
|
#include "freertos/FreeRTOS.h"
|
|
#include "os/os.h"
|
|
#include "../../config/board_config.h"
|
|
|
|
#define RMT_LED_STRIP_RESOLUTION_HZ 10000000 // 10MHz resolution, 1 tick = 0.1us (led strip needs a high resolution)
|
|
// #define RMT_LED_STRIP_GPIO_NUM g_cfg_board->rgb_led_pin
|
|
#define RMT_LED_STRIP_GPIO_NUM 8
|
|
|
|
#define EXAMPLE_LED_NUMBERS 2
|
|
#define EXAMPLE_CHASE_SPEED_MS 10
|
|
|
|
// static const char *TAG = "example";
|
|
|
|
extern rmt_channel_handle_t led_chan;
|
|
extern rmt_encoder_handle_t led_encoder;
|
|
extern rmt_transmit_config_t tx_config;
|
|
|
|
|
|
typedef struct rgb_color_s
|
|
{
|
|
uint8_t index;
|
|
uint8_t red;
|
|
uint8_t green;
|
|
uint8_t blue;
|
|
uint8_t toggle_flag;
|
|
}rgb_color_t;
|
|
|
|
typedef enum
|
|
{
|
|
RGB_COLOR_RAD = 0,
|
|
RGB_COLOR_ORANGE,
|
|
RGB_COLOR_GREEN,
|
|
RGB_COLOR_WHITE,
|
|
RGB_COLOR_PURPLE,
|
|
RGB_COLOR_CYAN,
|
|
RGB_COLOR_BLUE,
|
|
}RGB_COLOR;
|
|
|
|
void led_strip_init(void);
|
|
void led_strip_set_pixel(uint8_t pin, uint8_t index, uint8_t green, uint8_t blue, uint8_t red);
|
|
void work_rgb_led_start(void);
|
|
void _work_rgb_led(void *arg);
|
|
void rgb_update_cyle(uint16_t cyle);
|
|
void rgb_toggle(rgb_color_t* rgb_color);
|
|
void rgb_color_change(uint8_t index, uint8_t color); |