Commit Graph

2478 Commits

Author SHA1 Message Date
foamyguy 3c4d8c6926 implement self hidden property for vectorio shapes 2022-11-11 17:50:07 -06:00
Dan Halbert c9ad92d133
Merge pull request #7173 from jepler/async-socket
asyncio bugfixes, select bugfixes & selectable socket
2022-11-07 18:32:05 -05:00
Jeff Epler 319d9b04f1
Fix type annotation mistake 2022-11-07 13:51:58 -06:00
Jeff Epler 9cdfba2e47
Simplify argument checking to reduce translated strings
Build size on proxlight trinkey m0 en_US:
Before:  2412 (en_US)  820 (ru)
After:   2544 (en_US)  984 (ru)
Savings: +132 (en_US) +164 (ru) bytes available flash
2022-11-07 12:37:11 -06:00
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
Jeff Epler 1f6cd7bfac
This compatibility name has been removed in 8.x 2022-11-02 17:39:34 -05:00
Dan Halbert 9307b62ad5 wip 2022-10-27 22:42:04 -04:00
Dan Halbert 2bba6a68e8
Merge pull request #7130 from dhalbert/characteristic-descriptors-missing
add Characteristic.descriptors to locals dict
2022-10-26 18:09:04 -04:00
Dan Halbert c52b5b64e5 add Characteristic.descriptors to locals dict 2022-10-26 12:34:33 -04:00
Dan Halbert fed77e918a Fix formatting of "Limitations:" in a couple of modules
When "Limitations:" is in the class docstring, it is sometimes taken
as a class attribute name because of the colon. When exactly is not clear, but
changing embedded colons or various indentations fixes the problem.
2022-10-26 12:33:16 -04: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
Kattni a4238d815d
Merge pull request #7097 from dhalbert/document-limitations
catalog implementation limitations in documentation
2022-10-21 18:02:03 -04:00
Dan Halbert 01c15a1d1b catalog implementation limitations in documentation 2022-10-21 13:58:34 -04:00
microDev b33a2b45dc
add coproc alarm 2022-10-20 18:38:20 +05:30
MicroDev b5b649801b
Merge pull request #6902 from MicroDev1/coproc
Add `coproc` module
2022-10-20 12:51:59 +05:30
microDev 5232e3f6c3
add coproc module 2022-10-20 09:09:44 +05:30
Jeff Epler de0dda989d
Ensure background tasks are serviced during a lengthy sendall 2022-10-19 11:18:29 -05:00
Jeff Epler 508c80da8d
socketpool: add sendall
The standard Python 'fix' for 'send()' returning prematurely is to
use the 'sendall()' method instead. However, this method was not
available.  adafruit_httpserver will probably need to code a version
of it for older versions or for Airlift, but when it's available
this code works (Tested on picow sending 8192 bytes) and may be more
efficient.

(implementing 'sendall' in python should take care to slice a memoryview
rather than the original buffer)
2022-10-17 19:42:09 -05:00
Jeff Epler 068b7c4af8
Use micropython #defines for stream polling operations
We adopted the file "py/ioctl.h" and the ioctl names beginning
with MP_IOCTL_POLL while micropython went with "py/stream.h" and
MP_STREAM_POLL.

Align with upstream.

Closes #6711
2022-10-14 12:15:30 -05:00
Dan Halbert de7a9c38fc Merge remote-tracking branch 'adafruit/main' into add-os-utime-function 2022-10-13 14:15:13 -04:00
Dan Halbert 1569c7ed33
Merge pull request #7045 from jepler/smaller-microcontroller-temperature-samd
samd: Size-optimize the temperature code with an 0.5 to 2.0 degree relative additional error
2022-10-13 14:02:51 -04:00
Dan Halbert ead03cd96f add caveat in documentation 2022-10-13 11:47:10 -04:00
Jeff Epler febc7a8514
format_traceback: Return list, as documented, and compatible with CPython 2022-10-13 09:38:43 -05:00
Jeff Epler 448eb1b70b
Document the 3.10-style calling pattern 2022-10-13 09:38:42 -05:00
Jeff Epler 47759294e0
code changes for supporting 1-arg print_exception 2022-10-13 09:38:42 -05:00
Jeff Epler fc991c262c
traceback: share more code between format & print exception 2022-10-13 09:38:42 -05:00
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
Dan Halbert 4cd370ecf8 Merge remote-tracking branch 'adafruit/main' into add-os-utime-function 2022-10-10 17:51:59 -04:00
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 de95463deb
Merge pull request #7023 from dhalbert/wifi-scanning-fixes
update esp-idf; allow start/stop channels in wifi scanning
2022-10-10 13:54:54 -04:00
Dan Halbert 987030e706
Merge branch 'main' into add-os-utime-function 2022-10-07 22:45:51 -04:00
Dan Halbert 747dc7746d handle scan channel bounds but note they do nothing for RP2040 CYW43 2022-10-07 16:22:17 -04:00
Dan Halbert 21c0c4c1a6 update esp-idf; allow start/stop channels in wifi scanning 2022-10-07 15:29:09 -04:00
MicroDev fc549fe345
Merge pull request #7014 from jepler/restore-nvm-module
restore nvm module
2022-10-08 00:12:41 +05:30
Dan Halbert 833f55922c
Remove multiterminal
This module has not been built in years, since the (removed) esp8266 port.
Delete the code, as it is not likely to be useful in its current form.

Closes: #7015
2022-10-06 14:02:47 -05:00
Jeff Epler f431b2459c
restore nvm module 2022-10-06 13:18:19 -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
Dan Halbert b3ca6fd011
Merge pull request #6995 from dhalbert/missing-support-matrix-modules
add missing native modules to support matrix
2022-10-04 20:49:29 -04:00
Dan Halbert ed87579a65 add missing native modules to support matrix 2022-10-04 19:22:18 -04:00
Dan Halbert 1c2d2c9be4
Merge pull request #6980 from MicroDev1/supervisor
Implement certain supervisor functions as properties
2022-10-04 08:54:11 -04:00
MicroDev 4fd15acf77
implement suggested change
pass brightness value directly

Co-authored-by: Dan Halbert <halbert@halwitz.org>
2022-10-04 08:28:48 +05:30
Dan Halbert 6dc03ae3ce fix some dotenv parsing 2022-10-03 21:56:11 -04:00
Paulus H.J. Schulinck 89e0601a39 Update I2CTarget.c
Correction of the timeout value range needed to set the timeout to 'forever'.
The line 162 checks timeout for a value of 0 while the function definition defaults timeout to -1. In the current version of the code timeout is only checked for a value of 0 or in the 'else if' part for a value of > 0. So, values of <0 will not be taken in to account.  That is the reason of my modification.
2022-10-03 13:09:40 +01:00
Paulus H.J. Schulinck 041766351c Update I2CTarget.c
Correction in function request() doc function signature.
(after speaking with @jepler on Discord).

(@jepler: 'Circuitpython always has floats enabled')
2022-10-01 22:23:17 +01:00
Paulus H.J. Schulinck d66eeaab26 Update I2CTarget.c
Modification of the doc text of function request().

1) The timout parameter is a keyword-only argument; so Added '*,' in the function signature;
2) for parameter timeout an integer is expected, not a float.
2022-10-01 21:56:07 +01:00
microDev 17ed2a6898
implement certain supervisor functions as properties
- disable_ble_workflow
- set_next_stack_limit
- set_rgb_status_brightness
2022-10-01 23:44:22 +05:30
Dan Halbert f9e655da47
Merge pull request #6962 from dhalbert/espressif-deep-sleep-hold-pins
Espressif: do not hold pins during deep sleep if not necessary
2022-09-30 22:20:44 -04:00
Jeff Epler 907c5d387f
Tweak black_bindings
Originally, black_bindings found each contiguous "//|" block and sent
it to black independently. This was slower than it needed to be.

Instead, swap the comment prefix: when running black, take off
"//|" prefixes and put "##|" prefixes on all un-prefixed lines.
Then, after black is run, do the opposite operation

This more than doubles the overall speed of "pre-commit run --all",
from 3m20s to 55s CPU time on my local machine (32.5s to under 10s
"elapsed" time)

It also causes a small amount of churn in the bindings, because
black now sees enough context to know whether one 'def' follows another
or ends the 'def's in a 'class'. In the latter case, it adds an extra
newline, which becomes a "//|" line.

I'm less sure why a trailing comma was omitted before down in
rp2pio/StateMachine.c but let's roll with it.
2022-09-30 11:18:13 -05:00
Dan Halbert 9d1b12066d Espressif: do not hold pins during deep sleep if not necessary 2022-09-29 20:11:48 -04:00