mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-21 10:26:06 +03:00
Make stopWaveform call interrupt callable (#5248)
* Make stopWaveform call interrupt callable Match the behavior of pre-2.4.2 PWM by allowing stopWaveform to be called from an interrupt. Fixes #5247 * Move to O2, save ~500 bytes of code The actual runtime difference of -O2 vs -O3 is quite small, but -O3 takes ~500 more bytes of code (~300 more in IRAM, ~200 more in PMEM).
This commit is contained in:
parent
2eb5b5600a
commit
d742df84e5
@ -41,7 +41,7 @@
|
|||||||
#include "core_esp8266_waveform.h"
|
#include "core_esp8266_waveform.h"
|
||||||
|
|
||||||
// Need speed, not size, here
|
// Need speed, not size, here
|
||||||
#pragma GCC optimize ("O3")
|
#pragma GCC optimize ("O2")
|
||||||
|
|
||||||
// Maximum delay between IRQs
|
// Maximum delay between IRQs
|
||||||
#define MAXIRQUS (10000)
|
#define MAXIRQUS (10000)
|
||||||
@ -137,7 +137,7 @@ static void initTimer() {
|
|||||||
timerRunning = true;
|
timerRunning = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void deinitTimer() {
|
static void ICACHE_RAM_ATTR deinitTimer() {
|
||||||
timer1_attachInterrupt(NULL);
|
timer1_attachInterrupt(NULL);
|
||||||
timer1_disable();
|
timer1_disable();
|
||||||
timer1_isr_init();
|
timer1_isr_init();
|
||||||
@ -202,7 +202,7 @@ int startWaveform(uint8_t pin, uint32_t timeHighUS, uint32_t timeLowUS, uint32_t
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Stops a waveform on a pin
|
// Stops a waveform on a pin
|
||||||
int stopWaveform(uint8_t pin) {
|
int ICACHE_RAM_ATTR stopWaveform(uint8_t pin) {
|
||||||
// Can't possibly need to stop anything if there is no timer active
|
// Can't possibly need to stop anything if there is no timer active
|
||||||
if (!timerRunning) {
|
if (!timerRunning) {
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user