Commit Graph

7562 Commits

Author SHA1 Message Date
Jeff Epler 8e8c44afea Merge remote-tracking branch 'origin/main' into alphablend 2021-11-05 11:24:51 -05:00
Jeff Epler d532ad388b disable framebufferio so bitmaptools can fit 2021-11-05 11:24:03 -05:00
Jeff Epler 334a9c85ce Merge remote-tracking branch 'origin/main' into gifio 2021-11-04 20:22:00 -05:00
Scott Shawcroft a08412420e
Merge pull request #5540 from jepler/continuous-capture
ParallelImageCapture: Add continuous capture on espressif
2021-11-04 13:33:32 -07:00
Scott Shawcroft 0dfb7a9a2d
Merge pull request #5541 from DavePutz/issue_5477
Corrected number of serial bytes returned
2021-11-03 16:53:15 -07:00
root 1e3215f4ee Corrected number of serial bytes returned 2021-11-03 16:29:05 -05:00
Jeff Epler a8614a61dc ParallelImageCapture: Add continuous capture on espressif
By having a pair of buffers, the capture hardware can fill one buffer while
Python code (including displayio, etc) operates on the other buffer.  This
increases the responsiveness of camera-using code.

On the Kaluga it makes the following improvements:
 * 320x240 viewfinder at 30fps instead of 15fps using directio
 * 240x240 animated gif capture at 10fps instead of 7.5fps

As discussed at length on Discord, the "usual end user" code will look like
this:

    camera = ...

    with camera.continuous_capture(buffer1, buffer2) as capture:
        for frame in capture:
            # Do something with frame

However, rather than presenting a context manager, the core code consists of
three new functions to start & stop continuous capture, and to get the next
frame.  The reason is twofold.  First, it's simply easier to implement the
context manager object in pure Python.  Second, for more advanced usage, the
context manager may be too limiting, and it's easier to iterate on the right
design in Python code.  In particular, I noticed that adapting the
JPEG-capturing programs to use continuous capture mode needed a change in
program structure.

The camera app was structured as
```python
while True:
    if shutter button was just pressed:
        capture a jpeg frame
    else:
        update the viewfinder
```

However, "capture a jpeg frame" needs to (A) switch the camera settings and (B)
capture into a different, larger buffer then (C) return to the earlier
settings. This can't be done during continuous capture mode. So just
restructuring it as follows isn't going to work:

```python
with camera.continuous_capture(buffer1, buffer2) as capture:
    for frame in capture:
        if shutter button was just pressed:
            capture a jpeg frame, without disturbing continuous capture mode
        else:
            update the viewfinder
```

The continuous mode is only implemented in the espressif port; others
will throw an exception if the associated methods are invoked.  It's not
impossible to implement there, just not a priority, since these micros don't
have enough RAM for two framebuffer copies at any resonable sizes.

The capture code, including single-shot capture, now take mp_obj_t in the
common-hal layer, instead of a buffer & length.  This was done for the
continuous capture mode because it has to identify & return to the user the
proper Python object representing the original buffer.  In the Espressif port,
it was convenient to implement single capture in terms of a multi-capture,
which is why I changed the singleshot routine's signature too.
2021-11-03 11:02:46 -05:00
Dan Halbert 38c381633b
Merge pull request #5534 from jepler/add-rainbowio
Add rainbowio
2021-11-02 21:57:08 -04:00
Jeff Epler 63e01cde77 we decided not to add rainbowio on simmel 2021-11-02 19:01:05 -05:00
Jeff Epler 18eaee9beb reenable RAINBOWIO on these boards 2021-11-01 12:52:13 -05:00
Kong Wai Weng 36459c8a5a Fixed whitespace issues. 2021-11-01 16:50:46 +08:00
Kong Wai Weng e0332c1e49 Using 4x spaces instead of a tab. 2021-11-01 16:47:02 +08:00
Kong Wai Weng b64ec36418 Using GP0 as default LED pin. 2021-11-01 16:43:13 +08:00
Kong Wai Weng 0034472778 Reversal of PR #4981. GPIO25 on Maker Pi RP2040 is not connected to anything. 2021-11-01 16:26:40 +08:00
Scott Shawcroft bf0bef9684
Split listdir entries across two packets
when the MTU of the BLE connection is smaller than the 28 bytes of
the header. (The smallest possible MTU is 20.)

Fixes #5511
2021-10-28 10:57:16 -07:00
Dan Halbert c61ab864da
Update ports/espressif/boards/adafruit_feather_esp32s2/board.c 2021-10-26 17:14:23 -04:00
Limor "Ladyada" Fried 037d893923
Update ports/espressif/boards/adafruit_feather_esp32s2/pins.c
Co-authored-by: Dan Halbert <halbert@halwitz.org>
2021-10-26 15:55:18 -04:00
Limor "Ladyada" Fried ccb6c5e5a9
Update ports/espressif/boards/adafruit_feather_esp32s2/mpconfigboard.h
Co-authored-by: Dan Halbert <halbert@halwitz.org>
2021-10-26 15:55:11 -04:00
Limor "Ladyada" Fried 5e59fa65ec
Update ports/espressif/boards/adafruit_feather_esp32s2/mpconfigboard.mk
Co-authored-by: Dan Halbert <halbert@halwitz.org>
2021-10-26 15:54:49 -04:00
Jeff Epler b881aec4c5 disable gifio on meowbit 2021-10-26 14:24:11 -05:00
lady ada 613f314857 will delete later 2021-10-26 15:09:05 -04:00
lady ada ba4e9797c7 add a nuuuuuboard 2021-10-26 15:05:10 -04:00
Jeff Epler 3e020a73a8 Disable gifio if no displayio & for small boards
Technically all gifio needs from displayio is the definition of
colorspaces, but let's just disable it for now.
2021-10-26 08:54:18 -05:00
Jeff Epler 8c7760b1a6 don't include gifio on samd21 boards 2021-10-26 08:54:18 -05:00
Jeff Epler c34b6f757f Implement gifio.GifWriter
This involves:
 * Adding a new "L8" colorspace for colorconverters
 * factoring out displayio_colorconverter_convert_pixel
 * Making a minimal "colorspace only" version of displayio for the
   unix port (testing purposes)
 * fixing an error message

I only tested writing B&W animated images, with the following script:
```python
import displayio
import gifio

with gifio.GifWriter("foo.gif", 64, 64, displayio.Colorspace.L8) as g:
    for i in range(0, 256, 14):
        data = bytes([i, 255-i] * 32 + [255-i, i] * 32) * 32
        print("add_frame")
        g.add_frame(data)

# expected to raise an error, buffer is not big enough
with gifio.GifWriter("/dev/null", 64, 64, displayio.Colorspace.L8) as g:
    g.add_frame(bytes([3,3,3]))
```
2021-10-26 08:54:18 -05:00
Dan Halbert e868f1b1fe
Merge pull request #5510 from jepler/cmd25-v2
sdcardio: Use CMD25 across multiple writeblocks() calls
2021-10-26 08:46:28 -04:00
Scott Shawcroft 5315348b11
Merge pull request #5425 from maholli/samd-sleep
functioning samd deep sleep ('alarm.time' & 'alarm.pin')
2021-10-25 14:42:12 -07:00
Scott Shawcroft de45382599
Merge pull request #5504 from solderparty/rp2040_stamp
Add the Solder Party RP2040 Stamp board
2021-10-25 14:08:04 -07:00
Jeff Epler d999a88e57 Drop Adafruit_CircuitPython_SD where sdcardio is enabled 2021-10-25 16:07:27 -05:00
Dan Halbert 7377375e8d
Merge pull request #5506 from maholli/nvm-toml-fix
NVM toml fix (MRAM)
2021-10-25 16:50:43 -04:00
Dan Halbert 644272ee8b
Merge pull request #5509 from DavePutz/issue_5469
Added reset of pulsein buffer pointer
2021-10-25 16:35:24 -04:00
root d2febfaf20 Added reset of pulsein buffer pointer 2021-10-24 20:46:18 -05:00
Max Holliday 339cf5ecf9 staying caught up with runtime changes 2021-10-24 15:49:14 -07:00
Max Holliday e45fe3d778
Merge branch 'adafruit:main' into samd-sleep 2021-10-24 15:46:07 -07:00
Pierre Constantineau 3425bcc910 added startup delay multiplier 2021-10-24 14:20:07 -06:00
Max Holliday adbff053ce fix QSPI_SINGLE pin definitions 2021-10-24 12:37:30 -07:00
arturo182 915275e5fd Add the Solder Party RP2040 Stamp board 2021-10-24 17:13:41 +02:00
Max Holliday 943f2b2085 remove interrupt_char.h 2021-10-23 09:01:40 -07:00
Pierre Constantineau 40326ab3f9 fix pre-commit 2021-10-22 18:35:38 -06:00
Pierre Constantineau d6e9e9c3c9 added neopixel to mpconfigboard.h 2021-10-22 18:32:21 -06:00
Max Holliday 397b2f6bb5 pin alarm configures pins again before deep sleep 2021-10-21 10:03:46 -07:00
Max Holliday e74a8e38fe
Merge branch 'adafruit:main' into samd-sleep 2021-10-21 09:52:55 -07:00
Scott Shawcroft cf4597c6db
Merge pull request #5484 from dhalbert/samd21-pdmin-fix
fix SAMD21 PDMIn DMA event use
2021-10-20 09:47:13 -07:00
Dan Halbert fc440e7609 move sercom_reset() etc. out of busio/SPI.c to busio/__init__.c 2021-10-19 15:18:32 -04:00
Jeff Epler 39795430a4
Apply suggestions from code review
Eliminates the "pet" function

Co-authored-by: Scott Shawcroft <scott@tannewt.org>
2021-10-19 13:25:28 -05:00
Dan Halbert 79ee78e690 fix SAMD21 PDMIn DMA event use 2021-10-19 13:18:14 -04:00
Jeff Epler d38cf05e59 samd51: Add watchdog timer 2021-10-19 10:52:14 -05:00
Jeff Epler 9eebb3dbab rotaryio: Add the ability to set the divisor
At present, Adafruit's rotary encoders all move 1 quadrature cycle per
detent, so we originally hard-coded division-by-4.  However, other
encoders exist, including ones without detents, ones with 2 detents per
cycle, and others with 4 detents per cycle.

The new `divisor` property and constructor argument allows selecting
a divisor of 1, 2, or 4; with the default of 4 giving backward
compatibility.

The property is not supported (yet?) on espressif MCUs; it throws an
error if a value other than 4 is set.
2021-10-16 09:43:45 -05:00
Dan Halbert 23d2c96476
Merge pull request #5466 from jepler/merge-1.17
Merge 1.17
2021-10-15 23:34:31 -04:00
Jeff Epler 414c2f9da6 Always use python3
.. similar to https://github.com/micropython/micropython/pull/4448
2021-10-15 15:11:21 -05:00