Skip to content

Commit 0b14375

Browse files
committed
Merge remote-tracking branch 'remotes/ficeto/esp8266' into esp8266
2 parents 934434d + 3394d57 commit 0b14375

File tree

9 files changed

+909
-90
lines changed

9 files changed

+909
-90
lines changed

hardware/esp8266com/esp8266/cores/esp8266/Arduino.h

+1
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ int digitalRead(uint8_t);
172172
int analogRead(uint8_t);
173173
void analogReference(uint8_t mode);
174174
void analogWrite(uint8_t, int);
175+
void analogWriteFreq(uint32_t freq);
175176

176177
unsigned long millis(void);
177178
unsigned long micros(void);

hardware/esp8266com/esp8266/cores/esp8266/core_esp8266_timer.c

+15-8
Original file line numberDiff line numberDiff line change
@@ -30,32 +30,39 @@ void timer1_isr_handler(void *para){
3030
if(timer1_user_cb) timer1_user_cb();
3131
}
3232

33-
void timer1_attachInterrupt(void (*userFunc)(void)) {
33+
extern void __timer1_isr_init(){
34+
ETS_FRC_TIMER1_INTR_ATTACH(timer1_isr_handler, NULL);
35+
}
36+
37+
extern void __timer1_attachInterrupt(void (*userFunc)(void)) {
3438
timer1_user_cb = userFunc;
3539
ETS_FRC1_INTR_ENABLE();
3640
}
3741

38-
void timer1_detachInterrupt() {
42+
extern void __timer1_detachInterrupt() {
3943
timer1_user_cb = 0;
4044
TEIE &= ~TEIE1;//edge int disable
4145
ETS_FRC1_INTR_DISABLE();
4246
}
4347

44-
void timer1_enable(uint8_t divider, uint8_t int_type, uint8_t reload){
48+
extern void __timer1_enable(uint8_t divider, uint8_t int_type, uint8_t reload){
4549
T1C = (1 << TCTE) | ((divider & 3) << TCPD) | ((int_type & 1) << TCIT) | ((reload & 1) << TCAR);
4650
T1I = 0;
4751
}
4852

49-
void timer1_write(uint32_t ticks){
53+
extern void __timer1_write(uint32_t ticks){
5054
T1L = ((ticks) & 0x7FFFFF);
5155
if((T1C & (1 << TCIT)) == 0) TEIE |= TEIE1;//edge int enable
5256
}
5357

54-
void timer1_disable(){
58+
extern void __timer1_disable(){
5559
T1C = 0;
5660
T1I = 0;
5761
}
5862

59-
void timer1_isr_init(){
60-
ETS_FRC_TIMER1_INTR_ATTACH(timer1_isr_handler, NULL);
61-
}
63+
extern void timer1_isr_init(void) __attribute__ ((weak, alias("__timer1_isr_init")));
64+
extern void timer1_detachInterrupt(void) __attribute__ ((weak, alias("__timer1_detachInterrupt")));
65+
extern void timer1_disable(void) __attribute__ ((weak, alias("__timer1_disable")));
66+
extern void timer1_attachInterrupt(void (*userFunc)(void)) __attribute__ ((weak, alias("__timer1_attachInterrupt")));
67+
extern void timer1_write(uint32_t ticks) __attribute__ ((weak, alias("__timer1_write")));
68+
extern void timer1_enable(uint8_t divider, uint8_t int_type, uint8_t reload) __attribute__ ((weak, alias("__timer1_enable")));

hardware/esp8266com/esp8266/cores/esp8266/core_esp8266_wiring.c

+1
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ void delayMicroseconds(unsigned int us) {
7575

7676
void init() {
7777
initPins();
78+
timer1_isr_init();
7879
os_timer_setfn(&micros_overflow_timer, (os_timer_func_t*) &micros_overflow_tick, 0);
7980
os_timer_arm(&micros_overflow_timer, 60000, REPEAT);
8081
}

hardware/esp8266com/esp8266/cores/esp8266/core_esp8266_wiring_pwm.c

+6
Original file line numberDiff line numberDiff line change
@@ -139,4 +139,10 @@ extern void __analogWrite(uint8_t pin, int value) {
139139
}
140140
}
141141

142+
extern void __analogWriteFreq(uint32_t freq){
143+
pwm_freq = freq;
144+
prep_pwm_steps();
145+
}
146+
142147
extern void analogWrite(uint8_t pin, int val) __attribute__ ((weak, alias("__analogWrite")));
148+
extern void analogWriteFreq(uint32_t freq) __attribute__ ((weak, alias("__analogWriteFreq")));

0 commit comments

Comments
 (0)