Commit Graph

21 Commits

Author SHA1 Message Date
Jeff Epler df916e0484
Merge remote-tracking branch 'origin/main' into mimxrt10xx-rotaryio 2023-03-23 13:02:12 -05:00
Jeff Epler b235b50647
mimxrt: no longer need to collect the pin chainge interrupt ptrs
.. the objects on the gc heap are guaranteed to be alive, as their
finali(s/z)er will disable the interrupt.
2023-03-23 09:58:40 -05:00
Jeff Epler de74b63472
move pin change interrupt stuff to peripherals 2023-03-23 09:28:14 -05:00
Jeff Epler d247e5c6c9
Add the ability for a port to gc things, collect pin change objects that way 2023-03-23 09:16:00 -05:00
Jeff Epler 47e1abdbc7
Add IncrementalEncoder for mimxrt1011
.. and write a general 'pin change interrupt' facility to power it

This uses the same quadrature state machine as atmel-samd, nrf, and
rp2040. The 1011 doesn't have a dedicated encoder peripheral, so we
go the pin-change + software route.
2023-03-23 09:14:58 -05:00
Jeff Epler c6bc9c48c9
mimxrt10xx: implement i2sout
tested on metro m7 (green prototype version) with max98357a i2s amplifier and the following test code:
```py
import board
import time
import digitalio
from audiobusio import I2SOut
from audiocore import RawSample
from microcontroller import pin
from ulab import numpy as np

n = np.array(np.sin(np.linspace(0, np.pi*2, 218, endpoint=False)) * 200, dtype=np.int16)
print(n)
r = RawSample(n, sample_rate=8000, channel_count=2)
def main():
    with digitalio.DigitalInOut(board.LED) as l:
        l.switch_to_output(True)
        value = False
        while True:
            with I2SOut(pin.GPIO_06, pin.GPIO_07, pin.GPIO_04) as i:
                time.sleep(.01)
                l.value = value = not value
                i.play(r, loop=True)
                print(i.playing)
                time.sleep(.5)
                i.stop()
                print("STOPPED")
                print(i.playing)
                time.sleep(.5)
                i.play(r, loop=True)
                print(i.playing)
                print("PLAY AGAIN")
                time.sleep(.5)
            time.sleep(1)
```

Only stereo, 16-bit, raw samples were tested; the sample rate is actually fixed
at 48kHz in the core right now. There is more to do, but the basics work.

# Conflicts:
#	ports/mimxrt10xx/Makefile
#	ports/mimxrt10xx/mpconfigport.mk
2023-03-22 12:15:25 -05:00
RetiredWizard fa514e22b2 mimxrt10xx gpio pins don't deinit
It looks like a rogue "return" made it's way into the reset pin code
for the mimxrt10xx port resulting in pin.deinit() not working.
2023-01-05 19:17:08 -05:00
Dan Halbert b90a6413c2 refactor to reduce duplicate code 2022-12-15 13:17:28 -05:00
Dan Halbert 5c569f03c2 redo pin never resetting for mimxrt10xx 2022-12-14 19:34:26 -05:00
Scott Shawcroft 83593a1558
Start of USB host API
This allows you to list and explore connected USB devices. It
only stubs out the methods to communicate to endpoints. That will
come in a follow up once TinyUSB has it. (It's in progress.)

Related to #5986
2022-03-07 18:07:25 -08:00
Scott Shawcroft 1a0b4193b7
Simplify the status LED to save power
This also removes the need to pin share because we don't use the
status LED while user code is running.

The status flashes fallback to the HW_STATUS LED if no RGB LED is
present. Each status has a unique blink pattern as well.

One caveat is the REPL state. In order to not pin share, we set the
RGB color once. PWM and single color will be shutoff immediately but
DotStars and NeoPixels will hold the color until the user overrides
it.

Fixes #4133
2021-05-13 14:41:20 -07:00
microDev a52eb88031
run code formatting script 2021-03-15 19:27:36 +05:30
microDev dc332baa87
update common_hal_reset_pin() 2020-12-28 20:04:00 +05:30
Diego Elio Pettenò dd5d7c86d2 Fix up end of file and trailing whitespace.
This can be enforced by pre-commit, but correct it separately to make it easier to review.
2020-06-03 10:56:35 +01:00
Lucian Copeland 53fb699436 Add pin resetting across boards, fix array size detection issue 2020-05-27 11:45:15 -04:00
Lucian Copeland 38fd9c25f2 Re-add APA102 2020-05-19 15:33:34 -04:00
Lucian Copeland b310b04007 Remove pin/port distinction 2020-05-19 14:20:07 -04:00
Lucian Copeland 2acd173e14 Implement core requested changes 2020-05-19 13:54:47 -04:00
Lucian Copeland 99538c2414 Implement pin claiming, pin reset, and pin protections 2020-05-15 15:16:51 -04:00
arturo182 feac87901a mimxrt10xx: Enable displayio
Closes #2466
2020-02-19 22:26:00 +01:00
arturo182 13e0cba6f1 Add initial MIMXRT10XX port 2020-01-06 21:08:49 +01:00