Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FastLED/FastLED.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Guyer <sam.guyer@gmail.com>2020-12-15 03:39:44 +0300
committerSam Guyer <sam.guyer@gmail.com>2020-12-15 03:39:44 +0300
commitfed7c1c58336790ce0e5e45fd7c5f33d123e4a8f (patch)
treeeba2f16e9d11d42cca1fa7130b47b34b544052a1
parent6346a3eb2088de897393e524a5cf20abbb6a3912 (diff)
Hand inlining of a few of the RMT system calls in order to guarantee that all the code is in IRAM
-rw-r--r--src/platforms/esp/32/clockless_rmt_esp32.cpp31
1 files changed, 22 insertions, 9 deletions
diff --git a/src/platforms/esp/32/clockless_rmt_esp32.cpp b/src/platforms/esp/32/clockless_rmt_esp32.cpp
index 3e772b80..a9a854b5 100644
--- a/src/platforms/esp/32/clockless_rmt_esp32.cpp
+++ b/src/platforms/esp/32/clockless_rmt_esp32.cpp
@@ -137,7 +137,7 @@ void ESP32RMTController::init()
// -- Show this string of pixels
// This is the main entry point for the pixel controller
-void ESP32RMTController::showPixels()
+void IRAM_ATTR ESP32RMTController::showPixels()
{
if (gNumStarted == 0) {
// -- First controller: make sure everything is set up
@@ -197,7 +197,7 @@ void ESP32RMTController::showPixels()
// -- Start up the next controller
// This method is static so that it can dispatch to the
// appropriate startOnChannel method of the given controller.
-void ESP32RMTController::startNext(int channel)
+void IRAM_ATTR ESP32RMTController::startNext(int channel)
{
if (gNext < gNumControllers) {
ESP32RMTController * pController = gControllers[gNext];
@@ -209,7 +209,7 @@ void ESP32RMTController::startNext(int channel)
// -- Start this controller on the given channel
// This function just initiates the RMT write; it does not wait
// for it to finish.
-void ESP32RMTController::startOnChannel(int channel)
+void IRAM_ATTR ESP32RMTController::startOnChannel(int channel)
{
// -- Assign this channel and configure the RMT
mRMT_channel = rmt_channel_t(channel);
@@ -250,10 +250,15 @@ void ESP32RMTController::startOnChannel(int channel)
// -- Start RMT transmission
// Setting this RMT flag is what actually kicks off the peripheral
-void ESP32RMTController::tx_start()
+void IRAM_ATTR ESP32RMTController::tx_start()
{
- rmt_tx_start(mRMT_channel, true);
- //RMT.conf_ch[mRMT_channel].conf1.tx_start = 1;
+ // rmt_tx_start(mRMT_channel, true);
+ // Inline the code for rmt_tx_start, so it can be placed in IRAM
+ RMT.conf_ch[mRMT_channel].conf1.mem_rd_rst = 1;
+ RMT.conf_ch[mRMT_channel].conf1.mem_rd_rst = 0;
+ RMT.int_ena.val &= ~(1 << (mRMT_channel * 3));
+ RMT.int_ena.val |= (1 << (mRMT_channel * 3));
+ RMT.conf_ch[mRMT_channel].conf1.tx_start = 1;
mLastFill = __clock_cycles();
}
@@ -263,7 +268,7 @@ void ESP32RMTController::tx_start()
// handler (below), or as a callback from the built-in
// interrupt handler. It is static because we don't know which
// controller is done until we look it up.
-void ESP32RMTController::doneOnChannel(rmt_channel_t channel, void * arg)
+void IRAM_ATTR ESP32RMTController::doneOnChannel(rmt_channel_t channel, void * arg)
{
ESP32RMTController * pController = gOnChannel[channel];
@@ -273,8 +278,10 @@ void ESP32RMTController::doneOnChannel(rmt_channel_t channel, void * arg)
// -- Turn off the interrupts
// rmt_set_tx_intr_en(channel, false);
+ // Inline the code for rmt_tx_stop, so it can be placed in IRAM
RMT.int_ena.val &= ~(1 << (channel * 3));
- // Not needed: RMT.int_ena.val |= (false << (mRMT_channel * 3));
+ RMT.conf_ch[channel].conf1.mem_rd_rst = 1;
+ RMT.conf_ch[channel].conf1.mem_rd_rst = 0;
gOnChannel[channel] = NULL;
gNumDone++;
@@ -344,8 +351,14 @@ void IRAM_ATTR ESP32RMTController::fillNext(bool check_time)
// Serial.print(delta);
// Serial.print(" BAIL ");
// Serial.println(mCur);
- mCur = mSize;
// rmt_tx_stop(mRMT_channel);
+ // Inline the code for rmt_tx_stop, so it can be placed in IRAM
+ * mRMT_mem_start = 0;
+ RMT.int_ena.val &= ~(1 << (mRMT_channel * 3));
+ RMT.conf_ch[mRMT_channel].conf1.tx_start = 0;
+ RMT.conf_ch[mRMT_channel].conf1.mem_rd_rst = 1;
+ RMT.conf_ch[mRMT_channel].conf1.mem_rd_rst = 0;
+ return;
}
}
}