inital setup for led controll
This commit is contained in:
parent
f17bf03eaf
commit
8fcc27af0e
@ -1,3 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.16.0)
|
||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||
list(APPEND EXTRA_COMPONENT_DIRS led_strip)
|
||||
project(rx_esp32)
|
||||
|
||||
33
rx_esp32/src/led.c
Normal file
33
rx_esp32/src/led.c
Normal file
@ -0,0 +1,33 @@
|
||||
#include "led.h"
|
||||
|
||||
#include "driver/gpio.h"
|
||||
#include "led_strip.h"
|
||||
|
||||
static led_strip_handle_t led_strip;
|
||||
|
||||
void led_init(void)
|
||||
{
|
||||
/* LED strip initialization with the GPIO and pixels number*/
|
||||
led_strip_config_t strip_config = {
|
||||
.strip_gpio_num = 8,
|
||||
.max_leds = 1,
|
||||
};
|
||||
led_strip_rmt_config_t rmt_config = {
|
||||
.resolution_hz = 10 * 1000 * 1000, // 10MHz
|
||||
.flags.with_dma = false,
|
||||
};
|
||||
led_strip_new_rmt_device(&strip_config, &rmt_config, &led_strip);
|
||||
/* Set all LED off to clear all pixels */
|
||||
led_strip_clear(led_strip);
|
||||
}
|
||||
|
||||
void led_deinit(void)
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
|
||||
void led_setColor(uint8_t r, uint8_t g, uint8_t b)
|
||||
{
|
||||
led_strip_set_pixel(led_strip, 0, 16, 16, 16);
|
||||
led_strip_refresh(led_strip);
|
||||
}
|
||||
10
rx_esp32/src/led.h
Normal file
10
rx_esp32/src/led.h
Normal file
@ -0,0 +1,10 @@
|
||||
#ifndef LED_H
|
||||
#define LED_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
void led_init(void);
|
||||
void led_deinit(void);
|
||||
void led_setColor(uint8_t r, uint8_t g, uint8_t b);
|
||||
|
||||
#endif
|
||||
Loading…
x
Reference in New Issue
Block a user