File tree Expand file tree Collapse file tree 1 file changed +4
-12
lines changed
Filter options
Expand file tree Collapse file tree 1 file changed +4
-12
lines changed
Original file line number Diff line number Diff line change @@ -91,11 +91,6 @@ namespace {
91
91
92
92
bool timer1Running = false ;
93
93
94
- // Optimize the NMI inner loop by keeping track of the min and max GPIO that we
95
- // are generating. In the common case (1 PWM) these may be the same pin and
96
- // we can avoid looking at the other pins.
97
- int startPin = 0 ;
98
- int endPin = 0 ;
99
94
uint32_t nextEventCcy;
100
95
} waveform;
101
96
@@ -266,9 +261,6 @@ static ICACHE_RAM_ATTR void timer1Interrupt() {
266
261
// Handle enable/disable requests from main app.
267
262
waveform.enabled = (waveform.enabled & ~waveform.toDisableBits ) | waveform.toSetBits ; // Set the requested waveforms on/off
268
263
// Find the first GPIO being generated by checking GCC's find-first-set (returns 1 + the bit of the first 1 in an int32_t)
269
- waveform.startPin = __builtin_ffs (waveform.enabled ) - 1 ;
270
- // Find the last bit by subtracting off GCC's count-leading-zeros (no offset in this one)
271
- waveform.endPin = 32 - __builtin_clz (waveform.enabled );
272
264
waveform.toDisableBits = 0 ;
273
265
}
274
266
@@ -319,11 +311,11 @@ static ICACHE_RAM_ATTR void timer1Interrupt() {
319
311
break ;
320
312
}
321
313
isrNextEventCcy = waveform.nextEventCcy ;
322
- for (int pin = waveform.startPin ; pin <= waveform.endPin ; ++pin) {
314
+ uint32_t loopPins = busyPins;
315
+ while (loopPins) {
316
+ const int pin = __builtin_ffsl (loopPins) - 1 ;
323
317
const uint32_t pinBit = 1UL << pin;
324
- // If it's not on, ignore
325
- if (!(busyPins & pinBit))
326
- continue ;
318
+ loopPins ^= pinBit;
327
319
328
320
Waveform& wave = waveform.pins [pin];
329
321
You can’t perform that action at this time.
0 commit comments