Skip to content

Commit 26ea6cb

Browse files
committed
mimxrt: Update the PWM and Encoder sections.
1 parent 39bb4b3 commit 26ea6cb

File tree

2 files changed

+42
-23
lines changed

2 files changed

+42
-23
lines changed

docs/mimxrt/machine.PWM.rst

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,15 @@ Methods
101101
:noindex:
102102

103103
Modify settings for the PWM object. See the above constructor for details
104-
about the parameters.
104+
about the parameters. Calling init() without any arguments restarts a stopped
105+
FLEXPWM submodule or QTMR channel with the same parameters as before.
106+
The restart latency is less than 10 µs and will start with a full cycle.
105107

106-
.. method:: PWM.deinit([mask])
108+
.. method:: PWM.deinit()
107109
:noindex:
108110

109-
Stop the PWM of the respective FLEXPWM submodule or QTMR channel. If a mask is specified,
110-
the bits of it designate the respective submodules or channels.
111+
Stops the PWM of the respective FLEXPWM submodule or QTMR channel after the
112+
actual cycle has been completed.
111113

112114
.. method:: PWM.freq([value])
113115
:noindex:

docs/mimxrt/machine.QECNT.rst

Lines changed: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ Example usage::
1414
from machine import Pin, Encoder
1515

1616
qe = Encoder(Pin(0), Pin(1)) # create Quadrature Encoder object
17-
qe.position() # get current counter values
18-
qe.position(0) # Set all counters to 0
17+
qe.value() # get current counter values
18+
qe.value(0) # Set value and revolution to 0
1919
qe.init(cycles=128) # Specify 128 cycles/revolution
2020
qe.init(index=Pin(3)) # Specify Pin 3 as Index pulse input
2121
qe.deinit() # turn off the Qudrature encoder
@@ -60,7 +60,6 @@ Constructors
6060
value up to init + cycles - 1, and then reset to the init value and increase
6161
the revolution counter by one. The default is: no cycles set. In that case the
6262
position counter overflows at 2**32 - 1.
63-
- *init*\=value. Sets the init value. The defaults value is 0.
6463
- *compare*\=value. Sets a position counter compare value. When the counter matches
6564
this value, a callback function can called and the match output will get a high level.
6665

@@ -78,20 +77,25 @@ Methods
7877
Stops the Encoder, disables interrupts and releases the resources used by the encoder. On
7978
Soft Reset, all instances of Encoder and Counter are deinitialized.
8079

81-
.. method:: Encoder.position([value])
80+
.. method:: Encoder.value([value])
8281

83-
Get or set the current counters of the Encoder as unsigned integers, with the position
84-
counter being a 32 bit item, and the revolution and difference counters being 16 bit
85-
items.
82+
Get or set the current position counter of the Encoder as unsigned 32 bit integer.
8683

87-
With no arguments the actual counter values are returned. If a cycles value is set,
88-
the values are returned as a tuple consisting of the position counter, the
89-
revolution counter and the difference of the position counter since
90-
the previous reading. If a cycles values not set, the position is returned as an
91-
48 bit unsigned integer of the total event count as **revolution \* 2\*\*32 + position**.
84+
With no arguments the actual position counter value is returned.
9285

93-
With a single *value* argument the position counter is set to that value. If a cycles value
94-
is set, the revolution counter and difference counter are cleared.
86+
With a single *value* argument the position counter is set to that value and the
87+
revolution counter is cleared.
88+
89+
.. method:: Encoder.revolution([value])
90+
91+
Get or set the current revolution counter of the Encoder as signed 16 bit integer.
92+
93+
With no arguments the actual revolution counter value is returned.
94+
95+
With a single *value* argument the revolution counter is set to that value. The
96+
position counter is not changed. A total position can be caluclated as
97+
revolution() * cycles + position() + init. If the total position range is still
98+
too small, you can create your own revolution counter using the irq() callback method.
9599

96100
.. method:: Encoder.compare([value])
97101

@@ -161,8 +165,8 @@ Example usage::
161165
from machine import Pin, Counter
162166

163167
counter = Counter(Pin(0)) # create Counter object
164-
counter.values() # get current counter value
165-
counter.values(0) # Set all counters to 0
168+
counter.value() # get current counter value
169+
counter.value(0) # Set the counter to 0
166170
counter.deinit() # turn off the Counter
167171
counter.init(compare=1000) # Set create a compare match event at count 1000
168172
counter.irq(Counter.COMPARE, handler) # Call the function handler at a compare match
@@ -214,13 +218,26 @@ Methods
214218
Stops the Counter, disables interrupts and releases the resources used by the encoder. On
215219
Soft Reset, all instances of Encoder and Counter are deinitialized.
216220

217-
.. method:: Counter.count([value])
221+
.. method:: Counter.value([value])
218222

219-
Get or set the current counter value of the Counter. The value is returned as a unsigned 48 bit
220-
integer.
223+
Get or set the current event value of the Counter. The value is returned as an
224+
unsigned 32 bit integer.
221225

222226
With a single *value* argument the counter is set to that value.
223227

228+
.. method:: Encoder.overflow([value])
229+
230+
Get or set the current revolution counter of the counter as signed 16 bit integer.
231+
The value represents the overflow or underflow events of the 32bit basic counter.
232+
A total count can be calculated as overflow() * 0x100000000 + count().
233+
If the total count range is still too small, you can create your own overflow
234+
counter using the irq() callback method.
235+
236+
With no arguments the actual overflow counter value is returned.
237+
238+
With a single *value* argument the overflow counter is set to that value. The
239+
event counter is not changed.
240+
224241
.. method:: Counter.compare([value])
225242

226243
Get or set the counter compare value.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy