File tree 1 file changed +9
-2
lines changed
1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -187,16 +187,23 @@ static void IRAM_ATTR __onPinInterrupt(void *arg)
187
187
extern void __attachInterrupt (uint8_t pin , voidFuncPtr userFunc , int intr_type )
188
188
{
189
189
static bool interrupt_initialized = false;
190
+ static int core_id = 0 ;
191
+
190
192
if (!interrupt_initialized ) {
191
193
interrupt_initialized = true;
194
+ core_id = xPortGetCoreID ();
192
195
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 );
194
197
xt_set_interrupt_handler (ETS_GPIO_INUM , & __onPinInterrupt , NULL );
195
198
ESP_INTR_ENABLE (ETS_GPIO_INUM );
196
199
}
197
200
__pinInterruptHandlers [pin ] = userFunc ;
198
201
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
+ }
200
207
GPIO .pin [pin ].int_type = intr_type ;
201
208
ESP_INTR_ENABLE (ETS_GPIO_INUM );
202
209
}
You can’t perform that action at this time.
0 commit comments