Commit Graph

2762 Commits

Author SHA1 Message Date
Dan Halbert
7ee85408a1
Merge pull request #7755 from isacben/block-device-arguments-typing
Updated block_device type annotation
2023-03-21 12:51:40 -04:00
Scott Shawcroft
67e0a49a1f
Merge pull request #7724 from tannewt/get_perfbench_running
Improve iMX RT performance
2023-03-21 09:00:48 -07:00
Dan Halbert
d9d27a3e31
Fix signature of mkfs() 2023-03-21 10:30:03 -04:00
Isaac Benitez
9e630a565e Updated block_device type annotation 2023-03-19 15:08:29 -07:00
hathach
fecc1bdedb
fix typos (partial) detected by codepell 2023-03-18 22:17:02 +07:00
Dan Halbert
ca292f3427 Turn off mkfs FAT32 on all SAMD21 builds; note in doc 2023-03-17 12:18:24 -04:00
Dan Halbert
5569f101a7
Document that storage.VfsFat.mkfs() is a @staticmethod 2023-03-17 10:50:07 -04:00
Carlin Kartchner
058a8e65d8 define frame delay before reference 2023-03-16 18:22:24 -04:00
Scott Shawcroft
5bb8a7a7c6
Improve iMX RT performance
* Enable dcache for OCRAM where the VM heap lives.
* Add CIRCUITPY_SWO_TRACE for pushing program counters out over the
  SWO pin via the ITM module in the CPU. Exempt some functions from
  instrumentation to reduce traffic and allow inlining.
* Place more functions in ITCM to handle errors using code in RAM-only
  and speed up CP.
* Use SET and CLEAR registers for digitalio. The SDK does read, mask
  and write.
* Switch to 2MiB reserved for CircuitPython code. Up from 1MiB.
* Run USB interrupts during flash erase and write.
* Allow storage writes from CP if the USB drive is disabled.
* Get perf bench tests running on CircuitPython and increase timeouts
  so it works when instrumentation is active.
2023-03-14 12:30:58 -07:00
Dan Halbert
5ec586019b fix TimeAlarm signature 2023-03-14 13:27:57 -04:00
Dan Halbert
d4840cbf10 translate() messages must be one string 2023-03-14 13:13:58 -04:00
Scott Shawcroft
9251c6f988
Merge pull request #7684 from isacben/document-aeios-AES-rekey
Document aeios.AES.rekey() and refactor arg validation
2023-03-08 10:47:12 -08:00
Isaac Benitez
b7db2896d1 Second fix for the IV argument capitalization (documentation) 2023-03-07 10:12:57 -08:00
MicroDev
b9e478af39
Merge pull request #7471 from matemaciek/main
Add function for drawing polygons to bitmaptools
2023-03-07 08:28:07 +05:30
foamyguy
812fa2b34b change docstring, add example code. 2023-03-06 16:55:12 -06:00
Isaac Benitez
8955caff44 Fix capitalization of the IV argument (documentation) 2023-03-06 10:38:28 -08:00
Isaac Benitez
90155925d5 Document aeios.AES.rekey() and refactor arg validation 2023-03-05 12:58:40 -08:00
Dan Halbert
0ca6cc7741
Merge pull request #7668 from jepler/gifio-directio-example
document going directly to display with ondiskgif
2023-03-04 12:25:55 -05:00
Dan Halbert
2ac1c7a020
Add blank line after code-block 2023-03-04 11:59:31 -05:00
foamyguy
213a8bbdc1 Merge branch 'main' into displayio_arg_validation
# Conflicts:
#	shared-bindings/displayio/Palette.c
2023-03-04 10:11:47 -06:00
Dan Halbert
bac1a9625a OnDiskGif delay was being chopped to 8 bits 2023-03-02 16:47:07 -05:00
Jeff Epler
6eae40338c
fix problems spotted very quickly by gamblor :) 2023-03-01 17:56:18 -06:00
Jeff Epler
ac0bf1049a
document going directly to display with ondiskgif 2023-03-01 17:50:02 -06:00
Dan Halbert
5386cafa21 Update gifio and displayio documentation 2023-02-28 13:02:24 -05:00
Dan Halbert
f214d6b336
Merge pull request #7649 from jepler/improve-pwmio-documentation
Improve pwmio documentation
2023-02-25 21:35:06 -05:00
gamblor21
ce3da1ec66 Small doc change 2023-02-25 14:15:33 -06:00
Jeff Epler
07b3bd6d77
Improve pwmio documentation
#7644 pointed out the need for better documentation.

To the best of my ability I noted the current behavior.
I think that there may be some ports that do not actually read
back the 'set' frequency value, but they are ports marked as beta
status (mimxrt10xx) or not maintained by us (cxd56).
2023-02-25 11:02:49 -06:00
gamblor21
328a08729d Example fix 2023-02-25 09:16:33 -06: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
460dda0426
Merge pull request #7616 from dhalbert/8.0.x-fix-atmel-uart
Fix pad assignments on atmel-samd UART
2023-02-22 17:24:29 -05:00
Scott Shawcroft
de5f58a61d
Merge branch 'main' into banglejs2 2023-02-21 12:04:28 -08:00
Scott Shawcroft
a8b34bd067
Merge pull request #7549 from gamblor21/gif_displayio_support
Animated GIF support
2023-02-21 11:39:29 -08:00
foamyguy
3601bb3062 change value_count max 2023-02-20 20:37:42 -06:00
Dan Halbert
6d51356324 Fix pad assignments on atmel-samd UART 2023-02-19 20:42:44 -05:00
Dan Halbert
3f66a0be83
Merge pull request #7611 from gamblor21/colorconverter-mem-fix
ColorConverter output colorspace non-initialization fix
2023-02-19 20:34:30 -05:00
gamblor21
e78875a93b ColorConverter output colorspace fix 2023-02-18 15:35:56 -06:00
foamyguy
694537acb3 change validation maximum computation 2023-02-18 10:35:39 -06:00
gamblor21
c637ec9ea0 Removed forgotten func defn 2023-02-17 23:37:49 -06:00
gamblor21
b2a205e615 Doc fix 2023-02-17 15:48:26 -06:00
gamblor21
20eb7d11bd Changes times to seconds, remove dirty bitmap flag 2023-02-17 13:06:56 -06:00
Scott Shawcroft
931c7c1c51
Add Bangle.js 2, JDI memory displays and ACeP epd
This 2-in-1 PR started with the goal of support the Bangle.js 2
smartwatch with *no USB*.
* Adds "secure" DFU build support with a committed private key.
* Adds 3-bit color support with one dummy bit for the JDI memory display
* Allows nrf boards to have a board_background_task() run in RUN_BACKGROUND_TASK.
  This is needed because the Bangle.js 2 uses the watchdog to reset.
* Renamed port_background_task() to port_background_tick() to indicate it
  runs on tick, not RUN_BACKGROUND_TASK.
* Marks serial connected when the display terminal is inited. This means
  that safe mode messages show up on the display.

ACep, 7-color epaper displays also pack 3 bits in 4. So, I added that
support as well.
* Adds 3-bit ACeP color support for 7-color e-paper displays. (Not
  watch related but similar due to color depth.)
* Allows a refresh sequence instead of a single int command. The 7" ACeP
  display requires a data byte for refresh.
* Adds optional delay after resetting the display. The ACeP displays
  need this. (Probably to load LUTs from flash.)
* Adds a cleaning phase for ACeP displays before the real refresh.

For both:
* Add dither support to Palette.
* Palette no longer converts colors when set. Instead, it caches
  converted colors at each index.
* ColorConverter now caches the last converted color. It should make
  conversions faster for repeated colors (not dithering.)
2023-02-15 15:03:40 -08:00
Dan Halbert
328585f160 don't enter safemode.py on USER safe mode 2023-02-14 11:20:29 -05:00
Dan Halbert
d46d9d5c21 shorten safe mode messages; improve message printing; fix CIRCUITPY_SAFEMODE_PY=0 2023-02-13 21:29:57 -05:00
Mark
fa435468fa
Merge branch 'main' into gif_displayio_support 2023-02-13 18:30:51 -06:00
Dan Halbert
d8231f1588 Implement safemode.py 2023-02-13 18:26:38 -05:00
gamblor21
88212b066e Doc fix 2023-02-13 11:32:25 -06:00
gamblor21
cab38ed6a6 Doc fixes and renamed play_frame to next_frame 2023-02-12 11:51:23 -06:00
gamblor21
0c95e6a08e Moving to gifio module 2023-02-12 11:17:34 -06:00
gamblor21
da9b6fb0e2 Moving library to /lib 2023-02-10 18:31:59 -06:00
foamyguy
5f3f87e371 validate palette color count and group scale 2023-02-10 18:05:07 -06:00
foamyguy
67fd815e27 maximum value validation for bitmap constructor 2023-02-10 17:39:38 -06:00
foamyguy
bb4cccc1cd use range instead of min where applicable to consolodate bounds checks 2023-02-10 17:26:01 -06:00
gamblor21
19eba41630 Doc fixes and return next frame delay 2023-02-08 22:58:44 -06:00
foamyguy
efe48e61ed argument bounds validation for bitmap.blit() 2023-02-06 17:03:49 -06:00
gamblor21
dbe518680a Memory savings and more properties 2023-02-05 10:54:04 -06:00
gamblor21
2b26242c66 need gif.c in shared-bindings to build 2023-02-04 18:38:07 -06:00
gamblor21
6a9b7199ec Initial gif proof of concept 2023-02-04 16:44:29 -06:00
foamyguy
beb4a797ff bitmap fill, __get_item__, and __set_item__ positive validation 2023-02-04 12:37:43 -06:00
foamyguy
547ca5a452 bitmap constructor positive validation 2023-02-04 12:02:06 -06:00
MicroDev
d9d94eacca
run updated pre-commit 2023-02-01 13:38:41 +05:30
MicroDev
4ef363a797
improve dualbank and storage extension docs 2023-01-29 23:16:45 +05:30
Neradoc
f0058774d0 add CIRCUITPY_SKIP_SAFE_MODE_WAIT to circuitpy_mpconfig.mk
use #if (also a CIRCUITPY_ULAB)
2023-01-29 00:56:16 +01:00
MicroDev
cda5689263
move esp32_camera to espcamera 2023-01-27 22:05:43 +05:30
Maciej Sokołowski
e474df3a18 Add function for drawing polygons to bitmaptools 2023-01-20 23:14:38 +01:00
Dan Halbert
7dd76fc7e4
Merge pull request #7467 from matemaciek/main
Allow lines with ends out of bitmap in `bitmaptools_obj_draw_line`
2023-01-19 21:11:17 -05:00
Maciej Sokołowski
483f14b73f Allow lines with ends out of bitmap in bitmaptools_obj_draw_line 2023-01-19 21:37:25 +01: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
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
Colin B
bfba1e4100 Change common_hal_mcu_processor_set_frequency to void
* Add warning about setting RP2040 frequency
2023-01-16 21:26:13 -08:00
Scott Shawcroft
8b0db804ba
Fix SPI readinto with negative start or end 2023-01-12 16:25:11 -08:00
Scott Shawcroft
987d9a31c8
Fix pin_or_none 2023-01-12 16:03:45 -08:00
Scott Shawcroft
ee2fe993dd
Fix repeated MDNS use on Pico W 2023-01-12 14:56:06 -08:00
Scott Shawcroft
ca80f30348
Share the web workflow MDNS object with the user
Fixes #7369
2023-01-11 16:05:19 -08:00
Scott Shawcroft
aa2ba4d88b
Have start and end kwargs respect element size
The comment says it is `buffer[start:end]` but it assumed elements
were a single byte long. Now it correctly does multibyte elements
from array.array.

Fixes #4988
2023-01-11 15:36:41 -08:00
Dan Halbert
a974402542 Improve type validation errors messages, especially for pins 2023-01-10 15:02:55 -05:00
Colin B
a84a8855ed Add frequency setting for RP2040 boards. 2023-01-07 17:41:37 -08:00
Scott Shawcroft
6b3ae630a9
Improve time alarm doc
Fixes #7406
2023-01-04 14:16:35 -05:00
Dan Halbert
03b43b7b3f complete rework for microcontroller.cpu.frequency and wifi.radio MAC addresses 2023-01-02 11:45:58 -05:00
Dan Halbert
a3adcf0e1a clarify read-only mac address; reuse translate msgs 2023-01-02 10:13:20 -05:00
Jeff Epler
928fb0a9c4
Make the "name or service not known" message translatable 2022-12-26 13:58:31 -06:00
Scott Shawcroft
c16b42e972
Tweak arg checking and comments 2022-12-20 11:00:13 -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
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
5ac622a30d
get rid of nearly-empty getenv.c file 2022-12-13 13:13:01 -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
a05829528b
_environ: update documentation 2022-12-08 13:36:48 -06:00
Jeff Epler
ef2bfdb5db
dotenv becomes settings.toml 2022-12-08 12:44:20 -06:00
s-ol
99b8564e8f Add VfsFat.readonly property for getting current state
Previously the only other way of determining whether the Vfs has been mounted
read-write or read-only appears to be to attempt a write operation and detect a
possible OSError.

It wasn't possible for the user code to keep track of the state of the state
since the boot VM has to decide whether to (re)mount read-write or read-only,
but can't (easily) pass this information on to the runtime VM.
2022-12-08 14:45:24 +01:00
Scott Shawcroft
4c064c263e
Merge pull request #7294 from tannewt/analogbufio_rework
Rework the analogbufio API.
2022-12-02 14:53:16 -08:00
Scott Shawcroft
d6c3dfb461
Merge pull request #7297 from jepler/chain-exception-doc
Implement the chain= argument of traceback.print_exception
2022-12-02 14:53:03 -08:00
Scott Shawcroft
f7504ff857
Tweaks based on review comments 2022-12-02 10:19:31 -08:00
Jeff Epler
b83c42e41a
Implement the chain= argument of traceback.print_exception 2022-12-02 10:50:31 -06:00
Scott Shawcroft
9e104c04ae
Merge pull request #7215 from FoamyGuy/set_root_group
displayio.show() API change
2022-12-02 08:45:20 -08:00
Scott Shawcroft
255e997345
Rework the analogbufio API.
* read() is now readinto() and takes the buffer to write into.
* readinto() returns the number of valid samples.
* readinto() can be interrupted by ctrl-c.
* readinto() API doesn't support signed numbers because it never did.
* sample_rate is now required in the constructor because supported
  values will vary per-port.
* 16 bit values are full range. 12 bit samples from RP2040 are stretched
  in the same way they are for AnalogIn.

Fixes #7226
2022-12-01 17:46:07 -08:00
Dan Halbert
082b0d1aed
Merge pull request #7191 from jepler/fastpixelmap
Add a fast PixelMap-like class
2022-12-01 11:43:00 -05:00
foamyguy
0563487433 get slicing 2022-11-30 19:16:20 -06:00
Jeff Epler
530e5a1df2
Use standard validation function 2022-11-30 14:39:51 -06:00
Jeff Epler
c46e219795
Having an input-only pin is rare, save a string on other ports 2022-11-30 14:39:49 -06:00
Jeff Epler
d39d146352
Merge some messages 2022-11-30 14:39:47 -06:00
Jeff Epler
f67bca94c4
On python3 log(0) raises math domain error, not zerodivisionerror 2022-11-30 14:39:33 -06:00
Jeff Epler
2b01c139f5
use a standard validator function 2022-11-30 12:06:20 -06:00
Jeff Epler
7c9cd567a0
If uart is disabled, no pins will work; show NotImplementedError instead 2022-11-30 12:06:18 -06:00
Jeff Epler
8658e7a954
re-use length validator 2022-11-30 12:06:18 -06:00
Jeff Epler
ac999098ee
merge a message 2022-11-30 12:06:18 -06:00
Jeff Epler
6ac2022093
merge a message 2022-11-30 12:06:16 -06:00
Jeff Epler
284ac21f51
merge a message 2022-11-30 12:06:16 -06:00
Dan Halbert
1bcfff3716
Merge pull request #7272 from tannewt/picow_mdns
Add MDNS support to Pico W
2022-11-29 10:09:24 -05:00
MicroDev
8a9d841da9
Merge pull request #7275 from jshimbo/main
supervisor.ticks_ms() documentation has an error
2022-11-29 14:34:24 +05:30
MicroDev
e93af31b63
Merge pull request #7269 from jepler/socketpool-gaierror
Add SocketPool.gaierror
2022-11-29 14:33:12 +05:30
Scott Shawcroft
81afe05811
Merge pull request #7265 from jepler/wifi-monitor-docs
Fix documentation of wifi.Monitor
2022-11-28 16:23:40 -08:00
Scott Shawcroft
c13ca95da1
Add MDNS support to Pico W
This adds both cpy-MAC.local and circuitpython.local support.

Fixes #7214
2022-11-28 16:15:28 -08:00
Jeff Epler
aef55b7e41
Add SocketPool.gaierror
gaierror(-2) is raised in the failure case of getaddrinfo. This is
compatible with cpython's socket module.

Typical session:
```
>>> import socketpool
>>> import wifi
>>> socket = socketpool.SocketPool(wifi.radio)
>>> try: socket.getaddrinfo("boo", 0)
... except socket.gaierror as e: ee = e
...
>>> type(ee)
<class 'gaierror'>
>>> ee.errno == socket.EAI_NONAME
True
>>> ee.strerror
'Name or service not known'
>>> raise ee
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 1, in <module>
gaierror: (-2, 'Name or service not known')
```

Closes: #6941
2022-11-28 16:57:44 -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
Jeff Epler
e1c025d6dd
Fix documentation of wifi.Monitor
Its methods & properties were incorrectly documented as being directly
in 'wifi'
2022-11-28 13:30:08 -06:00
foamyguy
57d7f7f2ad move to _pixelmap 2022-11-24 09:07:08 -06:00
Jeffrey Shimbo
c0b57ff8c5
Typo in docs for supervisor.ticks_ms()
https://docs.circuitpython.org/en/latest/shared-bindings/supervisor/index.html#supervisor.ticks_ms
ticks_add() helper function has an error
2022-11-24 06:05:46 -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
dc20390588
Fix stubs 2022-11-22 09:04:12 -08:00
foamyguy
19f1119994 Merge branch 'main' into fastpixelmap
# Conflicts:
#	shared-module/adafruit_pixelbuf/PixelBuf.c
2022-11-21 20:25:58 -06: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
s-ol
40d35e9eaa Don't block in I2CTarget.request(-1)
Partially reverts #6985
Closes #7241
2022-11-20 16:08:00 +01:00
foamyguy
ef3398422a allow set_root_group for FrameBufferDisplay instead of show() 2022-11-19 11:41:48 -06:00
foamyguy
e3cae22297 allow set_root_group for EPaperDisplay instead of show() 2022-11-18 17:34:03 -06:00
foamyguy
403e3ef430 change to CIRCUITPYTHON_TERMINAL. change internal API to use set_root_group 2022-11-18 16:53:18 -06:00
MicroDev
f637332de6
Merge pull request #7209 from jepler/code-optimize-pixelbuf
Save code space by packing rgbw values into C union
2022-11-18 14:46:55 +05:30
Scott Shawcroft
866ff5bd21
Merge pull request #7197 from FoamyGuy/vectorio_hidden
implement self hidden property for vectorio shapes
2022-11-16 12:56:10 -08:00
foamyguy
788638f727 displayio.SERIAL_GROUP constant 2022-11-15 19:15:25 -06:00
foamyguy
1329fe998c add to .h and format code 2022-11-14 15:33:55 -06:00
foamyguy
2cd5d4f5a5 allow setting root_group on Display 2022-11-14 15:10:28 -06:00
Jeff Epler
adca341d3b
Save code space by packing rgbw values into C union
It's more efficient passing one register-sized structure than 4
arguments or 4 pointers; working on intermediate values of 'int' size
is also more efficient in code size!

On raspberry pi pico w, this increased free flash space by +104 bytes.
It also increased the speed of my testing animation very slightly, from
187fps to 189fps when run 'unthrottled'
2022-11-14 09:29:45 -06:00
Jeff Epler
cdab078d9d
shared-bindings: Get rid of CYW43 special cases in shared-bindings
.. by moving it into a new weak function that can be replaced
just by the picow build.
2022-11-14 08:44:08 -06:00
foamyguy
56be547754 fix type name 2022-11-11 20:18:42 -06:00
foamyguy
3c4d8c6926 implement self hidden property for vectorio shapes 2022-11-11 17:50:07 -06:00
Jeff Epler
f5c637dc10
Add adafruit_pixelmap.PixelMap
.. a fast helper for animations. It is similar to and inspired by the
PixelMap helper in Adafruit LED Animation library, but with an extremely
fast 'paste' method for setting a series of pixels. This is a common
operation for many animations, and can give a substantial speed improvement.

It's named `adafruit_pixelmap` so that we can package a compatible version
in pure Python for systems that can't fit it in C in flash, or for
Blinka.

This is a proof of concept and can make a very fast comet animation:
```python
import time
import adafruit_pixelbuf
import adafruti_pixelmap
import board
import neopixel
from supervisor import ticks_ms
from adafruit_led_animation.animation.solid import Solid
from adafruit_led_animation import color

pixel_pin = board.GP0
pixel_num = 96

pixels = neopixel.NeoPixel(pixel_pin, pixel_num, brightness=1, auto_write=False, pixel_order="RGB")

evens = adafruit_pixelmap.PixelMap(pixels, tuple(range(0, pixel_num, 2)))
odd_indices = tuple((i, i+2) for i in range(1, pixel_num, 4))
print(odd_indices)
odds = adafruit_pixelbuf.PixelMap(pixels, odd_indices)
assert len(odds) == len(odd_indices)


comet_length = 16

comet1 = [color.calculate_intensity(color.GREEN, ((1+i) / comet_length) ** 2.4)
        for i in range(comet_length)]
comet2 = [color.calculate_intensity(color.PURPLE, ((1+i) / comet_length) ** 2.4)
        for i in range(comet_length)]

pos1 = 0
pos2 = 96//4

while True:
    evens.paste(comet1, pos1, wrap=True, reverse=False, others=0)
    pos1 = (pos1 + 1) % len(evens)

    odds.paste(comet2, pos2, wrap=True, reverse=True, others=0)
    pos2 = (pos2 - 1) % len(odds)
    pixels.show()

    m = ticks_ms()
    if m % 2000 > 1000:
        time.sleep(.02)
```
2022-11-11 07:54:33 -06:00
Jeff Epler
09f6919c93
Add ability to read VOLTAGE_MONITOR on Pico W
Because this must be treated like an in-use pin for all other purposes,
unfortunately a special case must be added in shared-bindings.

Multiple AnalogIn objects for VOLTAGE_MONITOR can be created (because
in use tracking isn't working) but this causes no harm.

Testing performed: Read the monitor, then imported wifi. When the
pin state was insufficiently restored, the second step would fail
with debug messages about do_ioctl timeout.

```
import analogio, board
a = analogio.AnalogIn(board.VOLTAGE_MONITOR)
print(a.value)
import wifi
```

Closes: #7020
2022-11-08 09:37:15 -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
Dan Halbert
db065a299f
Merge pull request #6933 from jepler/🥧🐮
Implement a useful subset of `wifi` and `socketpool` modules on 🥧🐮
2022-09-28 18:09:24 -04:00
Jeff Epler
d59774d750
don't use regcomp to check hostname validity 2022-09-28 15:11:55 -05:00
Jeff Epler
dbd7ce9fdc
restore checking hostname format on esp32 where it was checked before 2022-09-28 14:38:13 -05:00
Jeff Epler
bc63f9370a
comment why it's this way 2022-09-28 14:38:11 -05:00
Jeff Epler
ff7731491e
Implement enough of socketpool to do ntp and non-https requests 2022-09-28 10:06:34 -05:00
Jeff Epler
a7a1bd7880
Implement DNS resolution
```
>>> s = socketpool.SocketPool(wifi.radio)
>>> s.getaddrinfo("google.com", 80)
[(0, 0, 0, '', ('142.250.81.206', 80))]
```
2022-09-28 10:06:33 -05:00
Jeff Epler
6c3cdceb45
Implement scan, connect, ping
My pings go out, and then they come back

```py
import os
import wifi
import ipaddress

wifi.radio.connect(os.getenv('WIFI_SSID'), os.getenv('WIFI_PASSWORD'))
ipv4 = ipaddress.ip_address("8.8.4.4")
print("Ping google.com: %f ms" % (wifi.radio.ping(ipv4)*1000))
```
2022-09-28 10:06:33 -05:00
Jeff Epler
346fff2e7c
cyw43 basic gpio support, hwaddr in boot_out 2022-09-28 10:06:33 -05:00
Jeff Epler
b2cc8d2aad
run black_bindings across all bindings 2022-09-27 15:21:42 -05:00
Jeff Epler
4e96667d50
Manual fix for oddball cases 2022-09-27 15:19:32 -05:00
Jeff Epler
c415c13517
mend broken doc block
Since black_bindings.py will pass each contiguous
"//|"-block to black independently, they must each be a fully
formed Python item.
2022-09-27 15:19:31 -05:00
Jeff Epler
da4f2db1df
Add missing type annotations
These are treated as warnings by extract_pyi, so they don't stop
the build process.
2022-09-27 09:10:55 -05:00
Dan Halbert
a7b10d41b4
Merge pull request #6522 from jepler/must-be-int
Improve argument checking & reduce strings to translate
2022-09-25 17:55:56 -04:00
Dan Halbert
c291a02bcc
Merge pull request #6943 from snkYmkrct/main
Support for opening a file by name in MP3Decoder
2022-09-25 17:53:51 -04:00
snkYmkrct
d7ea1c39c6 Minor update to MP3Decoder documentation 2022-09-25 13:34:50 +02:00
snkYmkrct
ee6bd09438 Rename method, and remove redundant checks 2022-09-25 10:42:49 +02:00