Skip to content

Commit 75804df

Browse files
committed
PWM Corrections
1 parent 6a546ef commit 75804df

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

examples/streams-memory_wav-pwm/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ MemoryStream -> AudioOutputStream -> WAVDecoder -> AudioPWM
88

99
The pins depend on the Processor:
1010

11-
| PIEZO | ESP32 | RPI Pico |
12-
| --------| ---------------|-----------------|
13-
| + | GPIO4 | GPIO2 |
14-
| - | GND | |
11+
| PIEZO | ESP32 | RPI Pico | MBED |
12+
| --------| -------------|---------------|--------------|
13+
| + | GPIO4 | GPIO2 | GPIO2 |
14+
| - | GND | | |
1515

src/AudioPWM/PWMAudioStreamBase.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,12 @@ struct PWMConfig {
3737
uint8_t buffers = PWM_BUFFERS;
3838

3939
// additinal info
40-
uint16_t start_pin = PWM_START_PIN;
4140
uint32_t pwm_frequency = PWM_FREQUENCY; // audable range is from 20 to 20,000Hz (not used by ESP32)
4241
uint8_t resolution = 8; // Only used by ESP32: must be between 8 and 11 -> drives pwm frequency
4342
uint8_t timer_id = 0; // Only used by ESP32 must be between 0 and 3
43+
44+
#ifndef __AVR__
45+
uint16_t start_pin = PWM_START_PIN;
4446

4547
// define all pins by passing an array and updates the channels by the number of pins
4648
template<size_t N>
@@ -55,12 +57,13 @@ struct PWMConfig {
5557
start_pin = -1; // mark start pin as invalid
5658
}
5759

60+
#endif
61+
5862
void logConfig(){
5963
LOGI("sample_rate: %d", sample_rate);
6064
LOGI("channels: %d", channels);
6165
LOGI("bits_per_sample: %d", bits_per_sample);
6266
LOGI("buffer_size: %d", buffer_size);
63-
LOGI("start_pin: %d", start_pin);
6467
LOGI("pwm_frequency: %d", pwm_frequency);
6568
//LOGI("resolution: %d", resolution);
6669
//LOGI("timer_id: %d", timer_id);

0 commit comments

Comments
 (0)