3 #if defined(ARDUINO_ARCH_MBED)
4 #include "AudioTools/CoreAudio/AudioPWM/PWMAudioBase.h"
5 #include "AudioTools/CoreAudio/AudioTimer/AudioTimer.h"
16 using PWMDriver = PWMDriverMBED;
30 virtual void end()
override {
34 is_timer_started =
false;
37 for (
int j = 0; j < audio_config.
channels; j++) {
38 if (pins[j] !=
nullptr) {
56 if (!is_timer_started) {
58 long wait_time = 1000000l / audio_config.
sample_rate;
59 ticker.setCallbackParameter(
this);
61 is_timer_started =
true;
68 unsigned long period =
69 1000000l / audio_config.pwm_frequency;
71 for (
int j = 0; j < audio_config.
channels; j++) {
72 LOGD(
"Processing channel %d", j);
73 auto gpio = audio_config.pins()[j];
74 mbed::PwmOut* pin =
new mbed::PwmOut(digitalPinToPinName(gpio));
75 LOGI(
"PWM Pin: %d", gpio);
76 pin->period_us(period);
94 virtual void pwmWrite(
int channel,
int value) {
96 pins[channel]->write(float_value);
102 if (accessAudioPWM !=
nullptr) {