Skip to content

Commit 025ecab

Browse files
authored
Merge pull request #54 from esven/master
esp32: fix bug when WiFi is used simultaneously
2 parents 2072d58 + 1deb2ac commit 025ecab

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

RGBmatrixPanel.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,12 @@ void RGBmatrixPanel::updateDisplay(void) {
774774
while(TIMER->COUNT16.STATUS.bit.SYNCBUSY);
775775
#endif // SAMD21
776776
#elif defined(ARDUINO_ARCH_ESP32)
777-
timer_set_alarm_value(TIMER_GROUP_1, TIMER_0, duration);
777+
static timg_dev_t *TG[2] = {&TIMERG0, &TIMERG1};
778+
static portMUX_TYPE timer_spinlock[TIMER_GROUP_MAX] = {portMUX_INITIALIZER_UNLOCKED, portMUX_INITIALIZER_UNLOCKED};
779+
portENTER_CRITICAL(&timer_spinlock[TIMER_GROUP_1]);
780+
TG[TIMER_GROUP_1]->hw_timer[TIMER_0].alarm_high = (uint32_t) (duration >> 32);
781+
TG[TIMER_GROUP_1]->hw_timer[TIMER_0].alarm_low = (uint32_t) duration;
782+
portEXIT_CRITICAL(&timer_spinlock[TIMER_GROUP_1]);
778783
#endif // ARDUINO_ARCH_SAMD
779784
*oeport &= ~oemask; // Re-enable output
780785
*latport &= ~latmask; // Latch down

0 commit comments

Comments
 (0)