File tree 1 file changed +2
-11
lines changed
1 file changed +2
-11
lines changed Original file line number Diff line number Diff line change 25
25
#include " core_esp8266_waveform.h"
26
26
#include " user_interface.h"
27
27
28
- // Which pins have a tone running on them?
29
- static uint32_t _toneMap = 0 ;
30
-
31
-
32
28
static void _startTone (uint8_t _pin, uint32_t high, uint32_t low, uint32_t duration) {
33
29
if (_pin > 16 ) {
34
30
return ;
35
31
}
36
32
37
- if (!(_toneMap & 1UL << _pin)) {
38
- pinMode (_pin, OUTPUT);
39
- }
33
+ pinMode (_pin, OUTPUT);
40
34
41
35
high = std::max (high, (uint32_t )microsecondsToClockCycles (25 )); // new 20KHz maximum tone frequency,
42
36
low = std::max (low, (uint32_t )microsecondsToClockCycles (25 )); // (25us high + 25us low period = 20KHz)
43
37
44
38
duration = microsecondsToClockCycles (duration * 1000UL );
45
39
duration += high + low - 1 ;
46
40
duration -= duration % (high + low);
47
- if (startWaveformClockCycles (_pin, high, low, duration)) {
48
- _toneMap |= 1UL << _pin;
49
- }
41
+ startWaveformClockCycles (_pin, high, low, duration);
50
42
}
51
43
52
44
@@ -88,6 +80,5 @@ void noTone(uint8_t _pin) {
88
80
return ;
89
81
}
90
82
stopWaveform (_pin);
91
- _toneMap &= ~(1UL << _pin);
92
83
digitalWrite (_pin, 0 );
93
84
}
You can’t perform that action at this time.
0 commit comments