diff --git a/docs/library/machine.QECNT.rst b/docs/library/machine.QECNT.rst index 4fe344777d..83ee6bb1c9 100644 --- a/docs/library/machine.QECNT.rst +++ b/docs/library/machine.QECNT.rst @@ -13,7 +13,7 @@ Example usage:: from machine import Pin, Encoder - qe = Encoder(0, Pin(0), Pin(1)) # create Quadrature Encoder object + qe = Encoder(0, Pin("D0"), Pin("D1")) # create Quadrature Encoder object qe.value() # get current counter values qe.value(0) # Set value and cycles to 0 qe.init(cpc=128) # Specify 128 counts/cycle @@ -177,7 +177,7 @@ Example usage:: from machine import Pin, Counter - counter = Counter(0, Pin(0)) # create Counter object + counter = Counter(0, Pin("D0")) # create Counter object counter.value() # get current counter value counter.value(0) # Set the counter to 0 counter.init(cpc=128) # Specify 128 counts/cycle @@ -352,20 +352,21 @@ assignment to the Encoder or Counter are: **Teensy 4.0**: - Pins 0, 1, 2, 3, 4, 5, 7, 8, 26, 27, 30, 31, 32, 33. Pin 0 and 5 share the - same signal and cannot be used independently. - Pins 26, 27, 30 and 31 cannot be used for the match output. + Pins D0, D1, D2, D3, D4, D5, D7, D8, D26, D27, D30, D31, D32, D33. + Pin D0 and D5 share the same signal and cannot be used independently. + Pins D26, D27, D30 and D31 cannot be used for the match output. **Teensy 4.1**: - Pins 0, 1, 2, 3, 4, 5, 7, 8, 26, 27, 30, 31, 32, 33, 37, 42, 43, 44, 45, 46 and 47. - Pins 26, 27, 30 and 31 cannot be used for the match output. + Pins D0, D1, D2, D3, D4, D5, D7, D8, D26, D27, D30, D31, D32, D33, + D37, D42, D43, D44, D45, D46 and D47. + Pins D26, D27, D30 and D31 cannot be used for the match output. Some pins are assigned to the same signal and cannot be used independently. These are: - - Pin 0, 5 and 37, - - Pin 2 and 43, - - Pin 3 and 42, and - - Pin 4 and 47. + - Pins D0, D5 and D37, + - Pins D2 and D43, + - Pins D3 and D42, and + - Pins D4 and D47. **Seeed ARCH MIX** diff --git a/docs/mimxrt/quickref.rst b/docs/mimxrt/quickref.rst index eef0934530..17d1c170b1 100644 --- a/docs/mimxrt/quickref.rst +++ b/docs/mimxrt/quickref.rst @@ -552,7 +552,7 @@ Example usage:: from machine import Pin, Encoder - qe = Encoder(0, Pin(0), Pin(1)) # create Quadrature Encoder object + qe = Encoder(0, Pin("D0"), Pin("D1")) # create Quadrature Encoder object qe.value() # get current counter values qe.value(0) # set value and cycles to 0 qe.init(cpc=128) # specify 128 counts/cycle @@ -581,7 +581,7 @@ Example usage:: from machine import Pin, Counter - counter = Counter(0, Pin(0)) # create Counter object + counter = Counter(0, Pin("D0")) # create Counter object counter.value() # get current counter value counter.value(0) # set the counter to 0 counter.init(cpc=128) # specify 128 counts/cycle diff --git a/ports/mimxrt/boards/make-pins.py b/ports/mimxrt/boards/make-pins.py index 55c7f5bd02..3a76306e9a 100644 --- a/ports/mimxrt/boards/make-pins.py +++ b/ports/mimxrt/boards/make-pins.py @@ -26,7 +26,7 @@ IOMUX_REGEXS = [ r"IOMUXC_(?PGPIO_SNVS_\d\d_DIG)_(?P\w+) (?P\w+), (?P\w+), (?P\w+), (?P\w+), (?P\w+)", ] -SUPPORTED_AF_FNS = {"GPIO", "USDHC", "FLEXPWM", "TMR"} +SUPPORTED_AF_FNS = {"GPIO", "USDHC", "FLEXPWM", "TMR", "XBAR"} class MimxrtPin(boardgen.Pin): @@ -183,7 +183,7 @@ class MimxrtPinGenerator(boardgen.PinGenerator): # the CMD pin of the USDHC1 function on the GPIO_SD_B0_00 pin. def print_module_instances(self, out_header): print(file=out_header) - for match_fn in ("USDHC", "FLEXPWM", "TMR"): + for match_fn in ("USDHC", "FLEXPWM", "TMR", "XBAR"): module_instances = defaultdict(list) for pin in self.available_pins(): for i, (_af_idx, _input_reg, _input_daisy, instance, fn, af) in enumerate( @@ -200,6 +200,8 @@ class MimxrtPinGenerator(boardgen.PinGenerator): print("#define {:s}_AVAIL (1)".format(k), file=out_header) if match_fn == "FLEXPWM": print("#define {:s} {:s}".format(k, k[-4:]), file=out_header) + if match_fn == "XBAR": + print("#define {:s} {:s}A1".format(k, k[:4]), file=out_header) for i in v: print(i, file=out_header) diff --git a/ports/mimxrt/machine_encoder.c b/ports/mimxrt/machine_encoder.c index f234bb2fce..24c258c872 100644 --- a/ports/mimxrt/machine_encoder.c +++ b/ports/mimxrt/machine_encoder.c @@ -31,6 +31,7 @@ #include "py/mphal.h" #include "py/objint.h" #include "shared/runtime/mpirq.h" +#include "extmod/modmachine.h" #include "modmachine.h" #include "fsl_clock.h" #include "fsl_enc.h"