forked from bbulkow/FastLED-idf
Fixed RMT
This commit is contained in:
@ -11,12 +11,12 @@ set(srcs
|
||||
"platforms.cpp"
|
||||
"power_mgt.cpp"
|
||||
"wiring.cpp"
|
||||
# "hal/esp32-hal-misc.c"
|
||||
# "hal/esp32-hal-gpio.c"
|
||||
# remove the following if you want I2S instead of RMT hardware, just put a pound in front
|
||||
# "platforms/esp/32/clockless_rmt_esp32.cpp"
|
||||
)
|
||||
|
||||
if(CONFIG_FASTLED_METHOD_RMT)
|
||||
list(APPEND srcs "platforms/esp/32/clockless_rmt_esp32.cpp")
|
||||
endif()
|
||||
|
||||
# everything needs the ESP32 flag, not sure why this won't work
|
||||
# going to hack by adding the ESP32 define in the h file
|
||||
#`target_compile_options(${COMPONENT_LIB} PRIVATE "-DESP32")
|
||||
|
@ -10,10 +10,6 @@
|
||||
#endif
|
||||
#define FASTLED_NO_PINMAP
|
||||
|
||||
// prefer I2S? Comment this in.
|
||||
// Not the default because haven't tried it as much, does work
|
||||
#define FASTLED_ESP32_I2S
|
||||
|
||||
//#include "esp32-hal.h"
|
||||
|
||||
#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
|
||||
|
13
Kconfig.projbuild
Normal file
13
Kconfig.projbuild
Normal file
@ -0,0 +1,13 @@
|
||||
menu "FastLED"
|
||||
|
||||
choice FASTLED_METHOD
|
||||
bool "Used method/implementation"
|
||||
default FASTLED_METHOD_I2S
|
||||
|
||||
config FASTLED_METHOD_I2S
|
||||
bool "I2S"
|
||||
config FASTLED_METHOD_RMT
|
||||
bool "RMT"
|
||||
endchoice
|
||||
|
||||
endmenu
|
30
platforms/esp/32/clockless_esp32.h
Normal file
30
platforms/esp/32/clockless_esp32.h
Normal file
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
* * The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
FASTLED_NAMESPACE_BEGIN
|
||||
|
||||
__attribute__ ((always_inline)) inline static uint32_t __clock_cycles() {
|
||||
uint32_t cyc;
|
||||
__asm__ __volatile__ ("rsr %0,ccount":"=a" (cyc));
|
||||
return cyc;
|
||||
}
|
||||
|
||||
FASTLED_NAMESPACE_END
|
@ -110,17 +110,13 @@ extern "C" {
|
||||
#include "esp32/rom/lldesc.h"
|
||||
|
||||
#include "esp_log.h"
|
||||
|
||||
#include "clockless_esp32.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
__attribute__ ((always_inline)) inline static uint32_t __clock_cycles() {
|
||||
uint32_t cyc;
|
||||
__asm__ __volatile__ ("rsr %0,ccount":"=a" (cyc));
|
||||
return cyc;
|
||||
}
|
||||
|
||||
#define FASTLED_HAS_CLOCKLESS 1
|
||||
#define NUM_COLOR_CHANNELS 3
|
||||
|
||||
|
@ -2,8 +2,6 @@
|
||||
#define FASTLED_INTERNAL
|
||||
#include "FastLED.h"
|
||||
|
||||
#include "clockless_rmt_esp32.h"
|
||||
|
||||
//static const char *TAG = "FastLED";
|
||||
#include "esp_idf_version.h"
|
||||
|
||||
|
@ -123,6 +123,8 @@ extern "C" {
|
||||
|
||||
#include "esp_log.h"
|
||||
|
||||
#include "clockless_esp32.h"
|
||||
|
||||
extern void spi_flash_op_lock(void);
|
||||
extern void spi_flash_op_unlock(void);
|
||||
|
||||
|
@ -1,14 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#include "sdkconfig.h"
|
||||
|
||||
#include "fastpin_esp32.h"
|
||||
|
||||
#ifdef FASTLED_ALL_PINS_HARDWARE_SPI
|
||||
#include "fastspi_esp32.h"
|
||||
#endif
|
||||
|
||||
#ifdef FASTLED_ESP32_I2S
|
||||
#ifdef CONFIG_FASTLED_METHOD_I2S
|
||||
#include "clockless_i2s_esp32.h"
|
||||
#else
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_FASTLED_METHOD_RMT
|
||||
#include "clockless_rmt_esp32.h"
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user