8000 docs/library/machine: Update PWM to match rp2 implementation. · micropython/micropython@2f61244 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2f61244

Browse files
committed
docs/library/machine: Update PWM to match rp2 implementation.
Signed-off-by: Damien George <damien@micropython.org>
1 parent fe17ec1 commit 2f61244

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

docs/library/machine.PWM.rst

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,35 @@ Methods
6161

6262
Disable the PWM output.
6363

64+
.. method:: PWM.freq([value])
65+
66+
Get or set the current frequency of the PWM output.
67+
68+
With no arguments the frequency in Hz is returned.
69+
70+
With a single *value* argument the frequency is set to that value in Hz. The
71+
method may raise a ``ValueError`` if the frequency is outside the valid range.
72+
6473
.. method:: PWM.duty_ticks(ticks)
6574

6675
Change the duty cycle of the output, with the argument *ticks* measured in
6776
``ticks_hz`` as set by the constructor or ``PWM.init``. For example, if
6877
``ticks_hz`` is 1000 then *ticks* is measured in milliseconds.
6978

70-
.. method:: PWM.duty_u16(u16)
79+
.. method:: PWM.duty_u16([value])
80+
81+
Get or set the current duty cycle of the PWM output, as an unsigned 16-bit
82+
value in the range 0 to 65535 inclusive.
83+
84+
With no arguments the duty cycle is returned.
85+
86+
With a single *value* argument the duty cycle is set to that value, measured
87+
as the ratio ``value / 65535``.
88+
89+
.. method:: PWM.duty_ns([value])
90+
91+
Get or set the current duty cycle of the PWM output, as a value in nanoseconds.
92+
93+
With no arguments the duty cycle in nanoseconds is returned.
7194

72-
Change the duty cycle of the output, measured as the ratio ``u16 / 65535``.
95+
With a single *value* argument the duty cycle is set to that value.

0 commit comments

Comments
 (0)
0