8000 mimxrt: Adapt for the changed pin file creation of PR 12211. · micropython/micropython@2ecbf50 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2ecbf50

Browse files
committed
mimxrt: Adapt for the changed pin file creation of PR 12211.
Signed-off-by: robert-hh <robert@hammelrath.com>
1 parent d6b2278 commit 2ecbf50

File tree

4 files changed

+19
-15
lines changed

4 files changed

+19
-15
lines changed

docs/library/machine.QECNT.rst

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Example usage::
1313

1414
from machine import Pin, Encoder
1515

16-
qe = Encoder(0, Pin(0), Pin(1)) # create Quadrature Encoder object
16+
qe = Encoder(0, Pin("D0"), Pin("D1")) # create Quadrature Encoder object
1717
qe.value() # get current counter values
1818
qe.value(0) # Set value and cycles to 0
1919
qe.init(cpc=128) # Specify 128 counts/cycle
@@ -177,7 +177,7 @@ Example usage::
177177

178178
from machine import Pin, Counter
179179

180-
counter = Counter(0, Pin(0)) # create Counter object
180+
counter = Counter(0, Pin("D0")) # create Counter object
181181
counter.value() # get current counter value
182182
counter.value(0) # Set the counter to 0
183183
counter.init(cpc=128) # Specify 128 counts/cycle
@@ -352,20 +352,21 @@ assignment to the Encoder or Counter are:
352352

353353
**Teensy 4.0**:
354354

355-
Pins 0, 1, 2, 3, 4, 5, 7, 8, 26, 27, 30, 31, 32, 33. Pin 0 and 5 share the
356-
same signal and cannot be used independently.
357-
Pins 26, 27, 30 and 31 cannot be used for the match output.
355+
Pins D0, D1, D2, D3, D4, D5, D7, D8, D26, D27, D30, D31, D32, D33.
356+
Pin D0 and D5 share the same signal and cannot be used independently.
357+
Pins D26, D27, D30 and D31 cannot be used for the match output.
358358

359359
**Teensy 4.1**:
360360

361-
Pins 0, 1, 2, 3, 4, 5, 7, 8, 26, 27, 30, 31, 32, 33, 37, 42, 43, 44, 45, 46 and 47.
362-
Pins 26, 27, 30 and 31 cannot be used for the match output.
361+
Pins D0, D1, D2, D3, D4, D5, D7, D8, D26, D27, D30, D31, D32, D33,
362+
D37, D42, D43, D44, D45, D46 and D47.
363+
Pins D26, D27, D30 and D31 cannot be used for the match output.
363364
Some pins are assigned to the same signal and cannot be used independently. These are:
364365

365-
- Pin 0, 5 and 37,
366-
- Pin 2 and 43,
367-
- Pin 3 and 42, and
368-
- Pin 4 and 47.
366+
- Pins D0, D5 and D37,
367+
- Pins D2 and D43,
368+
- Pins D3 and D42, and
369+
- Pins D4 and D47.
369370

370371
**Seeed ARCH MIX**
371372

docs/mimxrt/quickref.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ Example usage::
554554

555555
from machine import Pin, Encoder
556556

557-
qe = Encoder(0, Pin(0), Pin(1)) # create Quadrature Encoder object
557+
qe = Encoder(0, Pin("D0"), Pin("D1")) # create Quadrature Encoder object
558558
qe.value() # get current counter values
559559
qe.value(0) # set value and cycles to 0
560560
qe.init(cpc=128) # specify 128 counts/cycle
@@ -583,7 +583,7 @@ Example usage::
583583

584584
from machine import Pin, Counter
585585

586-
counter = Counter(0, Pin(0)) # create Counter object
586+
counter = Counter(0, Pin("D0")) # create Counter object
587587
counter.value() # get current counter value
588588
counter.value(0) # set the counter to 0
589589
counter.init(cpc=128) # specify 128 counts/cycle

ports/mimxrt/boards/make-pins.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
r"IOMUXC_(?P<pin>GPIO_SNVS_\d\d_DIG)_(?P<function>\w+) (?P<muxRegister>\w+), (?P<muxMode>\w+), (?P<inputRegister>\w+), (?P<inputDaisy>\w+), (?P<configRegister>\w+)",
2727
]
2828

29-
SUPPORTED_AF_FNS = {"GPIO", "USDHC", "FLEXPWM", "TMR"}
29+
SUPPORTED_AF_FNS = {"GPIO", "USDHC", "FLEXPWM", "TMR", "XBAR"}
3030

3131

3232
class MimxrtPin(boardgen.Pin):
@@ -183,7 +183,7 @@ def load_inputs(self, out_source):
183183
# the CMD pin of the USDHC1 function on the GPIO_SD_B0_00 pin.
184184
def print_module_instances(self, out_header):
185185
print(file=out_header)
186-
for match_fn in ("USDHC", "FLEXPWM", "TMR"):
186+
for match_fn in ("USDHC", "FLEXPWM", "TMR", "XBAR"):
187187
module_instances = defaultdict(list)
188188
for pin in self.available_pins():
189189
for i, (_af_idx, _input_reg, _input_daisy, instance, fn, af) in enumerate(
@@ -200,6 +200,8 @@ def print_module_instances(self, out_header):
200200
print("#define {:s}_AVAIL (1)".format(k), file=out_header)
201201
if match_fn == "FLEXPWM":
202202
print("#define {:s} {:s}".format(k, k[-4:]), file=out_header)
203+
if match_fn == "XBAR":
204+
print("#define {:s} {:s}A1".format(k, k[:4]), file=out_header)
203205
for i in v:
204206
print(i, file=out_header)
205207

ports/mimxrt/machine_encoder.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "py/mphal.h"
3232
#include "py/objint.h"
3333
#include "shared/runtime/mpirq.h"
34+
#include "extmod/modmachine.h"
3435
#include "modmachine.h"
3536
#include "fsl_clock.h"
3637
#include "fsl_enc.h"

0 commit comments

Comments
 (0)
0