1
- /*
1
+ /*
2
2
timer.c - Timer1 library for esp8266
3
3
4
4
Copyright (c) 2015 Hristo Gochkov. All rights reserved.
5
5
This file is part of the esp8266 core for Arduino environment.
6
-
6
+
7
7
This library is free software; you can redistribute it and/or
8
8
modify it under the terms of the GNU Lesser General Public
9
9
License as published by the Free Software Foundation; either
29
29
30
30
static volatile timercallback timer1_user_cb = NULL ;
31
31
32
- void timer1_isr_handler (void * para ){
32
+ void ICACHE_RAM_ATTR timer1_isr_handler (void * para ){
33
33
if ((T1C & ((1 << TCAR ) | (1 << TCIT ))) == 0 ) TEIE &= ~TEIE1 ;//edge int disable
34
34
T1I = 0 ;
35
35
if (timer1_user_cb ) {
36
36
// to make ISR compatible to Arduino AVR model where interrupts are disabled
37
37
// we disable them before we call the client ISR
38
- uint32_t savedPS = xt_rsil (15 ); // stop other interrupts
38
+ uint32_t savedPS = xt_rsil (15 ); // stop other interrupts
39
39
timer1_user_cb ();
40
40
xt_wsr_ps (savedPS );
41
41
}
@@ -61,7 +61,7 @@ void timer1_enable(uint8_t divider, uint8_t int_type, uint8_t reload){
61
61
T1I = 0 ;
62
62
}
63
63
64
- void timer1_write (uint32_t ticks ){
64
+ void ICACHE_RAM_ATTR timer1_write (uint32_t ticks ){
65
65
T1L = ((ticks )& 0x7FFFFF );
66
66
if ((T1C & (1 << TCIT )) == 0 ) TEIE |= TEIE1 ;//edge int enable
67
67
}
@@ -76,7 +76,7 @@ void timer1_disable(){
76
76
77
77
static volatile timercallback timer0_user_cb = NULL ;
78
78
79
- void timer0_isr_handler (void * para ){
79
+ void ICACHE_RAM_ATTR timer0_isr_handler (void * para ){
80
80
if (timer0_user_cb ) {
81
81
// to make ISR compatible to Arduino AVR model where interrupts are disabled
82
82
// we disable them before we call the client ISR
@@ -99,6 +99,3 @@ void timer0_detachInterrupt() {
99
99
timer0_user_cb = NULL ;
100
100
ETS_CCOMPARE0_DISABLE ();
101
101
}
102
-
103
-
104
-
0 commit comments