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 af35773

Browse filesBrowse files
committed
OK Really change timer allocator
1 parent 17ece1b commit af35773
Copy full SHA for af35773

File tree

Expand file treeCollapse file tree

1 file changed

+11
-16
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+11
-16
lines changed

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

Copy file name to clipboardExpand all lines: cores/esp32/esp32-hal-timer.c
+11-16Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -213,14 +213,12 @@ void timerEnd(hw_timer_t *timer){
213213
timerAttachInterrupt(timer, NULL, false);
214214
}
215215

216-
#define HWTIMER_INUM 10
217216
void timerAttachInterrupt(hw_timer_t *timer, void (*fn)(void), bool edge){
218217
static bool initialized = false;
219-
//static intr_handle_t intr_handle = NULL;
220-
//if(intr_handle){
221-
// esp_intr_disable(intr_handle);
222-
//}
223-
ESP_INTR_DISABLE(HWTIMER_INUM);
218+
static intr_handle_t intr_handle = NULL;
219+
if(intr_handle){
220+
esp_intr_disable(intr_handle);
221+
}
224222
if(fn == NULL){
225223
timer->dev->config.level_int_en = 0;
226224
timer->dev->config.edge_int_en = 0;
@@ -251,22 +249,19 @@ void timerAttachInterrupt(hw_timer_t *timer, void (*fn)(void), bool edge){
251249
}
252250
if(!initialized){
253251
initialized = true;
254-
xt_set_interrupt_handler(HWTIMER_INUM, &__timerISR, NULL);
255-
//esp_intr_alloc(intr_source, (int)ESP_INTR_FLAG_IRAM, __timerISR, NULL, &intr_handle);
256-
}// else {
257-
// intr_matrix_set(esp_intr_get_cpu(intr_handle), intr_source, esp_intr_get_intno(intr_handle));
258-
//}
259-
intr_matrix_set(xPortGetCoreID(), intr_source, HWTIMER_INUM);
252+
esp_intr_alloc(intr_source, (int)(ESP_INTR_FLAG_IRAM|ESP_INTR_FLAG_LOWMED|ESP_INTR_FLAG_EDGE), __timerISR, NULL, &intr_handle);
253+
} else {
254+
intr_matrix_set(esp_intr_get_cpu(intr_handle), intr_source, esp_intr_get_intno(intr_handle));
255+
}
260256
if(timer->group){
261257
TIMERG1.int_ena.val |= BIT(timer->timer);
262258
} else {
263259
TIMERG0.int_ena.val |= BIT(timer->timer);
264260
}
265261
}
266-
//if(intr_handle){
267-
// esp_intr_enable(intr_handle);
268-
//}
269-
ESP_INTR_ENABLE(HWTIMER_INUM);
262+
if(intr_handle){
263+
esp_intr_enable(intr_handle);
264+
}
270265
}
271266

272267
void timerDetachInterrupt(hw_timer_t *timer){

0 commit comments

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