Commit graph

1742 commits

Author SHA1 Message Date
Dan Halbert
eff544c16c espressif: get new I2C driver working
- Starts with @tannewt's changes.
- Make sure proper component is being compiled.
- Added `I2C.probe()` as a visible new method. This was a hidden common-hal method, but the C version of adafruit_bus_device could not use it because it needs to call probe via a Python method call. So make it visible. It's useful, and `I2C.scan()` could be phased out, since now `.scan()` can be implemented in Python with `.probe()`.
- set clock-stretching timeout on espressif to a minimum of 1 second. In all impls of busio.I2C()`, the timeout is ignored and is set to a fixed 1 second. @tannewt's new code was using the passed-in value, which was often too short.

To do:
- switch esp-camera to new-driver version. We have to use the same I2C driver everywhere.
- Check about I2CTarget.
2024-09-20 17:48:17 -04:00
Scott Shawcroft
e9f8ed41dc Switch to IDF 5.2 I2C API
Make busio.I2C use finalizers for reset instead of bulk reset. This
makes it easier to track and free the memory that the IDF allocates
internally for its "handle".
2024-09-19 14:47:45 -04:00
gamblor21
4da22c5634 Add mix parameter 2024-09-18 20:17:18 -05:00
RetiredWizard
32537edb09 esp32s3: Implement sdioio 2024-09-18 17:37:59 -04:00
gamblor21
ac5ccdba7a Renamed module 2024-09-17 17:52:44 -05:00
gamblor21
a950349180 Changes to properly handle samples 2024-09-17 17:52:44 -05:00
gamblor21
5e923038f3 Initial audio effects commit 2024-09-17 17:52:44 -05:00
Dan Halbert
1f68fffa13 merge from main 2024-09-10 16:36:32 -04:00
Dan Halbert
bc6f065447 working on compilation errors 2024-09-06 23:10:41 -04:00
James Bowman
73eb5944bf Extend EVE hardware opcodes for future-compatibility
Extend the bitfields of these instructions: BitmapHandle, ClearTag, Tag, BitmapSource, PaletteSource
Add instructions: BitmapSourceH PaletteSourceH

All the new bits and opcodes are ignored by earlier hardware, so this change is backwards-compatible.

Passes tests on all EVE hardware.
2024-09-06 10:53:05 -07:00
James Bowman
862ad62901 Make BitmapTransform* methods backwards-compatible
The setmodel() method controls the behavior
So existing code will continue to work unchanged
Subsequent releases of the ``eve`` library will call setmodel() to enable the new behavior
Confirmed all code paths on EVE hardware
2024-09-04 11:20:48 -07:00
19e5cf3d8f Avoid crashing when display components are deinitialized
Now, try_lock (SPI & I2C) & begin_transaction (display bus core) will check
that the related objects are still valid first; if they are not,
the lock/begin transaction will fail by returning false, rather than
"other things" such as raising a Python exception where it is not
permitted, accessing invalid memory, etc.

Closes #8278 and Closes #9426
2024-08-28 09:44:02 -05:00
Dan Halbert
e5e9c5ca84
Merge pull request #9469 from dhalbert/merge-from-micropython-v1.22.2
Merge from micropython v1.22.2
2024-08-21 18:11:19 -04:00
Scott Shawcroft
4950bebff0
Remove unique error messages
The two checks on self->type should be impossible to hit so they
are removed. Switch to `Invalid ...` for two others.
2024-08-13 09:41:23 -07:00
Scott Shawcroft
d9fcaa00ae
Merge pull request #9488 from wyrdsec/main
Driver for Pervasive Display's Aurora based E-ink display
2024-08-12 09:41:27 -07:00
wyrdsec
2a98af336c More pre-commit formating 2024-08-08 21:26:17 -04:00
wyrdsec
e416ac0570 pre-commit fixes 2024-08-08 20:37:49 -04:00
Scott Shawcroft
5376443f58
Add support for RP2350 to CircuitPython
This adds support for the next RP2 microcontroller, the RP2350.

Thanks to Raspberry Pi folks for early access and to @arturo182,
@oberchoo and @SalamCytron for helping with CircuitPython.
2024-08-08 09:54:51 -07:00
wyrdsec
6208124bd1
Merge branch 'adafruit:main' into main 2024-08-07 18:01:23 -04:00
Radomir Dopieralski
2c7b11b1af displayio.Bitmap is now byte-aligned for depth < 8
The traditional layout of pixels in bitmaps of depth less than eight
is with the order of values in a byte reversed, but with bytes in
the same order as the pixels on the line.

Before now, displayio.Bitmap did reverse the values, but did it on a
word (four bytes) basis, not byte, which resulted in groups of four
bytes being in the order opposite to the screen order.

This patch fixes this, by making processing of pixels in bitmaps of
depth less than 8 bits based on bytes, not words. Since the internal
details are changing, any code that accessed bitmaps through the
memoryview buffer, or that created bitmaps directly from raw data,
and that used depth of less than 8 bits will be affected.

Therefore, the gen_display_resources.py script also had to be modified
to account for the changes.
2024-08-05 23:14:55 +02:00
wyrdsec
b580df5ab3
Merge branch 'adafruit:main' into main 2024-08-02 13:42:51 -04:00
wyrdsec
4ae6afa0c1 Updated copyright 2024-08-02 13:39:57 -04:00
Dan Halbert
be6fa2af21 merge from main 2024-07-29 17:41:46 -04:00
Dan Halbert
71f17b08fb wip: fixing compilation 2024-07-26 18:38:46 -04:00
Tim
ce67e2a0fb remove dead code 2024-07-17 13:18:00 -07:00
Tim
a1fe288ab8 make loop=True required for constant play, add test code 2024-07-16 13:47:09 -07:00
Tim
b3b3577513 add double buffering to RawSample 2024-07-09 11:21:07 -07:00
Dan Halbert
48dd9e3046 shared-module/sdcardio/SDCard.c: check for deinit more thoroughly 2024-07-09 10:40:37 -04:00
ed5591c5cb
Merge pull request #9318 from jepler/sslsocket-stream-protocol
SSLSocket: Add stream protocol
2024-06-14 10:02:17 -05:00
4d4d654677 MP3Decoder: set the nonblocking flag as needed
this makes SSL sockets (which return readable when not yet actually
readable) work better.
2024-06-13 11:11:17 -05:00
3215f6c4ff SSLSocket: handle exceptions during protocol read/write operations
These protocol operations should not raise exceptions, but sometimes
they do. Catch the exception and extract the errno value if available.

At the same time, harmonize the argument types for the underlying C
routines
2024-06-12 16:41:19 -05:00
Dan Halbert
8b39b3b6a6 shared-module/usb_hid/Device.c: update tud_hid_set_report_cb() 2024-06-10 18:19:27 -04:00
49a612056e take micropython tricks for selectability of ssl sockets 2024-06-10 12:07:48 -05:00
wyrdsec
e6a569a1e5 shared-module/aurora_epaper/aurora_framebuffer.c: More comments 2024-06-07 17:08:58 -04:00
7969638740 SSLSocket: Add stream protocol
including select. This assumes that the SSL layer is readable/writable
exactly when the underlying socket is readable/writable.
2024-06-07 14:49:35 -05:00
wyrdsec
633f1a6bf9 shared-module/aurora_epaper: small compilation error 2024-06-07 10:19:22 -04:00
wyrdsec
e9c416bda2 shared-module/aurora_epaper: Formatting
shared-bindings/aurora_epaper: Formatting
2024-06-07 10:03:02 -04:00
wyrdsec
707026623f
Merge branch 'adafruit:main' into main 2024-06-06 20:30:44 -04:00
wyrdsec
bafe45fde9 Docs 2024-06-06 20:29:50 -04:00
Scott Shawcroft
1aa17b39b6
Merge pull request #9284 from jepler/mp3-stream
MP3: Stream them
2024-06-06 12:15:30 -07:00
wyrdsec
1214b699ca Pervasive Displays Aurora E-paper driver 2024-06-05 20:00:45 -04:00
6c9eaf1415 MP3Decoder: better handle underflows of mp3 stream
* Don't consume in the case of "indata overflow".
   Doing so leaves us at a bad boundary within the MP3 data
   and can continue decoding from an inappropriate spot
   i.e., one that looks likede mp3 data but is NOT.

   because there are many crashing bugs in the helix mp3 library on
   invalid input data, we must do our best to avoid them, and this
   is one way to do that.

 * clear the output buffer in the case there's not a sync word in the
   buffer. this can also happen when too little data is available.

   this changes more "stuttering" conditions into "silent" conditions.

With these changes, I can get through 3+ plays of "idea.mp3" from a local
http server with long pauses (but not stuttering glitches or safe mode
crashes).

I was also able to play through 10+ minutes of http://ice2.somafm.com/dronezone-128-mp3
without crashing or "end of stream", though again there are pauses
due to packet loss.

I think this is good now, except for the problems that arise when
the socket layer doesn't deliver a fresh packet for a long time.
2024-06-05 14:52:07 -05:00
cb295c57d7 MP3Decoder: Make it possible to start in the middle of an MP3
You can now, e.g.,
```
with open("/whatever.mp3") as mp3_file:
    mp3_file.seek(16000*30)
    decoder.file = mp3_file
    i2s.play(decoder)
```
to start about 30 seconds into a 128kbit/s CBR track.

If a track is looped, the loop will start at the beginning.

This also changes the behavior if the track is started & stopped: it will
continue from where it left off, except if it had prevously run to
completion. To get other behavior, you can seek the file and then re-assign
the file property.
2024-06-05 10:33:40 -05:00
6f6b680c18 MP3Decoder: improve some comments 2024-06-04 12:24:34 -05:00
Scott Shawcroft
254cac059e
Make time_to_refresh return 0 correctly
Redo Feather C6 pinout so it include standard D# labels for feathers

Fixes #9244
2024-06-03 15:33:11 -07:00
f81a3aed68 MP3Decoder: avoid all blocking reads in background
This gets MP3 playback of a soma.fm stream working for up to a minute
at a time, though it's still vulnerable to network glitches.

 * the buffer can empty, in which case a single block of audio
   plays repeatedly in max headroom stutter fashion
 * the server eventually (after 1 to 5 5 minutes) stops getting packets
   at all. At this point stream playback stops, with the internal error
   indicating a problem MP3 decoding (which doesn't quite make sense):
   -9, ERR_MP3_INVALID_HUFFCODES.
 * other combinations of audiomixer buffer & mp3 buffer might give
   different results
```py
import time

import adafruit_connection_manager
import adafruit_requests
import audiobusio
import audiomixer
import audiomp3
import board
import wifi

pool = adafruit_connection_manager.get_radio_socketpool(wifi.radio)
ssl_context = adafruit_connection_manager.get_radio_ssl_context(wifi.radio)
requests = adafruit_requests.Session(pool, ssl_context)

# todo: parse PLS files like https://somafm.com/nossl/dronezone.pls
# todo: figure out why https URLs don't work at all (missing select?)
# STREAMING_URL = "http://ice2.somafm.com/dronezone-128-mp3"
STREAMING_URL = "http://ice4.somafm.com/tikitime-128-mp3"


def get_mp3_stream():
    if STREAMING_URL.startswith("http:") or STREAMING_URL.startswith("https:"):
        return requests.get(STREAMING_URL, headers={"connection": "close"}).socket
    return open(STREAMING_URL, "rb")


mixer_buffer_size = 1152 * 2
mp3_buffer = bytearray(32768)

with audiobusio.I2SOut(
    bit_clock=board.D12, word_select=board.D13, data=board.D11
) as i2s, get_mp3_stream() as stream, audiomp3.MP3Decoder(
    stream, mp3_buffer
) as sample, audiomixer.Mixer(
    channel_count=2, sample_rate=44100, buffer_size=mixer_buffer_size
) as m:

    v = m.voice[0]
    print(sample)

    i2s.play(m)

    v.play(sample, loop=False)
    while v.playing:
        time.sleep(0.1)
```
2024-06-03 15:49:14 -05:00
a5c4a86349 MP3Decoder: ssize_t type is not portable, don't use it 2024-05-30 16:45:35 -05:00
dffc55ee17 MP3Decoder: STATIC -> static 2024-05-30 14:32:48 -05:00
9bc89f5fba MP3Decoder: better handle INDATA_UNDERFLOW & MAINDATA_UNDERFLOW
This allows playback of some 128k http streams from somafm, though
glitches occur with some regularity.

```py
import time

import adafruit_connection_manager
import adafruit_requests
import audiobusio
import audiomixer
import audiomp3
import board
import wifi

pool = adafruit_connection_manager.get_radio_socketpool(wifi.radio)
ssl_context = adafruit_connection_manager.get_radio_ssl_context(wifi.radio)
requests = adafruit_requests.Session(pool, ssl_context)

# todo: parse PLS files like https://somafm.com/nossl/dronezone.pls
# todo: figure out why https URLs don't work at all (missing select?)
# STREAMING_URL = "http://ice2.somafm.com/dronezone-128-mp3"
STREAMING_URL = "http://ice4.somafm.com/tikitime-128-mp3"


def get_mp3_stream():
    if STREAMING_URL.startswith("http:") or STREAMING_URL.startswith("https:"):
        return requests.get(STREAMING_URL, headers={"connection": "close"}).socket
    return open(STREAMING_URL, "rb")


mixer_buffer_size = 1152 * 16
mp3_buffer = bytearray(16384)

with audiobusio.I2SOut(
    bit_clock=board.D12, word_select=board.D13, data=board.D11
) as i2s, get_mp3_stream() as stream, audiomp3.MP3Decoder(
    stream, mp3_buffer
) as sample, audiomixer.Mixer(
    channel_count=2, sample_rate=44100, buffer_size=mixer_buffer_size
) as m:

    v = m.voice[0]
    print(sample)

    i2s.play(m)

    v.play(sample, loop=False)
    while v.playing:
        time.sleep(0.1)
```
2024-05-30 14:22:51 -05:00
974b21a079 MP3Decoder: do better at keeping stream buffer full 2024-05-30 14:22:51 -05:00
a80311d4c0 MP3Decoder: make testable in coverage build
An mp3 decoder (note that this needs `audiocore.get_buffer`, not
enabled on devices):
```py
import sys
import audiomp3
import audiocore

GET_BUFFER_DONE, GET_BUFFER_MORE_DATA, GET_BUFFER_ERROR = range(3)

with audiomp3.MP3Decoder(sys.argv[1]) as decoder, open(sys.argv[2], "wb") as target:

    while True:
        res, samples = audiocore.get_buffer(decoder)
        if res != GET_BUFFER_ERROR:
            target.write(samples)
        if res != GET_BUFFER_MORE_DATA:
            break
```

this doesn't actually add any tests though
2024-05-30 14:22:39 -05:00
d6ddd55462 MP3Decoder: Allow passing any stream-like object
This can sort-of play MP3s from a http request, but the buffering is
not good enough to play glitch-free. A new kind of buffer that can
read ahead further without blocking is needed.
2024-05-30 14:21:34 -05:00
Dan Halbert
3f4d9310ff CircuitPython files: replace STATIC with static 2024-05-20 11:02:17 -04:00
Dan Halbert
950b5d09d2 guard2once -s ... 2024-05-19 20:40:44 -04:00
Dan Halbert
dbef48d5e2 add #pragma once to all CircuitPython header files without any include guards 2024-05-19 20:38:07 -04:00
Dan Halbert
747b7619ea update headers of most CircuitPython-only files 2024-05-17 14:56:28 -04:00
Dan Halbert
daa11cb1c2 updates before header conversion 2024-05-17 14:56:28 -04:00
Scott Shawcroft
9ab8831d38
Merge pull request #9218 from jepler/mp3-esp
Enable mp3 output on esp32s3
2024-05-02 14:30:07 -07:00
7af2a13245 MP3Decoder: Allow port to override the allocator
.. espressif will be able to put the mp3 data in faster RAM this way.
2024-05-01 14:20:39 -05:00
08a440d19b espressif: Don't hold interrupts disabled a long time
.. just to prevent background tasks from running
2024-05-01 10:07:13 -05:00
Scott Shawcroft
6d802fe616
Fix ESP builds 2024-04-29 14:11:38 -07:00
Scott Shawcroft
28b7421124
Merge remote-tracking branch 'adafruit/main' into renode 2024-04-29 11:27:19 -07:00
Scott Shawcroft
0cbd8b2e0c
Add CIRCUITPY_USB_DEVICE config
This replaces CIRCUITPY_USB and makes room for CIRCUITPY_TINYUSB
when it may only be included for host support.
2024-04-26 11:58:49 -07:00
Scott Shawcroft
b63d422768
Fix more boards and docs 2024-04-23 16:04:42 -07:00
Scott Shawcroft
442def3e68
Add minimal Renode port
This runs in the Renode simulator and enables easier tracing and
debugging of the CircuitPython core. This port can also serve as
a starting point for new ports because it implements the minimal
necessary for the CP core to run.
2024-04-23 13:31:31 -07:00
93490c301f Don't close an SSL socket twice 2024-04-17 15:17:37 -05:00
2f53c6edbb ssl: Swallow errors during socket.close()
.. for reasons given in the comment
2024-04-17 15:17:04 -05:00
2f04028d10 Merge remote-tracking branch 'origin/main' into ssl-anything 2024-04-17 13:45:43 -05:00
Scott Shawcroft
aca3191a58
Add Max3421E support for usb host
It is enabled on:
* SAMD51 boards with 1MB flash (SKU ending in 20A)
* Feather RP2040 DVI. Others have PIO usb host.
* All ESP32 boards.
* All nRF boards

Fixes #8676
2024-04-10 10:57:28 -07:00
Dan Halbert
817a7fa4af
Merge branch 'main' into main 2024-04-06 16:21:01 -04:00
Dan Halbert
0f66ecb32f
Merge pull request #9146 from brushmate/customizable_midi_interface_names
Make USB MIDI interface names customizable
2024-04-06 13:05:44 -04:00
Dan Halbert
e97ac185d2 factor out name-setting in usb_midi_set_names() 2024-04-06 11:33:00 -04:00
Steffen Kreutz
814ebc6246 Make USB MIDI interface names customizable 2024-04-06 12:09:19 +02:00
Joshua
e956f2994b Updated to use ringbuf and an event callback. 2024-04-06 12:53:08 +10:30
Dan Halbert
e847999a42 Runtime.serial_bytes_available: return count isntead of bool 2024-04-06 09:26:58 +10:30
Fabien Chouteau
8f55dfeb3d shared-module/fourwire/FourWire.c: make the chip_select pin optional
If there's only one device on the bus, the chip_select pin of the
peripheral can be fixed in hardware, therefore lowering the number of
pins required on the microcontroller side.

This patch allows this by making the chip_select pin optional.
2024-04-06 09:23:10 +10:30
Scott Shawcroft
fbd9a6e410
Merge pull request #9141 from dhalbert/serial_bytes_available
Runtime.serial_bytes_available: return count instead of bool
2024-04-05 10:20:02 -07:00
Dan Halbert
8027efe245
Merge pull request #9106 from wee-noise-makers/fourwire_optional_cs
shared-module/fourwire/FourWire.c: make the chip_select pin optional
2024-04-04 22:38:06 -04:00
Joshua
4d8310e374 Fixed precommit spacing problems. 2024-04-05 12:55:14 +10:30
Joshua
090f330ad5 Added support for Cardputer keyboard input. 2024-04-05 10:39:04 +10:30
Dan Halbert
bb9968215c Runtime.serial_bytes_available: return count isntead of bool 2024-04-04 12:26:06 -04:00
9efb034cba Add pio-based flux capturing for rp2040 2024-04-02 15:42:28 -05:00
1be36bd7cb Add floppyio to unix port, test mfm decoding 2024-04-02 15:42:28 -05:00
7d2e46aa19 Update adafruit_floppy 2024-04-02 14:57:20 -05:00
Fabien Chouteau
659c38562b shared-module/fourwire/FourWire.c: make the chip_select pin optional
If there's only one device on the bus, the chip_select pin of the
peripheral can be fixed in hardware, therefore lowering the number of
pins required on the microcontroller side.

This patch allows this by making the chip_select pin optional.
2024-03-30 11:04:18 +01:00
Dan Halbert
ec16f6d8ba
Merge pull request #8855 from xs5871/feature-better-keypad-debouncing
Add state integration based debouncing to the `keypad` module
2024-03-26 15:41:35 -04:00
e5f0579d6c SSLSocket: implement setsockopt (untested) 2024-03-25 09:24:57 -05:00
xs5871
3e184e994c
Add state integration based debouncing to the keypad module 2024-03-22 19:17:23 +00:00
KB Sriram
bed6483823 Set SPI clock line idle polarity for CPOL=1
Fixes https://github.com/adafruit/circuitpython/issues/9074
2024-03-21 22:50:01 -07:00
14a19726f0 Fix return value of accept()
The subscripting to get the `peer` object was wrong.
2024-03-21 14:06:37 -05:00
8c5d9d28d8 ssl: make bind & listen into void functions (they throw exceptions) 2024-03-21 14:06:32 -05:00
f960c5b7c1 SSLSocket: propagate any exception from socket.settimeout directly 2024-03-21 13:54:40 -05:00
b330989704 sslsocket: Simplify handling the timeout value
We're just going to pass it down to the underlying socket, so don't
parse it, multiply it, etc.
2024-03-21 13:54:40 -05:00
c793a021b8 ssl: work on anything implementing the socket protocol
In principle this allows core SSL code to be used with e.g., wiznet
or airlift sockets. It might actually be useful with wiznet ethernet devices
(it's probably not with airlift)
2024-03-21 13:54:40 -05:00
5973c4a86c socketpool: factor out constants
This header can be used by ssl even if there's no core socketpool
2024-03-21 13:54:40 -05:00
CDarius
bb683fa4cf Renamed module 'keypaddemux' in 'keypad_demux' and fix documentation 2024-03-19 09:59:02 +01:00
CDarius
f6033777c1 Merge branch 'main' into cardputer_keyboard 2024-03-19 09:09:51 +01:00
CDarius
88b4e38625 Moved DemuxKeyMatrix in the keypaddemux module 2024-03-18 17:11:34 +01:00
Dan Halbert
d1488313d5 Allow ctrl-c of adafruit_bus_device.spi_device lock hang 2024-03-15 18:40:34 -04:00
CDarius
c5c78d3235 Moved DemuxKeyMatrix from board specific to a shared module 2024-03-12 10:28:08 +01:00
Dan Halbert
9b6fd48029 shared-module/_bleio/ScanResults.c: make ScanEntry handling be atomic 2024-03-06 17:01:53 -05:00
3e029a9d0d ssl: Fix "timed out" exceptions
Incorrect error handling in send/recv would raise an OSError with
an incorrect (negative) code.

It's likely that this bug was always happening in the Pico W
implementation, which became the basis of the current shared
implementation.

Push handling of WANT_{READ,WRITE} down into mbedtls_raise_error
and use it in recv_into and send.

Tested by connecting to google.com:443, sending nothing, and trying
to read a byte:

```py
import socketpool, ssl, time, wifi
socket = socketpool.SocketPool(wifi.radio)
ctx = ssl.SSLContext()
with ctx.wrap_socket(socket.socket()) as ss:
    ss.connect(("google.com", 443))
    ss.settimeout(1)
    b = bytearray(1)
    try:
        t0 = time.monotonic()
        ss.recv_into(b)
    except Exception as ee:
        t1 = time.monotonic()
        exc = ee
        print(t1-t0)
        raise exc
```

As desired, an exception `OSError: [Errno 116] ETIMEDOUT` occurred
and the time delta value was 1.0 seconds.

(tested on pycamera)

Closes: #8988
2024-03-04 20:55:32 -06:00
Dan Halbert
b584642cfd
Merge pull request #8976 from tannewt/rp2_usb_host_keyboard
Provide language code to string descriptors
2024-03-04 16:55:21 -05:00
Mariusz Ćwikła
52c38c8914 usb_hid.set_interface_name: use port_malloc to allocate memory for interface name 2024-03-03 09:11:59 +01:00
Mariusz Ćwikła
898708a1cc usb_hid.set_interface_name 2024-02-28 16:34:34 +01:00
Scott Shawcroft
0cf3a66c81
Provide language code to string descriptors
This improves #8885 but doesn't fix the read error.
2024-02-23 15:51:12 -08:00
Scott Shawcroft
605c39c8db
Fix ssl.SSLSocket bind() error checking
Non-ssl sockets now return size_t error numbers, not bool.

Fixes #8947
2024-02-20 15:46:06 -08:00
Scott Shawcroft
9f3987aa3c
Require explicit socket port reuse
Doing it implicitly can lead to mistaken socket leaks and reuse.
It now matches CPython.

Fixes #8443
2024-02-16 14:31:19 -08:00
Scott Shawcroft
02a488649f
Merge pull request #8923 from jepler/groups-in-rom
displayio: add, check "readonly" flag for groups
2024-02-16 09:49:14 -08:00
3b445f167b Rename check_rom to check_readonly 2024-02-15 22:17:00 -06:00
d7dd571326 Rename the "in_rom" flag to "readonly" 2024-02-15 22:17:00 -06:00
b57c37cd34 espressif: Use mbedtls implementation of ssl module.
the mbedtls version is a bit different so there are some new #ifdefs
needed.

Tested with the ssl test from https://github.com/adafruit/circuitpython/issues/8910
on Adafruit MatrixPortal S3 (no pico w testing done)
2024-02-15 14:26:24 -06:00
9abe273afa mbedtls: move to shared-module
this enables the implementation to be shared among ports.
2024-02-15 13:30:09 -06:00
75ec56844c displayio: add, check "in rom" flag for groups
closes: #8873
2024-02-14 19:39:00 -06:00
58f28b82f5 Include header only when needed 2024-02-13 17:00:52 -06:00
b47033bbe2 include digitalio header where actually needed 2024-02-13 17:00:52 -06:00
0d1e4dbbb0 random: fix getrandbits(0)
this is defined by python (returns 0) and tested in a test
2024-02-13 17:00:52 -06:00
f7c4a220d0 Fix build bugs exposed by posix port 2024-02-13 17:00:52 -06:00
foamyguy
880aa9c304 swap order of size 2024-02-11 16:35:37 -06:00
Scott Shawcroft
ab1316cb0e
Merge pull request #8831 from jepler/q-and-d-uvc
Add UVCFramebuffer to allow CircuitPython to send video to a host computer
2024-01-31 15:13:16 -08:00
9b6f590742 remove comment that's not valuable 2024-01-31 12:39:13 -06:00
da5ba9a76a Rename & improve doc 2024-01-31 12:03:12 -06:00
1c95a85ceb Merge remote-tracking branch 'origin/main' into q-and-d-uvc 2024-01-31 08:27:13 -06:00
335dd66bcf Merge remote-tracking branch 'origin/8.2.x' into merge-82x-main 2024-01-30 14:31:41 -06:00
df1eadabe6 remove subdirectory non-existence check for better compatibility with 9.0 2024-01-30 13:49:39 -06:00
8b30494146 Fix copying B to G in bitmapfilter.blend 2024-01-30 10:45:56 -06:00
247125d64b Remove redundant check_matching_details calls 2024-01-29 11:15:45 -06:00
943825f8be Add bitmapfilter.blend
This can perform arbitrary channel mixing between two images.
Alpha blend & maximum functions are demonstrated in the test.
However, it should make most of the usual photo editing blends
possible. (for dissolve, fill a mask bitmap with random values,
which may be expensive to do from circuitpython code; we can
specifically accelerate it if we need to)
2024-01-29 11:15:35 -06:00
20a8cfe3ef Allow the framebuffer size of an rgbmatrix to be >65535 bytes 2024-01-27 09:08:55 -06:00
1af43c777b uvc: don't run the callback if uvc is off
this leaves the potential problem that the callback may run frequently
even if not streaming, can improve this later.
2024-01-26 09:30:22 -06:00
f2c40d77d2 uvc: remove traces of the bitmap mode of operation 2024-01-26 09:29:03 -06:00
906c604bba uvc: Fix endpoint counting. 2024-01-26 09:12:51 -06:00
Scott Shawcroft
461d1a9a85 Collect refresh sequence pointer
Otherwise it will be freed during a collect and potentially
overwritten. This is a bug in 8.x but isn't seen as early as in
9.x because 9.x will collect before expanding the split heap
further.

Fixes #8793
2024-01-25 15:00:35 -05:00
e47c58ae34 uvc: Add UVCFramebuffer
This replaces the earlier, Bitmap-based way of interacting with the
UVC framebuffer.

Typical usage:
```py
displayio.release_displays()
display = frambufferio.FramebufferDisplay(uvc.UVCFramebuffer())
```

This works on a MacroPad with a 128x128 framebuffer, but does not work
on a QT Py esp32s3.

On esp32s3, having the UVC-configuring line alone causes a hard-fault
at startup. However, disabling some other USB devices allows it to boot
and run code.py:
```py
import uvc
import usb_hid
import usb_midi

usb_hid.disable()
usb_midi.disable()

uvc.enable_framebuffer(64, 64)
```
however, as far as I can tell within qv4l2, the device never actually
transmits a frame of data (received frame count never increases).
I have not yet analyzed this failure in further detail.
2024-01-25 13:59:29 -06:00
Dan Halbert
a9f551cdd1
Merge pull request #8839 from tannewt/fix_epd_refresh
Collect refresh sequence pointer
2024-01-25 14:52:49 -05:00
Dan Halbert
370b011081
Merge pull request #8830 from dhalbert/hid-wakeup
shared-module/usb_hid: allow HID to wake sleeping host computer
2024-01-25 14:44:02 -05:00
763159457d Avoid pointer alignment error on espressif 2024-01-25 12:51:35 -06:00
d89ccbe9c8
Add swapbuffers
this still seems to encounter some tearing, but it's not clear to me
why. It reduces it greatly.
2024-01-25 12:42:25 -06:00
Scott Shawcroft
7eb78500bf
Collect refresh sequence pointer
Otherwise it will be freed during a collect and potentially
overwritten. This is a bug in 8.x but isn't seen as early as in
9.x because 9.x will collect before expanding the split heap
further.

Fixes #8793
2024-01-25 09:39:00 -08:00
8d6d559b02
uvc: make width, height boot configurable; disable by default 2024-01-24 10:32:23 -06:00
Dan Halbert
9aa73fd43f shared-module/usb_hid: allow HID to wake sleeping host computer 2024-01-24 11:12:49 -05:00
Scott Shawcroft
9538e0067b
Merge remote-tracking branch 'adafruit/main' into ww_sd_card 2024-01-22 17:14:06 -08:00
6b74263a71
uvc: Experimental module for USB video
This allows the CircuitPython device to act as a UVC video source.
2024-01-22 10:44:42 -06:00
ccc85f810c
bitmapfilter: factor out macros
.. they will be used in uvc to do rgb->yuyv conversion
2024-01-22 10:44:36 -06:00
6837e4f7b9
Merge pull request #8786 from jepler/bitmapfilter
Add "bitmapfilter"
2024-01-22 08:03:02 -06:00
Scott Shawcroft
61ec3280d1
Optimize error messages 2024-01-19 21:31:58 -08:00
Taylor Yu
e97b231f0a shared-module/usb_hid: fix keyboard descriptor
Adjust Report Count for the LED field of the Keyboard Report Descriptor
to be consistent with the number of usages.
2024-01-18 22:17:39 -06:00
Scott Shawcroft
234ce7cfa4
Fix move, mkdir and tweak dir listing
Makes sure mount point is a directory.

Fixes #8110 by making it explicit that progress is per-file.
2024-01-18 14:22:16 -08:00
Scott Shawcroft
25e862d110
Make SD cards available over web workflow
This changes storage.mount() to require that a mount point exist
on the parent file system.

A bug in background tasks is also fixed where the function
parameter is cleared on pending callbacks during "reset".

Disk usage is shown on the directory listing and changes based on
the mounted file system. Writable is also loaded per-directory.

Fixes #8108. Fixes #8690. Fixes #8107.
2024-01-16 14:12:16 -08:00
0c36c1558e
Remove morph9, we're tight on flash space as it is
.. and no specific use case for morph9 is known that can't be done
with mix+morph.

Saves ~1800 bytes on Memento
2024-01-15 14:08:13 -06:00