Commit Graph

262 Commits

Author SHA1 Message Date
Jeff Epler f54c7adddc
Must treat NO_PIN cast to uint8_t the same as NO_PIN
Otherwise, deinitializing a camera with e.g., the powerdown
pin unspecified results in an assertion failure in a debug build.
2022-08-04 15:11:54 -05:00
Jeff Epler 1d1e139379
fix taking multiple pictures 2022-08-04 15:11:53 -05:00
Jeff Epler 5db6db0128
add esp32-camera
This uses the esp32-camera code instead of our own homebrewed camera code.
In theory it supports esp32, esp32-s2 and esp32-s3, as long as they have
PSRAM.

This is very basic and doesn't support changing any camera parameters,
including switching resolution or pixelformat.

This is tested on the Kaluga (ESP32-S2) and ESP32-S3-Eye boards.

First, reserve some PSRAM by putting this line in `CIRCUITPY/_env`:
```
CIRCUITPY_RESERVED_PSRAM=524288
```
and hard-reset the board for it to take effect.

Now, the following script will take a very low-resolution jpeg file and print
it in the REPL in escape coded form:

```python
import board
import esp32_camera

c = esp32_camera.Camera(
    data_pins=board.CAMERA_DATA,
    external_clock_pin=board.CAMERA_XCLK,
    pixel_clock_pin=board.CAMERA_PCLK,
    vsync_pin=board.CAMERA_VSYNC,
    href_pin=board.CAMERA_HREF,
    pixel_format=esp32_camera.PixelFormat.JPEG,
    i2c=board.I2C(),
    external_clock_frequency=20_000_000)

m = c.take()
if m is not None:
    print(bytes(m))
```

Then on desktop open a python repl and run something like
```python
>>> with open("my.jpg", "wb") as f: f.write(<BIG PASTE FROM REPL>)
```
and open my.jpg in a viewer.
2022-08-04 15:11:50 -05:00
Jeff Epler 82be75adb5 Add ability to reserve psram
.. the primary user of which will be the camera, since the framebuffers
must be allocated via esp-idf allocation function and never from the
gc heap.

A board can have a default value, and the value can also be set in the
/.env file using the key CIRCUITPY_RESERVED_PSRAM with the value being
the reserved size in bytes.

Co-authored-by: Dan Halbert <halbert@adafruit.com>
2022-08-03 16:19:40 -05:00
Scott Shawcroft 74e841d835
Read fuses to know what flash and ram pins to never reset 2022-08-02 12:01:42 -07:00
Scott Shawcroft 9661d3256c
Add more ESP32 boards and enable web workflow 2022-08-01 15:52:08 -07:00
Scott Shawcroft 312e298890
Fix other ESP builds and arduino_nano_33_iot 2022-07-29 11:02:35 -07:00
Scott Shawcroft d6344812e8
Lots of web workflow, C3 and title bar fixes
* Fixes #6221 - C3 hang on `import wifi`. Enabling the WiFi PHY was
  disabling USB. Now boards that use it set CONFIG_ESP_PHY_ENABLE_USB
  explicitly.
* Fixes #6655 - Allows pasting into the web serial page. Fixes reading
  more than 0xf bytes at a time.
* Fixes #6653 - Fixes web socket encoding of payloads >125 bytes. Can
  happen when printing a long string.
* Fixes C3 responsiveness when waiting for key to enter REPL. (It
  now correctly stops sleeping.)
* Disables title bar updates when in raw REPL. Related to #6548.
* Adds version to title bar.
2022-07-28 16:06:56 -07:00
Scott Shawcroft c4c15206e7
Merge pull request #6608 from tannewt/web_workflow_port
Allow for dynamic reconfigure including port
2022-07-28 12:59:31 -07:00
Scott Shawcroft 931757f4a9
Improve web workflow responsiveness
1. Run the socket select task at the same priority as CP. This is
  needed because it queues up the background work. Without it, CP
  needed to sleep to let the lower priority task go.
2. Close the active socket on disconnect. This prevents looping
  over a disconnected but not closed socket.

Fixes #6610. Fixes #6613
2022-07-26 15:29:49 -07:00
Scott Shawcroft 6d6234443d
Merge remote-tracking branch 'adafruit/main' into web_workflow_port 2022-07-25 15:57:58 -07:00
Aria Burrell 868a03ff57 Fixed empty characteristic issue with bleio+nimble.
- Based on espressif/nimble's blecent example code. Confirms that the characteristic is not empty before trying to catalogue its descriptors.
- Running ble_gattc_disc_all_dscs on empty (no length) characteristics fails with the (not-very-informative) BLE_HS_EINVAL error if this check is not performed.
2022-07-17 04:50:50 -06:00
Scott Shawcroft 78b4159448
Allow for dynamic reconfigure including port 2022-07-15 16:33:12 -07:00
Jeff Epler 4e6fa55cba
Merge pull request #6591 from tannewt/web_workflow_ticks
Add socket select task to wake CP
2022-07-15 18:30:43 -05:00
Scott Shawcroft 6e7fdcc24b
Add wait for MDNS hostname to be set 2022-07-15 13:48:19 -07:00
Scott Shawcroft 145cce93da
Merge pull request #6596 from Neradoc/ble-name-in-dotenv
Setup default BLE name in dotenv
2022-07-14 15:46:28 -07:00
Jeff Epler dcc27a8c88
Need to ensure wifi radio is set enabled again on esp32
.. otherwise, nothing set it enabled on the second soft reboot.
2022-07-14 15:09:26 -05:00
Jeff Epler 72f5537027
esp32: don't fully reset the wifi device
.. this makes reconnecting without a full reset not work.

Because this works on other generations of the esp32 (c2, c3, etc),
apply this behavior only to esp32.

After this change, it's possible to connect multiple times to wifi in
different runs of code.py or the repl after soft rebooting.
2022-07-14 15:01:15 -05:00
Neradoc 5ca6d8953d use available constants instead of testing errors for length 2022-07-14 11:55:53 +02:00
Neradoc 50a9beda04 Retrieve the BLE name from dotenv if available
Format:
CIRCUITPY_BLE_NAME = My BLE Board

- the length is limited to 31 characters
- for the NRF version it repeatedly truncates the name if it's too long
- the ESP version defaults to "nimble" if the name is too long
2022-07-14 11:55:53 +02:00
Scott Shawcroft e9dd254127
Add socket select task to wake CP
This fixes the web workflow on boards without a display.

Fixes #6552
2022-07-13 17:35:35 -07:00
Scott Shawcroft ac460dd1e1
Merge branch 'main' into esp32 2022-07-13 15:30:53 -07:00
Jeff Epler 5c6ee20ca5
on esp32 need to initialize nvs before starting wifi
Also, change error handling so that the esp-idf error number
is shown in the traceback in the case of an error.

This allows scanning & connecting to work. I didn't try requests yet.
2022-07-13 11:57:38 -05:00
Scott Shawcroft 23bbb19138
Merge remote-tracking branch 'adafruit/main' into websocket_serial 2022-07-12 13:15:38 -07:00
Tod Kurt a658007673
Update ports/espressif/common-hal/wifi/Radio.c
Co-authored-by: Dan Halbert <halbert@halwitz.org>
2022-07-09 22:17:26 -07:00
Tod Kurt 22e061ba35
Update ports/espressif/common-hal/wifi/Radio.c
Co-authored-by: Dan Halbert <halbert@halwitz.org>
2022-07-09 22:17:18 -07:00
Tod Kurt 98692150ac
Update ports/espressif/common-hal/wifi/Radio.c
Co-authored-by: Dan Halbert <halbert@halwitz.org>
2022-07-09 22:17:12 -07:00
Tod Kurt f464ec3047
Update ports/espressif/common-hal/wifi/Radio.c
Co-authored-by: Dan Halbert <halbert@halwitz.org>
2022-07-09 22:17:02 -07:00
Dan Halbert 2c7ad7a39f make translate and pre-commit formatting fixes 2022-07-08 16:53:53 -04:00
Dan Halbert c316b950c7 merge from adafruit/main 2022-07-08 15:42:19 -04:00
Dan Halbert 76e32dcf93 remove need for CIRCUITPY_ESP_PSRAM 2022-07-08 14:54:55 -04:00
Tod Kurt d3e1d1b104 Fix #6559 2022-07-07 19:42:11 -07:00
Dan Halbert 4e88d795e1 Thonny causing crash emitglue.c:199: 2022-07-06 23:01:19 -04:00
Scott Shawcroft 07b2697ae3
WIP websocket to serial 2022-07-01 16:57:10 -07:00
Dan Halbert 8814ee03f1
Merge pull request #6542 from todbot/wifi-tx-power
Add wifi.radio.tx_power
2022-07-01 14:09:08 -04:00
Scott Shawcroft 7589e53fea
WIP websocket accept and hashlib 2022-07-01 10:18:33 -07:00
Dan Halbert 8bb369cac5 refactor debug UART to console UART; get working on ESP32 2022-06-30 23:16:46 -04:00
Tod Kurt 698d563dcf adust wifi.radio.tx_power to be x4 (in db) as mentioned in #6540 2022-06-30 15:33:03 -07:00
Tod Kurt 2a563cc8ba first cut at wifi.radio.tx_power 2022-06-30 15:10:16 -07:00
Dan Halbert b0efd130c9 ESP32 REPL working through debug UART 2022-06-29 23:19:36 -04:00
Scott Shawcroft 3be3e89d82
Merge branch 'main' into cp_webserver 2022-06-29 14:01:32 -07:00
Scott Shawcroft 8dc8265275
Fix auto-wifi created crash
The wifi event_handler runs on the other core so we need to be
careful when calling into CP APIs.

Fixes #6503
2022-06-29 11:53:10 -07:00
Dan Halbert 780c4963cb wip; change never-ever reset pin mechanism 2022-06-28 23:06:49 -04:00
Dan Halbert ca64950503 wip fixes 2022-06-28 18:32:08 -04:00
Scott Shawcroft 41039445c9
Clean up and add docs 2022-06-27 13:39:09 -07:00
Scott Shawcroft 3cd05291d0
Static files + welcome page 2022-06-27 13:39:09 -07:00
Scott Shawcroft 7543dd9af0
CORS works and autoreload too 2022-06-27 13:39:08 -07:00
Scott Shawcroft 92593aa7a1
Fix bind, remove hard coded ip 2022-06-27 13:34:13 -07:00
Scott Shawcroft 4f0a7aedfd
WIP adding devices.json and auth 2022-06-27 13:34:13 -07:00
Scott Shawcroft 32478345f8
more tweaks 2022-06-27 13:34:13 -07:00
Scott Shawcroft 0882cbf823
web server kinda works 2022-06-27 13:34:13 -07:00
Scott Shawcroft 61d0f7947b
WIP doesn't flush response before closing 2022-06-27 13:34:13 -07:00
Scott Shawcroft 301f3e0456
Start of web server 2022-06-27 13:34:13 -07:00
Dan Halbert 55784c93de wip; compiles 2022-06-26 21:22:22 -04:00
Scott Shawcroft 0c418e98b1
Merge remote-tracking branch 'adafruit/main' into auto_wifi 2022-06-13 15:44:43 -07:00
Scott Shawcroft dc794f91c0
Speed up auto-wifi with wrong password
This adds basic timeout support to connect by preventing subsequent
retries if over time. The first connect may still take more than
the timeout.
2022-06-13 15:38:19 -07:00
Scott Shawcroft b191075ab8
Better length checks 2022-06-13 09:18:42 -07:00
Scott Shawcroft 39b8c2c94e
Merge pull request #6453 from KurtE/ESP32_UART
ESP32 USE uart_param_config
2022-06-13 08:56:32 -07:00
Scott Shawcroft 6446010753
Wi-Fi autoconnect and title bar status
This adds support for CIRCUITPY_WIFI_SSID and CIRCUITPY_WIFI_PASSWORD
in `/.env`. When both are defined, CircuitPython will attempt to
connect to the network even when user code isn't running. If the
user code attempts to a network with the same SSID, it will return
immediately. Connecting to another SSID will disconnect from the
auto-connected network. If the user code initiates the connection,
then it will be shutdown after user code exits. (Should match <8
behavior.)

This PR also reworks the default displayio terminal. It now supports
a title bar TileGrid in addition to the (newly renamed) scroll area.
The default title bar is the top row of the display and is positioned
to the right of the Blinka logo when it is enabled. The scroll area
is now below the Blinka logo.

The Wi-Fi auto-connect code now uses the title bar to show its
state including the IP address when connected. It does this through
the "standard" OSC control sequence `ESC ] 0 ; <s> ESC \` where <s>
is the title bar string. This is commonly supported by terminals
so it should work over USB and UART as well.

Related to #6174
2022-06-09 14:55:54 -07:00
Scott Shawcroft 2baf476530
Merge pull request #6463 from adafruit/7.3.x
Catch main up to 7.3.x
2022-06-06 11:58:05 -07:00
Scott Shawcroft be67067809
Merge remote-tracking branch 'adafruit/main' into translate_header 2022-06-03 15:18:18 -07:00
gamblor21 40e890323b Add DNS optional to set IP 2022-06-01 20:13:51 -05:00
KurtE 14ab3c7375 ESP32 USE uart_param_config
Use this function instead of several individual configuration functions
to configure such things as Baud rate, transfer size, stop bits,
parity...

This function also resets both the RX and TX Hardware Fifo
reset functions are called to setup the hardware.
2022-06-01 17:09:44 -07:00
gamblor21 4f6d4e2284 Doc fix and add set for DNS 2022-05-31 22:13:18 -05:00
gamblor21 90fe20a153 Adding manual IP address set 2022-05-27 15:33:54 -05:00
Scott Shawcroft 9d10a3da66
Conditionalize LTO 2022-05-27 12:59:54 -07:00
Dan Halbert b143314b22 Espressif: fix allocation of multiple Incremental Encoders 2022-05-24 22:37:24 -04:00
Dan Halbert f63b26c534 address jepler's comments and further squeezes 2022-05-20 10:10:55 -04:00
Dan Halbert a01dec1df9 message consolidation and more use of validators 2022-05-19 15:38:37 -04:00
Scott Shawcroft 3e85cfe26b
Fix ESP and HCI build 2022-05-12 15:23:26 -07:00
Scott Shawcroft 269d51d023
Add two stage reset for BLE
This lets the BLE stack run through the wait period after a VM run
when it may be waiting for more writes due to an auto-reload.

User BLE functionality will have their events stopped. Scanning and
advertising is also stopped.
2022-05-12 13:20:44 -07:00
Dan Halbert 0f3eb9f46e espressif: check properly for pull values 2022-05-04 22:51:27 -04:00
Michael Wisslead e63a327107 Bound PulseIn start indexes to maxlen. 2022-04-28 02:28:34 +00:00
Dan Halbert 4eeaf41edc test and adjust NeoPixel timings on multiple products 2022-04-25 23:12:24 -04:00
Dan Halbert d5deddcaf5
Merge pull request #6207 from domdfcoding/esp32-rotaryio
Add espressif rotaryio divisor support.
2022-04-06 21:35:02 -04:00
Dominic Davis-Foster f297e872d6
Account for divisor when overriding position. 2022-04-06 18:13:59 +01:00
Dan Halbert 99dc4029dc Espressif: disable pull-up on AnalogIn creation 2022-04-06 11:33:56 -04:00
Dominic Davis-Foster 319ca8560c
Always configure the second PCNT channel. 2022-03-31 20:00:34 +01:00
Dan Halbert ec5c9507b9
Merge pull request #6187 from prplz/espressif-uart-workflow-fixes
Espressif: Fix interrupts in UART workflow
2022-03-30 21:18:02 -04:00
Dominic Davis-Foster 6d025a239e
Add espressif rotaryio divisor support. 2022-03-28 09:04:02 +01:00
Michael Himing f96cd7361d Fix esp32s2 build 2022-03-27 10:09:23 +11:00
Jeff Epler 35aa32bec0
Merge pull request #6193 from tannewt/fix_empty_mdns
Fix MDNS crash on S2
2022-03-26 15:05:17 -05:00
Michael Himing 686012426d Espressif: Fix interrupts in UART workflow 2022-03-25 16:20:04 +11:00
Scott Shawcroft 8642dc4aa7
Fix MDNS crash on S2
Fixes #6186
2022-03-23 17:17:48 -07:00
Scott Shawcroft 380a7087d4
Fix 3-wire SPI on ESP
Simplifying the checks fixed it.

Fixes #6141
2022-03-23 14:53:46 -07:00
Scott Shawcroft 6dd9db31b3
Add USB to Serial/JTAG support for REPL
Adds Adafruit QT Py C3 board that uses it. Also revamps size
check script to work for S3 and C3 as well.

Fixes #6030
2022-03-21 14:03:57 -07:00
Scott Shawcroft 92d946fcac
Guard against NULL result 2022-03-21 10:15:46 -07:00
Scott Shawcroft 6f0d62d85e
Formatting and shrink build size on C3 2022-03-18 12:05:54 -07:00
Jeff Epler e9d81c2826
Add mdns module
This allows for CircuitPython to resolve a .local domain and find
other devices with MDNS services.

First step for #6174
2022-03-17 18:16:16 -07:00
Scott Shawcroft 96dd11a198
Update ESP-IDF to fix PinAlarm
Fixes #5973
2022-03-11 14:40:49 -08:00
Dan Halbert 1c8f671f0a
Merge pull request #6118 from pewpew-game/parallel-reset-optional
paralleldisplay: reset and read pins should be optional
2022-03-08 09:34:25 -05:00
Michael Himing bc1dade304 Espressif: Fix i2c pullup detection 2022-03-08 16:39:24 +11:00
Radomir Dopieralski b5ad78715c
Update ports/espressif/common-hal/paralleldisplay/ParallelBus.h
Co-authored-by: Dan Halbert <halbert@halwitz.org>
2022-03-05 21:48:00 +01:00
Radomir Dopieralski f477848ac1 paralleldisplay: reset and read pins should be optional
The ``reset`` and ``read`` pins should be optional, but the espressif
code had several places where it assumed they are not, and a bug that
caused a crash on ``release_displays`` if they were made optional.

The bug was caused by the fields for storing pin numbers being set
to ``NO_PIN``, which has value of -1, while the fields have type
``uint8_t``.  That set the actual value to 255, and a subsequent
comparison to ``NO_PIN`` returned false.
2022-03-05 18:54:12 +01:00
Scott Shawcroft c4fb5f7df1
Allow ESP boards to customize how a pin is reset
This allows board code to override the default pull up reset state.

It is useful for pins that are already externally connected, pulled
or otherwise used by the board.

Fixes #5931
2022-02-17 16:32:29 -08:00
Dan Halbert fe6e03f504
Merge pull request #6013 from tannewt/esp_ble_gatt_client
Add S3 GATT client support
2022-02-17 16:02:11 -05:00
Scott Shawcroft 65af10cd23
Tweak I2C and TFT power pin defaults
This should set the power to on by default without preventing the
user code from repeatedly using it.

Fixes #5903
2022-02-14 16:19:56 -08:00
anecdata 5742a12497 input validation consistent with esp-idf is moved to common-hal 2022-02-13 22:14:45 -06:00
anecdata b559a0ee2a new kwarg: wifi.radio.start_ap(max_connections=) 2022-02-12 13:34:57 -06:00
Scott Shawcroft 8958e7ef08
Add S3 GATT client support
This allows you to connect to GATT services on the other device.
It also adds connection initiation (GAP central).

More progress on #5926
2022-02-10 11:31:57 -08:00
Scott Shawcroft c9b494b79f
Merge pull request #6006 from DavePutz/issue_5980
Correct ping timeout for espressif
2022-02-10 10:18:14 -08:00
root 6563f71545 Correct ping timeout for espressif 2022-02-09 15:58:25 -06:00
Scott Gauche a8d8651873 Canonical C style for half_duplex = true/false 2022-02-08 23:13:22 -05:00
Scott Gauche 89ad767b8f add half_duplex to spi constructs in other ports but raise not implemented errors 2022-02-08 22:25:23 -05:00
Scott Shawcroft 2964e966b1
Merge pull request #5958 from dhalbert/i2c-common-hal-write-read
I2c common hal write read
2022-02-01 11:08:50 -08:00
Dan Halbert cc410ad6a3 common-hal I2C combined write_read 2022-01-31 22:03:30 -05:00
Scott Shawcroft db7e72b43d
Fix BLE scanning forever on ESP32-S3 2022-01-31 15:45:43 -08:00
Dan Halbert 83e6e6690a wip; works on espressif 2022-01-29 22:44:27 -05:00
Scott Shawcroft 019aecaa20
Support BLE advertising on ESP
Services and characteristics still won't work.

Progress on #5926
2022-01-27 17:40:37 -08:00
Dan Halbert fff68c9f86
Merge pull request #5927 from tannewt/esp_ble_scan
Add BLE scanning for S3 and C3.
2022-01-27 13:05:24 -05:00
Scott Shawcroft d9966c1724
Add TODOs and -Os for RISC-V 2022-01-26 17:07:20 -08:00
microDev fa2d156d14
return default cpu frequency on espressif 2022-01-26 12:32:48 +05:30
Scott Shawcroft b2e1dbd2df
Implement name and address get/set 2022-01-25 19:17:26 -08:00
Scott Shawcroft 5a6f456dbb
Add BLE scanning for S3 and C3.
Everything else should raise NotImplementedError.

First step in #5926
2022-01-25 16:28:46 -08:00
root 367a1d53c0 Fixes for pulsein on ESP32S3 2022-01-23 13:14:34 -06:00
Scott Shawcroft 35175715f9
Check target defined 2022-01-20 14:11:33 -08:00
Scott Shawcroft d99847b410
Refactor pin reset on ESP
This makes it easier to blanket never reset flash and USB pins. It
also allows us to set a custom state after reset. The first case
is for the double tap reset that needs to be pulled low.

Fixes #5893
2022-01-20 12:40:41 -08:00
Scott Shawcroft 13db65566d
ESP NeoPixel fixes
This tweaks the RMT timing to better match the 1/3 and 2/3 of 800khz
guideline for timing. It also ensures a delay of 300 microseconds
with the line low before reset.

Pin reset is now changed to the IDF default which pulls the pin up
rather than CircuitPython's old behavior of floating the pin.

Fixes #5679
2022-01-19 16:29:07 -08:00
Dan Halbert 11848b1826 use GPIO_MODE_ instead of GPIO_MODE_DEF 2022-01-15 23:05:33 -05:00
Dan Halbert c70c8a9390 fix espressif open-drain 2022-01-15 19:54:31 -05:00
Dan Halbert d166834e09
Merge pull request #5803 from dhalbert/countio-enhancements
countio: add selectable rise and fall detection, pulls
2021-12-31 23:45:59 -05:00
Dan Halbert 9d2a32d07e countio: add selectable rise and fall detection, pulls 2021-12-31 16:34:58 -05:00
microDev 4daa7b5180
update espressif port
- enable rgbmatrix for all esp soc
- bump idf to latest commit on v4.4 branch
2021-12-30 19:23:41 +05:30
Jeff Epler 900ec91fa6
Merge pull request #5761 from adafruit/7.1.x
Bring 7.1.x changes into main - cascadetoml undo + alarm fixes
2021-12-23 06:30:05 -07:00
Dan Halbert 3bb9a4439d Fix recording of wake_alarm 2021-12-21 21:48:36 -05:00
Tim Hawes 54e87d3660
Apply suggestions from code review
Co-authored-by: Scott Shawcroft <scott@tannewt.org>
2021-12-14 20:03:44 +00:00
Tim Hawes c325633f8e Add methods to ssl.SSLContext for handling self-signed certs 2021-12-14 01:00:50 +00:00
Tim Hawes ef414bf1bd Handle server_hostname argument in espressif SSLContext.wrap_socket 2021-12-14 01:00:50 +00:00
Tim Hawes a3c8760d41 Fix to error checking in espressif SSLSocket 2021-12-13 17:55:43 +00:00
Jeff Epler b722a2bca1
espressif: pwmout: get rid of not_first_reset special case 2021-12-06 10:08:44 -06:00
Jeff Epler fae6d47a45
espressif: keep never_reset_pins marked as in use 2021-12-06 10:08:44 -06:00
Jeff Epler 1a99ce5eb3 espressif: busio.SPI: Use SPI_DMA_CH_AUTO
All 3 micros we care about (S2, S3, C3) state in the documentation
that DMA channel can be specified as SPI_DMA_CH_AUTO.

Specifying a specific DMA channel explicitly doesn't _ever_ work on
ESP32-S3, so no SPI bus could be used.

Testing performed: On the ESP32-S3-DevKitC, used neopixel_spi to
turn the onboard neopixel red, green, and blue
2021-12-04 09:12:38 -06:00
microDev 554a62955b
Merge branch 'main' into espressif 2021-11-26 22:40:22 +05:30
microDev 7ba5513f9a
update espressif port
- update esp-idf to v4.4
- add esp32s3 support
- add analogio on esp32c3
- disable rgbmatrix on all espressif soc

Co-authored-by: Scott Shawcroft <scott@adafruit.com>
Co-authored-by: Seon Rozenblum <seon@unexpectedmaker.com>
2021-11-24 18:01:34 +05:30
Timon a1052d5f73
Initial broadcom port for Raspberry Pi
This targets the 64-bit CPU Raspberry Pis. The BCM2711 on the Pi 4
and the BCM2837 on the Pi 3 and Zero 2W. There are 64-bit fixes
outside of the ports directory for it.

There are a couple other cleanups that were incidental:
* Use const mcu_pin_obj_t instead of omitting the const. The structs
  themselves are const because they are in ROM.
* Use PTR <-> OBJ conversions in more places. They were found when
  mp_obj_t was set to an integer type rather than pointer.
* Optimize submodule checkout because the Pi submodules are heavy
  and unnecessary for the vast majority of builds.

Fixes #4314
2021-11-22 14:54:44 -08:00
anecdata 193e936807 like #5571, but for AP 2021-11-16 12:21:50 -06:00
anecdata 31d45a3f32 fix old bug that was masking new bug 2021-11-12 16:27:13 -06:00
anecdata e4f06f69cd maybe fewer bytes 2021-11-11 23:23:52 -06:00
anecdata bb8e9ef483 tweak exception messages (re-tested) 2021-11-11 21:54:41 -06:00
anecdata 18f2019300 Set Station MAC address & validate connect SSID len 2021-11-11 17:04:35 -06:00
Scott Shawcroft c1177662cd
Merge pull request #5537 from microDev1/monitor-mode
Add Monitor Mode
2021-11-11 10:10:39 -08:00
microDev a62675a81a
fix wifi reset and monitor deinit routine 2021-11-10 23:38:44 +05:30
Jeff Epler c9475adb00
Enable -Werror=missing-prototypes on espressif port 2021-11-10 11:07:45 -06:00
microDev b435e7b56a
update wifi monitor
- rename loss method to lost
- add method to get queued packet count

Co-authored-by: anecdata <16617689+anecdata@users.noreply.github.com>
2021-11-04 16:21:18 +05:30
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
microDev 27b137f931
Merge branch 'main' into monitor-mode 2021-11-02 13:56:56 +05:30
microDev 4e207853f0
rearrange hostname 2021-11-02 12:33:11 +05:30
microDev 95172cf3ce
add monitor class
Co-authored-by: anecdata <16617689+anecdata@users.noreply.github.com>
2021-11-02 12:32:09 +05:30
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