Commit Graph

387 Commits

Author SHA1 Message Date
Scott Shawcroft
3ffab36cdc
Merge remote-tracking branch 'adafruit/main' into fix_samd_timer_leak 2021-08-13 15:20:25 -07:00
Scott Shawcroft
de796e2304
Move OneWire to onewireio from busio
This will allow finer grained inclusion in 8.0.0

Fixes #5135
2021-08-12 10:47:14 -07:00
Scott Shawcroft
0c1d6cef75
Merge remote-tracking branch 'adafruit/main' into fix_cp_irremote 2021-08-11 13:43:59 -07:00
Scott Shawcroft
7f016ae11e
Fix build with filter to do OR 2021-08-11 12:10:51 -07:00
Scott Shawcroft
b56455ffbb
Allow sleep while paused 2021-08-11 10:48:39 -07:00
Scott Shawcroft
67c6932ca2
Reset timers separate from pwmio
This prevents timer leakage on builds without pwmio.

Fixes #5057
2021-08-11 09:58:31 -07:00
Dan Halbert
2451c788f4 valid channels in audio_dma_stop; cleaner supervisor_ticks mgmt in keypad 2021-08-09 09:47:13 -04:00
Dan Halbert
59b89fdc5c Fix various audio DMA issues:
RP2040 and SAMD51:
- Detect when DMA has finished, and stop DMA audio explicitly.
- Do not accidentally reuse `first_buffer` supplied by WaveFile or RawSample. Always realloc `first_buffer` and `second_buffer`

RP2040:
- When audio playing is stopped, write a final zero to the output register. This prevents residual PWM tones.
- Handle buffer size for 8-bit samples properly for 16-bit output.
- Fail on some edge cases (which may not be possible at the moment).
2021-08-09 09:47:13 -04:00
Dan Halbert
fd71d924d2 partial buffer mgmt fix 2021-08-09 09:47:13 -04:00
Scott Shawcroft
412eb87080
Switch to pin, frequency and duty_cycle PulseOut
Passing in a PWMOut still works but is deprecated. It will be
removed in CircuitPython 8.0.0

This also switches STM32 timer indices and channel indices to
0-based in our pin data rather than `- 1` everywhere. The latter is
more bug prone.

Most of the way for #3264

Tested on Metro M0, Metro M4, Feather S2, Feather nRF52840, Feather
STM32F4 and Arduino RP2040.
2021-07-26 18:35:49 -07:00
Scott Shawcroft
fece0fb432
Fix crash when UART construct fails
After the script stops with the exception thrown the final gc_sweep
will call any finalizers and they usually call deinit. deinit on
invalid objects can wreak havoc by changing random memory or
(hopefully) crashing. This fixes ensures the object is deinited
until initialization succeeds and the object is valid.

Do the same fix for I2C and SPI too.

Fixes #4700 and fixes #5005
2021-07-20 17:15:19 -07:00
Scott Shawcroft
ca2cb9af2b
Remove MICROPY_PORT_* macros used for never reset
Now we use never_reset which is generally more correct and easier
to get right.

Fixes #5001 and fixes #4997
2021-07-15 16:20:04 -07:00
BoB LeSuer
35030fbb30 added pin object to analogout 2021-07-12 20:33:42 -04:00
Jeff Epler
268717e427 ParallelImageCapture: Switch to taking a list of pins
.. adopting validate_pins from RGBMatrix into shared-bindings

.. updating other platforms for API change
2021-06-10 11:15:18 -05:00
Jeff Epler
26a75f74ec
Merge pull request #4862 from DavePutz/issue_3383
Fix for issue #3383 - SAMD5x microcontroller.cpu.voltage
2021-06-09 14:42:27 -05:00
root
bc34403d71 Removed all references to MICROCONTROLLER_VOLTAGE_DISABLE 2021-06-09 10:46:14 -05:00
root
b2dea8ae0d Fix for issue #3383 - SAMD51 microcontroller.cpu.voltage 2021-06-05 16:17:14 -05:00
Jeff Epler
6b476c19ba fix formatting 2021-05-29 08:10:10 -05:00
Jeff Epler
b0dd0e344c
Merge pull request #4772 from EmergReanimator/atmel-samd
[resolves #4771] DEBUG UART supported on ATMSAME5x
2021-05-28 20:05:06 -06:00
EmergReanimator
7805392b9e
Update UART.c
Incorporating feedback: https://github.com/adafruit/circuitpython/pull/4772#discussion_r634112839
2021-05-19 20:19:16 +02:00
EmergReanimator
2b64b1d335 [resolves #4771] DEBUG UART supported on ATMSAME5x 2021-05-17 21:22:24 +02:00
Scott Shawcroft
5c33c9d597
Fix SAMD
RTC needed to wait for sync. NeoPixel on SAMD doesn't need disabled
caches. It just needed timing adjustment for 120mhz clock speed.
2021-05-14 16:14:24 -07: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
Dan Halbert
d2b558993e merge from main, including MicroPython 1.12 merge 2021-05-03 20:56:04 -04:00
Dan Halbert
9ca0e689a5
Merge branch 'main' into wio_add_pin_assign 2021-05-03 09:33:18 -04:00
Jeff Epler
dfa7c3d32d codeformat: Fix handling of **
After discussing with danh, I noticed that `a/**/b` would not match `a/b`.

After correcting this and re-running "pre-commit run --all", additional
files were reindented, including the codeformat script itself.
2021-04-30 15:30:13 -05:00
Jeff Epler
e95e921ca1 codeformat: Fix filename matching
In #4683, tannewt noticed that uncrustify was not running on some
file in common-hal.

I investigated and found that it was not being run on a bunch of paths.

Rather than make incremental changes, I rewrote list_files to work
bsaed on regular expressions; these regular expressions are created from
the same git-style glob patterns.

I spot-checked some specific filenames after this change, and all looks good:

```
$ python3 tools/codeformat.py -v --dry-run tests/basics/int_small.py ports/raspberrypi/common-hal/pulseio/PulseIn.c extmod/virtpin.c tests/thread/thread_exit1.py  ports/raspberrypi/background.h extmod/re1.5/recursiveloop.c
tools/codeformat.py -v --dry-run tests/basics/int_small.py ports/raspberrypi/common-hal/pulseio/PulseIn.c extmod/virtpin.c tests/thread/thread_exit1.py ports/raspberrypi/background.h extmod/re1.5/recursiveloop.c
uncrustify -c /home/jepler/src/circuitpython/tools/uncrustify.cfg -lC --no-backup extmod/virtpin.c ports/raspberrypi/background.h ports/raspberrypi/common-hal/pulseio/PulseIn.c
black --fast --line-length=99 -v tests/thread/thread_exit1.py
```
recursiveloop and int_small are excluded, while PulseIn, virtpin,
and background are included.

Testing running from a subdirectory (not _specifically_ supported though):
```
(cd ports && python3 ../tools/codeformat.py -v --dry-run raspberrypi/common-hal/pulseio/PulseIn.c ../extmod/virtpin.c)
../tools/codeformat.py -v --dry-run raspberrypi/common-hal/pulseio/PulseIn.c ../extmod/virtpin.c
uncrustify -c /home/jepler/src/circuitpython/tools/uncrustify.cfg -lC --no-backup ../extmod/virtpin.c raspberrypi/common-hal/pulseio/PulseIn.
```

As a side-effect, a bunch more files are re-formatted now. :-P
2021-04-30 10:48:08 -05:00
Dan Halbert
be7b2b00a8 uncrustify with newer version of uncrustify 2021-04-30 10:40:12 -04:00
Tsutomu IKEGAMI
0d25b95f0d Add definitions of PB2[4-9] pins to microcontroller.pin for atmel-samd. 2021-04-29 02:19:34 +09:00
Dan Halbert
9d1fcc3b14 merge from main 2021-04-25 10:27:52 -04:00
Mark
ed374a89fb
Merge pull request #4655 from DavePutz/issue_4602
Issue 4602 - Correct timing of PulseOut on SAMD21
2021-04-24 10:45:10 -05:00
Jeff Epler
34c4cc1bd9 samd: Rename dma_{allocate,free} channel
These are now used in the (video) parallel capture device as well.
2021-04-23 09:46:33 -05:00
Dan Halbert
64e0958916 wip: descriptor building 2021-04-21 23:25:36 -04:00
root
0e2431048d Fix PWMOut on SAMD21 2021-04-20 15:21:05 -05:00
Jeff Epler
46c9b1bc37 atmel-sam: Use DMA for ParallelImageCapture
This allows ctrl-c to interrupt the capture, and ensures we handle
interrupts & background tasks.
2021-04-20 13:52:44 -05:00
Jeff Epler
d50feebd2c atmel-sam: Factor out find_sync_event_channel_raise 2021-04-20 13:33:11 -05:00
Jeff Epler
4dcbdac97e Complete the 'horizontal_reference' rename 2021-04-20 11:33:32 -05:00
Jeff Epler
5c5736ee1e atmel-sam: Allow PWM to go up to cpu_frequency/2
24MHz is the nominal external clock to use with OV7670.  (My testing
was actually at 16MHz)
2021-04-20 10:22:21 -05:00
Jeff Epler
99799cded6 imagecapture: implement to review suggestions 2021-04-20 10:21:32 -05:00
Jeff Epler
fc4538f845 WIP: Implement 'ParallelImageCapture' for samd51 2021-04-16 17:18:59 -05:00
Dan Halbert
61e33a5619 fix nrf ISR; make direction consistent across ports; save code size 2021-04-09 11:07:47 -04:00
Jeff Epler
3aec1032f7 atmel-samd: switch to shared softencoder implementation 2021-04-08 16:32:36 -05:00
gamblor21
0890b54cd9 More formatting 2021-03-16 08:29:04 -05:00
gamblor21
fb437d8280 Formatting fixes 2021-03-16 08:22:02 -05:00
Mark
e326d7ca80
Merge branch 'main' into rp_dp_parallel 2021-03-15 20:00:13 -05:00
microDev
a52eb88031
run code formatting script 2021-03-15 19:27:36 +05:30
gamblor21
56a219911f Add frequency support to parallel bus 2021-03-11 19:32:43 -06:00
jposada202020
be90fa80e8 Initial Changes 2021-03-09 10:48:33 -05:00
Jeff Epler
1d1ff5f308 Merge remote-tracking branch 'origin/main' into update-protomatter-rp2 2021-02-26 09:56:35 -06:00
Jeff Epler
ff1942cff6 Enable protomatter on RP2040 builds
Also found a race condition between timer_disable and redraw, which
would happen if I debugger-paused inside common_hal_rgbmatrix_timer_disable
or put a delay or print inside it.  That's what pausing inside reconstruct
fixes.

So that the "right timer" can be chosen, `timer_allocate` now gets the `self`
pointer.  It's guaranteed at this point that the pin information is accurate,
so you can e.g., find a PWM unit related to the pins themselves.
This required touching each port to add the parameter even though it's
unused everywhere but raspberrypi.
2021-02-12 08:25:15 -06:00