Skip to content

Commit cc8f4e5

Browse files
VasilyRakcheSuGliderP-R-O-C-H-Y
authored
Allow access to the PWM channel assigned to the Pin. Opportunity to change PWM configurations (#6992)
* Get channel assigned to the pin with analogWrite * Respect coding standard in LEDC source file Co-authored-by: Rodrigo Garcia <[email protected]> Co-authored-by: Jan Procházka <[email protected]>
1 parent e55a1be commit cc8f4e5

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

Diff for: cores/esp32/esp32-hal-ledc.c

+4
Original file line numberDiff line numberDiff line change
@@ -226,3 +226,7 @@ void analogWrite(uint8_t pin, int value) {
226226
ledcWrite(pin_to_channel[pin] - 1, value);
227227
}
228228
}
229+
230+
int8_t analogGetChannel(uint8_t pin) {
231+
return pin_to_channel[pin] - 1;
232+
}

Diff for: cores/esp32/esp32-hal.h

+1
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ void yield(void);
9292
#include "esp32-hal-cpu.h"
9393

9494
void analogWrite(uint8_t pin, int value);
95+
int8_t analogGetChannel(uint8_t pin);
9596

9697
//returns chip temperature in Celsius
9798
float temperatureRead();

0 commit comments

Comments
 (0)