Skip to content

Commit b64a864

Browse files
committed
ESP32 PWMDriverESP32
1 parent 548c631 commit b64a864

File tree

5 files changed

+10
-9
lines changed

5 files changed

+10
-9
lines changed

src/AudioPWM/PWMAudioAVR.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ class PWMDriverAVR : public DriverPWMBase {
131131
};
132132

133133
/// separate method that can be defined as friend so that we can access protected information
134-
inline void defaultPWMAudioOutputCallback(){
134+
void defaultPWMAudioOutputCallback(){
135135
if (accessAudioPWM!=nullptr && accessAudioPWM->is_timer_started){
136136
accessAudioPWM->playNextFrame();
137137
}

src/AudioPWM/PWMAudioESP32.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ class PWMDriverESP32;
1414
*/
1515
using PWMDriver = PWMDriverESP32;
1616
static PWMDriverESP32 *accessAudioPWM = nullptr;
17+
void IRAM_ATTR defaultPWMAudioOutputCallback();
1718

1819

1920
/**
@@ -36,8 +37,8 @@ typedef PinInfoESP32 PinInfo;
3637
*/
3738

3839
class PWMDriverESP32 : public DriverPWMBase {
39-
friend void defaultPWMAudioOutputCallback();
4040
public:
41+
friend void defaultPWMAudioOutputCallback();
4142

4243
PWMDriverESP32(){
4344
TRACED();
@@ -103,7 +104,7 @@ class PWMDriverESP32 : public DriverPWMBase {
103104
LOGI("-> timer counter is %zu", counter);
104105
LOGD("-> timerAttachInterrupt");
105106
bool interrupt_edge_type = true;
106-
timerAttachInterrupt(timer, &defaultPWMAudioOutputCallback, interrupt_edge_type);
107+
timerAttachInterrupt(timer, defaultPWMAudioOutputCallback, interrupt_edge_type);
107108
LOGD("-> timerAlarmWrite");
108109
bool auto_reload = true;
109110
timerAlarmWrite(timer, counter, auto_reload); // Timer fires at ~44100Hz [40Mhz / 907]
@@ -146,16 +147,16 @@ class PWMDriverESP32 : public DriverPWMBase {
146147

147148

148149
};
149-
150-
/// timer callback: write the next frame to the pins
151-
inline void IRAM_ATTR defaultPWMAudioOutputCallback() {
150+
/// timer callback: write the next frame to the pins
151+
void IRAM_ATTR defaultPWMAudioOutputCallback() {
152152
if (accessAudioPWM!=nullptr){
153153
portENTER_CRITICAL_ISR(&(accessAudioPWM->timerMux));
154154
accessAudioPWM->playNextFrame();
155155
portEXIT_CRITICAL_ISR(&(accessAudioPWM->timerMux));
156156
}
157157
}
158158

159+
159160
}
160161

161162
#endif

src/AudioPWM/PWMAudioMBED.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ class PWMDriverMBED : public DriverPWMBase {
102102
}
103103

104104
/// timer callback: write the next frame to the pins
105-
static inline void defaultPWMAudioOutputCallback(void *obj) {
105+
static void defaultPWMAudioOutputCallback(void *obj) {
106106
PWMDriverMBED* accessAudioPWM = (PWMDriverMBED*) obj;
107107
if (accessAudioPWM!=nullptr){
108108
accessAudioPWM->playNextFrame();

src/AudioPWM/PWMAudioRP2040.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ class PWMDriverRP2040 : public DriverPWMBase {
153153
}
154154

155155
// timed output executed at the sampleRate
156-
inline static void defaultPWMAudioOutputCallbackPico(void* ptr) {
156+
static void defaultPWMAudioOutputCallbackPico(void* ptr) {
157157
PWMDriverRP2040 *self = (PWMDriverRP2040*) ptr;
158158
self->playNextFrame();
159159
}

src/AudioPWM/PWMAudioSTM32.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ class PWMDriverSTM32 : public DriverPWMBase {
195195
}
196196

197197
/// timer callback: write the next frame to the pins
198-
static inline void defaultPWMAudioOutputCallback(void *obj) {
198+
static void defaultPWMAudioOutputCallback(void *obj) {
199199
PWMDriverSTM32* accessAudioPWM = (PWMDriverSTM32*) obj;
200200
if (accessAudioPWM!=nullptr){
201201
accessAudioPWM->playNextFrame();

0 commit comments

Comments
 (0)