esp32/machine_pwm: Implement duty_u16() and duty_ns() PWM methods.

The methods duty_u16() and duty_ns() are implemented to match the existing
docs.  The duty will remain the same when the frequency is changed.
Standard ESP32 as well as S2, S3 and C3 are supported.

Thanks to @kdschlosser for the fix for rounding in resolution calculation.

Documentation is updated and examples expanded for esp32, including the
quickref and tutorial.  Additional notes are added to the machine.PWM docs
regarding limitations of hardware PWM.
This commit is contained in:
IhorNehrutsa
2021-10-15 14:04:40 -07:00
committed by Damien George
parent a7fa18c203
commit b491967bbd
7 changed files with 449 additions and 139 deletions

View File

@@ -193,6 +193,8 @@ soft_reset_exit:
mp_hal_stdout_tx_str("MPY: soft reboot\r\n");
// deinitialise peripherals
machine_pwm_deinit_all();
// TODO: machine_rmt_deinit_all();
machine_pins_deinit();
machine_deinit();
usocket_events_deinit();