Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 50b060a

Browse filesBrowse files
committed
really fix attachInterrupt to work on either core
1 parent 6125a40 commit 50b060a
Copy full SHA for 50b060a

File tree

Expand file treeCollapse file tree

1 file changed

+9
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+9
-2
lines changed

‎cores/esp32/esp32-hal-gpio.c

Copy file name to clipboardExpand all lines: cores/esp32/esp32-hal-gpio.c
+9-2Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,16 +187,23 @@ static void IRAM_ATTR __onPinInterrupt(void *arg)
187187
extern void __attachInterrupt(uint8_t pin, voidFuncPtr userFunc, int intr_type)
188188
{
189189
static bool interrupt_initialized = false;
190+
static int core_id = 0;
191+
190192
if(!interrupt_initialized) {
191193
interrupt_initialized = true;
194+
core_id = xPortGetCoreID();
192195
ESP_INTR_DISABLE(ETS_GPIO_INUM);
193-
intr_matrix_set(xPortGetCoreID(), ETS_GPIO_INTR_SOURCE, ETS_GPIO_INUM);
196+
intr_matrix_set(core_id, ETS_GPIO_INTR_SOURCE, ETS_GPIO_INUM);
194197
xt_set_interrupt_handler(ETS_GPIO_INUM, &__onPinInterrupt, NULL);
195198
ESP_INTR_ENABLE(ETS_GPIO_INUM);
196199
}
197200
__pinInterruptHandlers[pin] = userFunc;
198201
ESP_INTR_DISABLE(ETS_GPIO_INUM);
199-
GPIO.pin[pin].int_ena = 1;
202+
if(core_id) { //APP_CPU
203+
GPIO.pin[pin].int_ena = 1;
204+
} else { //PRO_CPU
205+
GPIO.pin[pin].int_ena = 4;
206+
}
200207
GPIO.pin[pin].int_type = intr_type;
201208
ESP_INTR_ENABLE(ETS_GPIO_INUM);
202209
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.