添加RGB灯
This commit is contained in:
48
app/drivers/led_strip/led_strip.h
Normal file
48
app/drivers/led_strip/led_strip.h
Normal file
@@ -0,0 +1,48 @@
|
||||
#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_GREEN,
|
||||
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);
|
||||
Reference in New Issue
Block a user