StefanBruens / ESP8266_new_pwm

This is a drop-in replacement for the ESP8266 SDK PWM
GNU General Public License v2.0
196 stars 46 forks source link

Fix conversion when COMPAT_MODE is set #26

Open perpernorbi opened 6 years ago

perpernorbi commented 6 years ago

The conversion was just backwards. In COMPAT_MODE, period value of 1000 corresponds to 1kHz, while, without COMPAT_MODE, 5000 corresponds to the same period. So when SDK_PWM_PERIOD_COMPAT_MODE is set, period should be multiplied by 5. For the same reason, duty needs to be divided by 5.