Fix remapping of ledcReadFreq

This commit is contained in:
Stephan Hadinger 2022-08-02 19:39:27 +02:00
parent f45cd5e905
commit abf352c8f8
4 changed files with 5 additions and 5 deletions

View File

@ -318,9 +318,8 @@ int32_t analogAttach(uint32_t pin, bool output_invert) { // returns ledc chan
return chan;
}
uint32_t ledcReadFreq2(uint8_t chan) {
// _Z13ledcReadFreqh
// extern "C" uint32_t _Z13ledcReadFreqh(uint8_t chan) {
// uint32_t ledcReadFreq2(uint8_t chan) {
extern "C" uint32_t __wrap_ledcReadFreq(uint8_t chan) {
if (chan > MAX_PWMS) {
return 0; // wrong channel
}

View File

@ -43,7 +43,7 @@
* So it all happens like if there were only 4 timers and a single group of PWM channels.
\*******************************************************************************************/
uint32_t ledcReadFreq2(uint8_t chan);
extern "C" uint32_t ledcReadFreq(uint8_t chan);
uint8_t ledcReadResolution(uint8_t chan);
//
// analogAttach - attach a GPIO to a hardware PWM

View File

@ -33,6 +33,7 @@ build_flags = ${esp_defaults.build_flags}
; wrappers for the crash-recorder
-Wl,--wrap=panicHandler -Wl,--wrap=xt_unhandled_exception
-Wl,--wrap=_Z11analogWritehi ; `analogWrite(unsigned char, int)` use the Tasmota version of analogWrite for deeper integration and phase control
-Wl,--wrap=ledcReadFreq ; `uint32_t ledcReadFreq(uint8_t chan)`
extra_scripts = pre:pio-tools/add_c_flags.py
post:pio-tools/post_esp32.py
${esp_defaults.extra_scripts}

View File

@ -85,7 +85,7 @@ void PwmApplyGPIO(bool force_update_all) {
int32_t chan = analogGetChannel2(pin);
uint32_t res = ledcReadResolution(chan);
uint32_t range = (1 << res) - 1;
uint32_t freq = ledcReadFreq2(chan);
uint32_t freq = ledcReadFreq(chan);
// AddLog(LOG_LEVEL_INFO, "PWM: res0=%i freq0=%i pin=%i chan=%i res=%i timer=%i range=%i freq=%i", timer0_resolution, timer0_freq, pin, chan, res, analogGetTimerForChannel(chan), range, freq);