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 <rodrigo.garcia@espressif.com>
Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
This commit is contained in:
Vasko 2022-07-20 14:15:16 +02:00 committed by GitHub
parent e55a1bebf0
commit cc8f4e5af6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 0 deletions

View File

@ -226,3 +226,7 @@ void analogWrite(uint8_t pin, int value) {
ledcWrite(pin_to_channel[pin] - 1, value);
}
}
int8_t analogGetChannel(uint8_t pin) {
return pin_to_channel[pin] - 1;
}

View File

@ -92,6 +92,7 @@ void yield(void);
#include "esp32-hal-cpu.h"
void analogWrite(uint8_t pin, int value);
int8_t analogGetChannel(uint8_t pin);
//returns chip temperature in Celsius
float temperatureRead();