Commit Graph

337 Commits

Author SHA1 Message Date
Dan Halbert
5c429320a8 Add wifi.radio.connected, wifi.radio.ap_active 2023-03-31 17:57:53 -04:00
Dan Halbert
9203b66142
Merge pull request #7815 from bill88t/intercontinental-ballistic-typo
24Mhz -> 240Mhz
2023-03-29 17:12:09 -04:00
Bill Sideris
b746fd05ba
24Mhz -> 240Mhz 2023-03-29 23:58:54 +03:00
hathach
8c1095b268
Merge branch 'main' into add-codespell 2023-03-23 14:09:57 +07:00
Scott Shawcroft
32a596df39
Merge pull request #7757 from adafruit/8.0.x
Merge latest 8.0.x changes
2023-03-20 14:34:59 -07:00
hathach
fecc1bdedb
fix typos (partial) detected by codepell 2023-03-18 22:17:02 +07:00
Dan Halbert
d4840cbf10 translate() messages must be one string 2023-03-14 13:13:58 -04:00
Dan Halbert
b6a7613350
Merge pull request #7470 from microdev1/espnow
Add ESP-NOW Support
2023-03-10 12:21:56 -05:00
MicroDev
874ba4ec68
revert Communicate class and more 2023-03-09 12:04:50 +05:30
gamblor21
ab70506178 Move background tasks to slower routine 2023-03-08 16:14:58 -06:00
gamblor21
7f5f93126c Move background task check 2023-03-06 16:26:22 -06:00
gamblor21
dd05118645 Add multiple transctions to SPI 2023-03-05 22:59:10 -06:00
Dan Halbert
bd889926e5
Merge pull request #7679 from dhalbert/socket-fix
be more careful when setting socket to non-blocking
2023-03-04 16:07:02 -05:00
Dan Halbert
08c9eb9f00 be more careful when setting socket to non-blocking 2023-03-04 14:40:06 -05:00
Dan Halbert
859a48723f
Merge pull request #7633 from tannewt/fix_imx_pwm
Fix `pwmio` on iMX RT.
2023-02-28 14:11:06 -05:00
Dan Halbert
f9831b3bbc
Merge pull request #7639 from adafruit/8.0.x
Merge 8.0.x up to main
2023-02-24 19:32:09 -05:00
Dan Halbert
8996fda049
"an array" -> "array" 2023-02-23 13:55:52 -05:00
Dan Halbert
9058beb573
"a array" to "an array" 2023-02-23 13:41:49 -05:00
Milind
9e73e8351a
Calling stop_dma function while retruning errors from start_dma after configuring dma 2023-02-23 14:47:05 +05:30
Milind
09f84e3513
Changed the code structure to start and stop dma from readinto function as per review comment to support one shot conversion mode for analogbufio
Added check for verifying the buffer type passed to readinto is H
2023-02-23 13:32:48 +05:30
Scott Shawcroft
1acf65ee22
Fix pwmio on iMX RT.
It now handles deinit, never_reset and sharing tracking. PWM
now runs in the WAIT state as well during a time.sleep().

_reset_ok() was removed because it was called in one spot right
before deinit().

Some PWMOut were also switched to a bitmap for use instead of
reference count. That way init and deinit are idempotent.

Fixes #6589. Fixes #4841. Fixes #4541.
2023-02-22 11:22:39 -08:00
Dan Halbert
2684aeb838 don't check for RX and TX both none in ports: now checked in shared-bindings 2023-02-20 19:11:16 -05:00
Milind Movasha
f1b6deacda
Yet another formatting change related to whitespaces 2023-02-18 14:49:11 +05:30
Milind Movasha
b2c6fad713
Additional formatting change related to whitespaces 2023-02-18 14:45:37 +05:30
Milind Movasha
4683e48337
Further formatting changes related to whitespaces 2023-02-18 14:40:12 +05:30
Milind Movasha
ead5751803
Pre-commit: Done the formatting changes
Pre-commit: Fixed compilation error for other ESP32C3/ESP32S3/ESP32H2 boards
Review comment: Removed the self->pin NULL check
Review comment: Using raise_ValueError_invalid_pin when adc_index is not ADC_UNIT1 for ESP32
Review comment: Optimized the code to set data in buffer from DMA results
Fix: For ESP32C3 boards continuing collecting samples after channel mismatch as DMA runs in alternating UNIT mode
Fix: For ESP32S3 and ESP32H2 setting conversion mode to type2
2023-02-18 14:26:50 +05:30
Milind Movasha
5635077853
Espressif analogbufio implementation 2023-02-17 19:19:15 +05:30
Dan Halbert
d8231f1588 Implement safemode.py 2023-02-13 18:26:38 -05:00
MicroDev
6c54bc9fd9
more espnow changes
- improve docs
- use existing list methods
- change `recv` to `read`
2023-02-05 12:31:08 +05:30
MicroDev
c0a9c71057
replace ESPNowStats with Communicate class and more 2023-02-05 01:42:32 +05:30
Jeff Epler
b03eed32fb espressif: i2sout: wait a short time to succesfully write data 2023-02-03 14:22:03 -06:00
Jeff Epler
41dff5d8cc espressif: i2sout: don't needlessly set sample rate
this may reduce glitches when starting samples
2023-02-03 14:22:03 -06:00
Jeff Epler
75ed28665c espressif: i2sout: enlarge buffers 2023-02-03 14:22:03 -06:00
MicroDev
ff95e96160
add ESPNowStats class and more 2023-02-04 01:23:45 +05:30
MicroDev
a1644f15ea
use esp error for espnow 2023-02-03 15:42:44 +05:30
MicroDev
cac90a6969
refactor common espnow functions 2023-02-03 12:35:06 +05:30
MicroDev
e30126e335
remove sync from espnow 2023-02-03 11:12:07 +05:30
MicroDev
f100838ae5
remove peers_table from espnow 2023-02-03 10:14:50 +05:30
MicroDev
14c3b52b8d
Merge branch 'main' into espnow 2023-02-03 01:37:07 +05:30
MicroDev
7028a3adfe
rework espnow api 2023-02-03 01:32:28 +05:30
MicroDev
ae4bb75e29
split espnow between bindings and common-hal 2023-02-01 18:53:58 +05:30
MicroDev
cda5689263
move esp32_camera to espcamera 2023-01-27 22:05:43 +05:30
MicroDev
bfb77d0544
move ULPArch to Architecture 2023-01-26 13:01:14 +05:30
MicroDev
2bb12293f8
add ulp fsm 2023-01-21 17:44:08 +05:30
MicroDev
7330c638b9
minimal changes to make espnow work 2023-01-20 14:12:55 +05:30
Scott Shawcroft
8f9d1e241d
Save watch_for_interrupt_char to espressif too 2023-01-19 10:28:56 -08:00
Scott Shawcroft
dca66eb98c
Watch for ctrl-c over BLE workflow serial
Before this, it was impossible to interrupt a running program over
BLE.
2023-01-18 16:28:35 -08:00
Scott Shawcroft
683e393878
Add comments for MDNS code 2023-01-17 14:07:30 -08:00
Dan Halbert
79b76f7bea
Merge pull request #7445 from tannewt/fix_rpi_mdns
Share the web workflow MDNS object with the user
2023-01-17 14:46:38 -05:00
Dan Halbert
40534da92a espressif: always make new client sockets be non-blocking 2023-01-14 17:02:09 -05:00
Scott Shawcroft
5c517b7e5a
Handle MDNS deinited better. 2023-01-12 11:24:20 -08:00
Scott Shawcroft
78c2fa5b28
Merge pull request #7437 from dhalbert/improve-type-checking-error-msgs
Improve type validation error messages, especially for pins
2023-01-11 10:54:22 -08:00
Scott Shawcroft
fbd5f27371
Ignore ESP-IDF wakeup cause when light sleeping
The IDF's wakeup cause is only for deep sleep. Without ignoring it,
light sleep will wake up too early when done after a deep sleep
wake.

Fixes #7300
2023-01-10 15:34:15 -08:00
Dan Halbert
a974402542 Improve type validation errors messages, especially for pins 2023-01-10 15:02:55 -05:00
Jeff Epler
928fb0a9c4
Make the "name or service not known" message translatable 2022-12-26 13:58:31 -06:00
Dan Halbert
0d3b7770d1
Merge pull request #7378 from DavePutz/issue_7325
Issue 7352 - set max value of a pulsein
2022-12-24 19:16:44 -05:00
root
94dbefacf1 Issue 7352 - set max value of a pulsein 2022-12-23 19:17:45 -06:00
Scott Shawcroft
c16b42e972
Tweak arg checking and comments 2022-12-20 11:00:13 -05:00
Scott Shawcroft
0498b1d2ae
Fix indent 2022-12-19 15:51:34 -05:00
Scott Shawcroft
674f0402a9
Fix ESP32 builds 2022-12-19 15:30:03 -05:00
Scott Shawcroft
f8ac1d9261
Rework the coproc API
It is now a generic `memorymap` API and an ESP specific `espulp` module.

Fixes #7218. Fixes #3234. Fixes #7300.
2022-12-19 14:08:38 -05:00
Dan Halbert
77a98e6107
Merge pull request #7355 from pypewpew/esp32-camera-xclk
esp32-camera: make the master_clock_pin really optional
2022-12-17 21:15:31 -05:00
Radomir Dopieralski
90c805d858 esp32-camera: make the master_clock_pin really optional
The master_clock_pin was already optional, but not specifying it would
result in a crash. This fixes it, so it really can be omitted, when the
camera module has its own clock source built in.
2022-12-16 21:53:50 +01:00
Dan Halbert
66efed5ba5 fix AuthMode printing regression 2022-12-15 15:49:58 -05:00
Jeff Epler
297657ea9a
Refactor so that all sites of name lookup failure result in gaierror 2022-12-14 14:45:32 -06:00
Jeff Epler
44f15d563d
Rename "environ" errors to "getenv" errors 2022-12-09 14:14:53 -06:00
Jeff Epler
3a92c079fc
Finish renaming os_environ_get_key to os_getenv
.. for consistency.
2022-12-09 14:07:23 -06:00
Jeff Epler
3459fe322b
Withdraw the _environ module
This existed solely for testing, so expose it a different way during
the unix coverage build

Also turn off os.getenv support on samd21.
2022-12-08 15:33:10 -06:00
Jeff Epler
170918995c
fix mistaken code formatting
I wanted to use the idiom
```c
#if GUARD
if (condition) {
    alternate code
} else
#else
{
    common default code
}
```
idiom, in which the common default code is conditioned both on a
compile-time check and a run-time check. However, I got it wrong
and uncrustify chipped in, adding extra brackets around a following
piece of code and re-indenting it.
2022-12-08 14:16:53 -06:00
Jeff Epler
ef2bfdb5db
dotenv becomes settings.toml 2022-12-08 12:44:20 -06:00
Dan Halbert
44af05283a
Merge pull request #7291 from jepler/issue6502
Ensure orderly shutdown of ssl socket
2022-12-07 19:12:12 -05:00
Jeff Epler
2326b49b24
switch this header to 'pragma once' since I'm touching it already 2022-12-07 15:14:54 -06:00
Jeff Epler
a1dd8405f4
use a more standard method of forward-declaring the structure 2022-12-07 15:14:30 -06:00
Scott Shawcroft
b354cec8cb
Three small ESP web workflow fixes
* Set nonblock on all accepted sockets. Not just ones for user code.
* Close an open websocket if another is accepted.
* Set debug level to INFO rather than DEBUG because DEBUG crashes
  on ESP32-S3 USB OTG.
2022-12-06 11:49:04 -08:00
Jeff Epler
7583ccad2a
Ensure orderly shutdown of ssl socket
A crash would occur if an SSL socket was not shut down before
`gc_deinit()`.

I do not fully understand the root cause, but some object deinitialization
/ deallocation prior to `gc_deinit` leaves the SSL object in an
inconsistent state.

Rather than resolve the root cause, instead ensure that the closing of
the user socket also closes the SSL socket.

Closes: #6502
2022-12-01 19:29:20 -06:00
Jeff Epler
286efc18fc
handle domain with trailing dot
Closes: #7032
2022-11-30 09:29:21 -06:00
Scott Shawcroft
ad2d190507
Merge pull request #7247 from tannewt/picow_web_workflow
Enable* web workflow for Pico W
2022-11-28 14:19:42 -08:00
Dan Halbert
17be447c4b correct Radio.connect() and .start_ap() signatures; clean up some code 2022-11-22 17:11:03 -05:00
Scott Shawcroft
c3a96a63c0
Enable* web workflow for Pico W
* Except for circuitpython.local which depends on MDNS and will be
done in a follow up PR.

Progress on #7214
2022-11-21 16:24:05 -08:00
Jeff Epler
4e0f8e7fcd
Interrupt on UART 'break'
Tested and working with the CH9102F USB converter on Adafruit's
Feather ESP32 V2 (& tio as the software on the host computer)

Closes: #7233
2022-11-19 10:57:21 -06:00
Scott Shawcroft
8e4e84c58b
Match channel number, not timer number 2022-11-15 16:51:47 -08:00
Scott Shawcroft
93ee54a2fb
Fix PWM status LED never_reset
It doesn't need never reset because the status LED is only active
when user code isn't.

This also fixes PWM never reset on espressif so that deinit will
undo it.

Fixes #6223
2022-11-15 16:14:31 -08:00
MicroDev
512cda8b73
enable microcontroller.cpu.temperature on esp32s3 2022-11-12 10:03:00 +05:30
Jeff Epler
452ebe27ae
socketpool: make socket objects selectable
.. which will lead to them being usable in async contexts, pending
relevant changes in asyncio
2022-11-05 12:05:19 -05:00
Dan Halbert
ded134c346 store wake_alarm in a static object 2022-10-29 16:26:36 -04:00
Dan Halbert
9307b62ad5 wip 2022-10-27 22:42:04 -04:00
Dan Halbert
5ebdf281cb
Merge pull request #7125 from dhalbert/esp-pin-alarm-fix
Fix setup of Espressif PinAlarms
2022-10-26 15:24:58 -04:00
Dan Halbert
56d8b9451f don't wait for pulls in PinAlarm 2022-10-25 20:42:08 -04:00
Georg Bøe
032bf63f2d Raise error with positive code in recv_into for espressif 2022-10-25 22:53:01 +02:00
microDev
8f0a674a1b
coproc module enhancements
- add light and pretend-to-deep sleep support
- check coproc running status
2022-10-22 19:08:49 +05:30
microDev
83b54d003d
implement more checks in coproc module
- check memory address range
- check firmware size at an earlier stage
2022-10-22 19:05:48 +05:30
microDev
b33a2b45dc
add coproc alarm 2022-10-20 18:38:20 +05:30
microDev
5232e3f6c3
add coproc module 2022-10-20 09:09:44 +05:30
microDev
e7b25dbf73
improve dualbank errors 2022-10-15 13:20:10 +05:30
Dan Halbert
7e4b2a09eb
Merge pull request #7000 from MicroDev1/storage-extend
Add Storage Extension Support
2022-10-13 10:05:55 -04:00
microDev
728fea4ca4
add storage extension python api 2022-10-13 09:53:33 +05:30
Jeff Epler
c98174eea5
Add support for SSL client certificate (load_cert_chain)
Tested with badssl.com:

 1. Get client certificates from https://badssl.com/download/
 2. Convert public portion with `openssl x509 -in badssl.com-client.pem -out CIRCUITPY/cert.pem`
 3. Convert private portion with `openssl rsa -in badssl.com-client.pem -out CIRCUITPY/privkey.pem` and the password `badssl.com`
 4. Put wifi settings in CIRCUITPY/.env
 5. Run the below Python script:

```py
import os
import wifi
import socketpool
import ssl
import adafruit_requests

TEXT_URL = "https://client.badssl.com/"
wifi.radio.connect(os.getenv('WIFI_SSID'), os.getenv('WIFI_PASSWORD'))

pool = socketpool.SocketPool(wifi.radio)
context = ssl.create_default_context()
requests = adafruit_requests.Session(pool, context)

print(f"Fetching from {TEXT_URL} without certificate (should fail)")
response = requests.get(TEXT_URL)
print(f"{response.status_code=}, should be 400 Bad Request")
input("hit enter to continue\r")

print("Loading client certificate")
context.load_cert_chain("/cert.pem", "privkey.pem")
requests = adafruit_requests.Session(pool, context)

print(f"Fetching from {TEXT_URL} with certificate (should succeed)")
response = requests.get(TEXT_URL)
print(f"{response.status_code=}, should be 200 OK")
```
2022-10-10 15:10:53 -05:00
Dan Halbert
21c0c4c1a6 update esp-idf; allow start/stop channels in wifi scanning 2022-10-07 15:29:09 -04:00
Jeff Epler
09023abcd2
Update espressif function prototype to match 2022-10-05 14:56:25 -05:00
Jeff Epler
dcb650c513 pico w: add ssl module
Note: at this time, the ssl module on pico_w never verifies the server
certificate. This means it does not actually provide a higher security
level than regular socket / http protocols.
2022-10-05 13:12:43 -04:00