diff options
| author | Ayush Singh <ayush@beagleboard.org> | 2024-10-19 13:13:39 +0530 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2025-04-30 00:29:55 +1000 |
| commit | c9c39b88afe1d51b9bb4984cb19b787ac5834c52 (patch) | |
| tree | 4da8cc3798696672f20949751266ad5bf6970e3c | |
| parent | f4a7e713ea8b374de04c471d877e442bf6ff48e8 (diff) | |
docs/zephyr: Add quick reference for PWM support.
Add docs for PWM support.
Signed-off-by: Ayush Singh <ayush@beagleboard.org>
| -rw-r--r-- | docs/zephyr/quickref.rst | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/docs/zephyr/quickref.rst b/docs/zephyr/quickref.rst index 63d4bced0..a7ae69860 100644 --- a/docs/zephyr/quickref.rst +++ b/docs/zephyr/quickref.rst @@ -56,6 +56,21 @@ Use the :ref:`machine.Pin <machine.Pin>` class:: switch = Pin(("gpioc", 6), Pin.IN) # create input pin for a switch switch.irq(lambda t: print("SW2 changed")) # enable an interrupt when switch state is changed +PWM +--- + +Use the :ref:`machine.PWM <machine.PWM>` class:: + + from machine import PWM + + pwm = PWM(("pwm0", 0), freq=3921568, duty_ns=200, invert=True) # create pwm on PWM0 + print(pwm) # print pwm + + print(pwm.duty_ns()) # print pwm duty cycle in nanoseconds + pwm.duty_ns(255) # set new pwm duty cycle in nanoseconds + + pwm.deinit() + Hardware I2C bus ---------------- |
