Commit Graph

1432 Commits

Author SHA1 Message Date
Neradoc 1fad969389 add unsigned ints and 64 bit types to msgpack
change msgpack error message when format invalid
2023-03-27 19:37:23 +02:00
Dan Halbert 0639c0850f
Merge pull request #7751 from hathach/add-codespell
Add codespell to pre-commit to scan and fix typo
2023-03-23 13:26:24 -04:00
Dan Halbert db76fbd55f
Merge pull request #7712 from gamblor21/ondiskgif_freemem_fix
Add deinit to OnDiskGif
2023-03-23 09:03:07 -04:00
hathach 8c1095b268
Merge branch 'main' into add-codespell 2023-03-23 14:09:57 +07:00
gamblor21 e993d0f3c3 Missing brace 2023-03-22 20:19:09 -05:00
gamblor21 3020893ba2 Tweak to try to reduce low space builds 2023-03-22 19:20:20 -05:00
gamblor21 2c1e2061db Change free function 2023-03-22 19:20:20 -05:00
gamblor21 aa423cc1c6 Free memory allocated by bitmap obj 2023-03-22 19:20:20 -05:00
gamblor21 07e83674c9 Add deinit to displayio.Bitmap 2023-03-22 19:20:20 -05:00
gamblor21 8b9f5e7f53 Remove del obj and add deinited 2023-03-22 19:20:20 -05:00
Dan Halbert 2492fb0b0a
Merge pull request #7780 from jepler/fix-struct-pack
use `values` in this error message ...
2023-03-22 20:19:08 -04:00
Dan Halbert 05e783cbbd
Merge pull request #7775 from tannewt/fix_pyportal
Add more checks for read-only Bitmaps
2023-03-22 20:16:43 -04:00
Dan Halbert 3ef2b7f81f
Merge pull request #7777 from tannewt/fix_epd_grayscale
Fix tricolor epd and add EPD feather
2023-03-22 20:13:23 -04:00
jposada202020 29613c73e1 pre-commit 2023-03-22 19:05:18 -04:00
jposada202020 0b3099a9ff adding bitmaptools circle 2023-03-22 18:44:45 -04:00
Jeff Epler 127a7092bf
use `values` in this error message ...
matching the documentation of struct.pack, which has `def pack(fmt: str,
*values: Any)` as the signature.
2023-03-22 16:11:22 -05:00
Scott Shawcroft 16c8dad078
Fix Pallete cache for grayscale and tricolor epd 2023-03-22 11:54:43 -07:00
Scott Shawcroft a280c010c2
Fix tricolor epd and add EPD feather 2023-03-22 11:14:38 -07:00
Scott Shawcroft 36dbaf4ccc
Add more checks for read-only Bitmaps
Fixes #7768
2023-03-22 10:14:42 -07:00
Jeff Epler 98c546bf57
call common validation function
Co-authored-by: MicroDev <70126934+microdev1@users.noreply.github.com>
2023-03-22 10:16:48 -05:00
Jeff Epler 349dedca54
struct: Check that argument counts match, similar to cpython3
.. and test our struct module during the build-time tests

Closes #7771
2023-03-22 09:35:09 -05:00
Dan Halbert c93560144b
Merge pull request #7678 from FoamyGuy/boundary_fill_background_tasks
do background tasks and handle interrupt during boundary fill
2023-03-21 23:38:05 -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
jposada202020 ace25e83ce correcting vectorshape location property 2023-03-20 15:44:49 -04:00
hathach fecc1bdedb
fix typos (partial) detected by codepell 2023-03-18 22:17:02 +07:00
foamyguy d30b89d8d1 Merge branch 'main' into boundary_fill_background_tasks 2023-03-14 18:24:01 -05: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 5cb21539f2 use revised USB host API on mimxrt10xx 2023-03-10 13:12:37 -05: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 7740cbac97 do background tasks and handle interrupt during boundary fill 2023-03-04 13:13:59 -06:00
Dan Halbert bac1a9625a OnDiskGif delay was being chopped to 8 bits 2023-03-02 16:47:07 -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
Scott Shawcroft b79661d631
Alphabetize, fix typo and remove incorrect comment 2023-02-23 14:34:54 -08:00
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
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
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
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
Mark fa435468fa
Merge branch 'main' into gif_displayio_support 2023-02-13 18:30:51 -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 29e91e0d4f Fix for changing frame size and disposal method issues 2023-02-12 09:11:12 -06:00
gamblor21 da9b6fb0e2 Moving library to /lib 2023-02-10 18:31:59 -06:00
Neradoc 3c93594563 Deinit the reset pin when displayio.I2CDisplay raises an exception 2023-02-10 19:54:10 +01:00
gamblor21 19eba41630 Doc fixes and return next frame delay 2023-02-08 22:58:44 -06:00
gamblor21 dbe518680a Memory savings and more properties 2023-02-05 10:54:04 -06:00
gamblor21 6a9b7199ec Initial gif proof of concept 2023-02-04 16:44:29 -06:00
foamyguy fab1bb5f21 fix for native is31fl3741 2023-02-03 17:43:12 -06:00
Maciej Sokołowski e474df3a18 Add function for drawing polygons to bitmaptools 2023-01-20 23:14:38 +01:00
Maciej Sokołowski 2276254f6c Fix compilation 2023-01-19 21:50:59 +01: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
Dan Halbert a3adcf0e1a clarify read-only mac address; reuse translate msgs 2023-01-02 10:13:20 -05:00
Jeff Epler 34043c2d38
Only store up to 'width' pixels, not 'stride'
error detected by clang scan-build static analysis
2023-01-01 16:45:40 -06:00
Jeff Epler d808185744
Emphasize that ALIGN_BITS is a constant 2023-01-01 16:45:40 -06:00
Jeff Epler d2361ae4f9
Avoid an undefined shift
(1 << 32), an operation on a signed 32-bit int, is undefined in C. The
operation on the unsigned int (1u<<32) is defined as zero, which is
the desired outcome (subtracting 1 yields the value with all bits set)

This problem was detected by clang scan-build static analysis
2023-01-01 16:45:35 -06:00
Jeff Epler 7a005aa96b
break out after reading the value
This is a small optimization, it avoids reading the full file when an
early key is requested.

In the case of an *invalid* TOML file such as
```
K=80
K=81
```
this stops the value of K actually returned being 8081 and makes it 80
instead; but as it's a malformed file it doesn't really matter much.
2022-12-28 13:24:38 -06:00
Jeff Epler 15a24b400d
Permit trailing whitespace in getenv_int 2022-12-28 12:37:27 -06:00
Jeff Epler f6b69cf5e3
Allow settings.toml to end without a newline 2022-12-26 10:53:58 -06:00
Jeff Epler 4dbbfa0931
Print errors to repl about getenv 2022-12-26 10:53:58 -06:00
Dan Halbert 398b7c26ca
Merge pull request #7321 from jepler/dotenv-becomes-toml
Dotenv becomes toml
2022-12-13 19:56:36 -05:00
Jeff Epler d40ba94449
explain why this is its own file 2022-12-13 13:19:10 -06:00
Jeff Epler 35f2046ab2
Fix returning GETENV_ERR_LENGTH for over-long strings 2022-12-13 12:02:07 -06:00
Radomir Dopieralski 6412d971fa displayio: Set in_group to false when removing a layer from a group
Otherwise the removed layer cannot be re-added.
2022-12-11 02:59:56 +01:00
Jeff Epler dd6dd5df21
rework the getenv test again
* use a virtual fat filesystem during the test
 * this makes the file I/O part more closely patch runtime which is nice
 * side-steps the need to add a special function for testing
   * but test still can't be run on a device, because the vfs calls
     are incompatible, and you intentionally can't remount "/" anyway
 * and side-steps problems with storing 'bad' toml files
2022-12-10 12:58:08 -06:00
Jeff Epler 040fac0724
No need to track excess length
.. this is a relic from when the actual required length was given
back to the caller
2022-12-09 14:29:14 -06:00
Jeff Epler cc7d550407
Really finish renaming to getenv 2022-12-09 14:28:46 -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 ef2bfdb5db
dotenv becomes settings.toml 2022-12-08 12:44:20 -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
foamyguy 57462092b5 return None instead of NULL for framebuffer and epaper 2022-12-01 17:34:43 -06:00
foamyguy 42f1d50acc remove extra function call. handle show(None) for framebuffer and epaper 2022-12-01 17:25:36 -06: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 db01dfea20
use a standard length validator 2022-11-30 12:06:19 -06:00
foamyguy 1bbdc820c0 make show(None) show the terminal 2022-11-28 17:02:46 -06:00
foamyguy 553d48f887 return None for NULL 2022-11-28 09:03:03 -06:00
foamyguy b8d6605cff code format, extra space 2022-11-27 17:26:46 -06:00
foamyguy 6844dc0cb7 code format, extra space 2022-11-27 14:20:15 -06:00
foamyguy 15a9e63fda remove is_null troubleshooting function. remove empty line 2022-11-27 14:08:38 -06:00
foamyguy 738b73d4b4 check for NULL in fill_area. moved start_terminal to reset_display. 2022-11-27 13:54:53 -06:00
foamyguy 2c479f4fce working on None behavior 2022-11-26 11:00:09 -06:00
foamyguy 57d7f7f2ad move to _pixelmap 2022-11-24 09:07:08 -06:00
foamyguy e5ea1d2247 try to revert pixelbuf merge brokenness. remove second color_u def. 2022-11-22 18:47:25 -06:00
foamyguy 19f1119994 Merge branch 'main' into fastpixelmap
# Conflicts:
#	shared-module/adafruit_pixelbuf/PixelBuf.c
2022-11-21 20:25:58 -06:00
foamyguy fa4b480439 looking into how null show works 2022-11-21 20:21:39 -06: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
foamyguy 5b64a62c16 move hidden declare inside struct 2022-11-15 18:37:23 -06:00
Jeff Epler 14ba5a75a3
skip converting from long int if long ints aren't enabled
.. saves 20 bytes on proxlight trinkey
2022-11-14 21:26:58 -06:00
Jeff Epler 2d08473ee0
this version actually saves more code space on cortex-m0 with -Os (samd21s) 2022-11-14 21:18:40 -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
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
Scott Shawcroft eb1b2f38a0
Fix USB issues caused by early usb_cdc.Serial read
Check for connected before calling read. Otherwise TinyUSB may
setup the read on the wrong endpoint.

Fixes #6018
`
2022-10-21 20:42:26 -07:00
Jeff Epler 55519670a8
Fix parsing long dotenv values
Values that exceeded the stack buffer of 64 bytes were incorrectly
handled.

A new test is added.
2022-10-13 16:41: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 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 987030e706
Merge branch 'main' into add-os-utime-function 2022-10-07 22:45:51 -04:00
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 27e6623657
Add unicode support to dotenv
Newly passing tests:
```
aa🐍bb=key with emoji
value_with_emoji=aa🐍bb
```
2022-10-05 18:18:07 -05:00
Dan Halbert 91079279da Allow spaces before = in dotenv 2022-10-05 15:50:53 -04:00
Jeff Epler 52bca95208
Refactor dotenv module so that it can be tested on host
.. it needs to operate on a FILE* rather than FIL depending on
the build.

Note that this is comparing output to expected, not to cpython dotenv
package. Because run-tests.py starts the CPython interpreter with the
'-S' (skip site initialization) flag, pip-installed packages are
not available for import inside a test file. Instead, the exp
file is generated manually:
```
circuitpython/tests$ python3 circuitpython/dotenv_test.py > circuitpython/dotenv_test.py.exp
```

Unfortunately, the test fails on test e15:
```diff
FAILURE /home/jepler/src/circuitpython/tests/results/circuitpython_dotenv_test.py
--- /home/jepler/src/circuitpython/tests/results/circuitpython_dotenv_test.py.exp	2022-10-04 09:48:16.307703128 -0500
+++ /home/jepler/src/circuitpython/tests/results/circuitpython_dotenv_test.py.out	2022-10-04 09:48:16.307703128 -0500
@@ -14,7 +14,7 @@
 line
 e13 e13value
 e14 None
-e15 e15value
+e15 None
 e16 #
 e17 def
 e18 #has a hash
```
2022-10-04 09:51:27 -05:00
Dan Halbert 6dc03ae3ce fix some dotenv parsing 2022-10-03 21:56:11 -04:00
Dan Halbert 0cd37376a0 finish status bar internal simplification 2022-09-27 15:14:40 -04:00
Jeff Epler f7221d5895
simplify logic in _clobber_points_list 2022-09-22 08:39:34 -05:00
Jeff Epler ef35ca1d3e
vectorio: Simplify argument checking of x/y values 2022-09-22 08:39:33 -05:00
Isaac Benitez 71d649613f Updated utime() to take a 2-tuple instead of a plain int 2022-09-22 00:56:44 -07:00
Isaac Benitez 5a21c30ab2 Added utime() to the os librady 2022-09-18 18:43:27 -07:00
gamblor21 863a8bce03 Fix with PWM for brightness slowing devices down 2022-09-11 20:34:53 -05:00
Dan Halbert dd37c81136
Merge pull request #6847 from dhalbert/status-bar-control
Allow enabling and disabling of status bar
2022-09-08 10:48:36 -04:00
Pepijn de Vos f69f517352
allow writing empty color frame 2022-09-06 19:32:15 +02:00
Dan Halbert 2c42a48962 Clear stale exception in _exec_result; more status_bar fixups 2022-09-01 19:29:32 -04:00
Dan Halbert 2fa671c0f8 avoid status bar updates immediately after hard restart 2022-08-30 22:33:29 -04:00
Dan Halbert 52080e24eb status bar control 2022-08-30 15:23:44 -04:00
Dan Halbert b481411541
Merge pull request #6767 from maximkulkin/usb-hid-get-last-report-fix
shared-module/usb_hid: Fix behavior of Device.get_last_received_report()
2022-08-24 08:51:35 -04:00
Maxim Kulkin aab5fac67b shared-module/usb_hid: Fix behavior of Device.get_last_received_report()
Documentation states that get_last_received_report() function should
return None if there was no report received previously, otherwise it
should return report. Moreover, same report should be returned only
once. That makes it possible to reliably process incoming OUT/Feature
reports.

This patch adds an array that stores flags if report with particular
ID was received and updates get_last_received_report() to match its
documentation.
2022-08-24 01:34:51 -04:00
gamblor21 f134f86291 Two small fixes, remove hardcoded height and non-scale issues 2022-08-19 15:13:38 -05:00
Hanns Holger Rutz 92231e88ca
Touchin.c - fix clean up in constructor before exception is thrown
When the constructor value reading times out, an exception is thrown, but the digital pin is not de-initialised. Make sure to run the clean up, so user could catch the exception and retry using the same pin.
2022-08-10 21:49:18 +02:00
Jeff Epler c2a45c1f27
Merge pull request #6739 from jepler/qrio-esp32camera
Enable qrio to work with rgb565 data, including byte-swapped data
2022-08-10 13:54:40 -05:00
Jeff Epler 5168f6ec1f Add support for RGB565 images in qrio
Most cameras produce RGB565_SWAPPED data
2022-08-10 11:13:26 -05:00
Dan Halbert 02cc6c2aee Merge remote-tracking branch 'adafruit/main' into remove-autobrightness 2022-08-10 08:35:53 -04:00
Dan Halbert 41bcd7b260 Remove support for auto-brightness 2022-08-09 22:40:21 -04:00
Jeff Epler 1da8065d6b
Merge remote-tracking branch 'origin/main' into espressif-camera-2 2022-08-05 16:38:51 -05:00
Dan Halbert 8c10e09ba0
Merge pull request #6667 from jepler/esp-reserve-heap-for-idf
Add ability to reserve psram
2022-08-05 15:06:44 -04:00
Scott Shawcroft 125b276af0
Get CIRCUITPY FATFS directly.
Otherwise, you may actually get a non-root filesystem.

Fixes #6575
2022-08-04 16:06:27 -07:00
Jeff Epler 64b1d003df
Allow a Bitmap to be constructed from a buffer (in C anyway)
.. so that Camera.take() can return one without copying
2022-08-04 15:11:58 -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
Neradoc 626296b613 implement root_group in framebufferio.FramebufferDisplay 2022-07-14 11:47:36 +02: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 b90563d504
Merge pull request #6442 from FoamyGuy/tilegrid_contains
tilegrid.contains() function
2022-06-06 11:02:43 -07:00
Dan Halbert 80ae14202a
Merge pull request #6416 from FoamyGuy/display_brightness_pwm
display brightness pwm 500hz frequency
2022-06-05 23:52:42 -04:00
foamyguy 260994d16e Merge branch 'main' into display_brightness_pwm 2022-06-04 11:32:15 -05:00
foamyguy c9c864a4f7 fix off by one right and bottom edges of tilegrid.contains() 2022-06-03 17:51:33 -05:00
foamyguy 6831dd8aaa return expression formatting 2022-06-03 17:04:53 -05:00
foamyguy 87f4cd6bca
return expression instead of if statement
Co-authored-by: Scott Shawcroft <scott@tannewt.org>
2022-06-03 16:21:50 -05:00
foamyguy ffc451b338 argument for backlight_pwm_frequency and use it in pyportal titano build 2022-05-28 12:01:05 -05:00
foamyguy db318726a2 tilegrid.contains() function 2022-05-27 18:05:44 -05:00
Scott Shawcroft 9d10a3da66
Conditionalize LTO 2022-05-27 12:59:54 -07:00
Dan Halbert d631ec38c6
Merge pull request #6407 from tannewt/dotenv
Add dotenv read support
2022-05-26 12:11:33 -04:00
Scott Shawcroft ef3c56816a
Fix two consecutive matches 2022-05-25 15:54:26 -07:00
Dan Halbert 1fb210bd40
Merge pull request #5491 from pypewpew/remove-gamepadshift
Remove gamepadshift module
2022-05-25 13:58:06 -04:00
Radomir Dopieralski c0152e7dab Remove gamepadshift module
Everything should be using the keypad module instead.

Note: there are several boards that still had gamepadshift enabled. I
did not contact their authors to make sure they already switched to
keypad in their code and documentation. We should probably wait with
merging this for their go ahead.
2022-05-25 00:48:55 +02:00
Scott Shawcroft 22cada10fa
Fix 64bit builds 2022-05-23 11:29:30 -07:00
Scott Shawcroft a6b60d2083
Merge remote-tracking branch 'adafruit/main' into dotenv 2022-05-23 11:23:20 -07:00
foamyguy 6b04b7efc8 display brightness pwm 500hz frequency 2022-05-21 12:09:23 -05:00
Dan Halbert 309dab4c75 merge 7.3.0-rc.1 changes to main 2022-05-20 15:37:56 -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 a30de85d57
Add dotenv read support
os.getenv() will use it (when available) to load variables from
/.env

This will also be useful when we need secrets or config for
CircuitPython outside of the VM (like WiFi credentials.)

Fixes #4212
2022-05-18 14:01:35 -07:00
Scott Shawcroft f975c97c63
Merge pull request #6363 from FoamyGuy/hidden_vectorio
Hidden vectorio
2022-05-18 09:00:13 -07:00
Dan Halbert 4487f61404 Restore automatic gc_collect() after an import 2022-05-18 11:37:13 -04:00
foamyguy 1c564764d6 use draw protocol impl in parent hidden too 2022-05-08 12:14:28 -05:00
foamyguy b6a5f421a9 use draw protocol impl 2022-05-08 12:02:59 -05:00
foamyguy 330e01d8e0 handle groups inside of groups with vectorio hidden 2022-05-07 12:27:36 -05:00
foamyguy c77dc3c828 code format 2022-05-07 11:59:26 -05:00
foamyguy d1aab89a59 remove prints and extra whitespace 2022-05-07 11:57:27 -05:00
foamyguy b03968aee5 hide vectorio objects if their containing group is hidden 2022-05-07 11:50:40 -05:00
foamyguy c8a98d1a18 Merge branch 'adafruit_main' into hidden_vectorio 2022-05-07 10:25:34 -05:00
Jeff Epler 030d5fefa0
Ignore SH1107 quirk if not 1bpp 2022-05-03 09:23:36 -05:00
Dan Halbert 3a8fb4e956
Merge pull request #5852 from jepler/floppy
Add floppyio
2022-04-26 11:40:19 -04:00
Dan Halbert 0642917cf7
Merge pull request #6270 from FoamyGuy/tilegrid_bitmap_property
adding bitmap property to TileGrid
2022-04-25 09:09:28 -04:00
Jeff Epler df5f7bc765
MP3Decoder: better handle indicating end of mp3 audio data to caller
The old formulation
 * wouldn't work if there were ID3 tags at the end
 * would choose whether to background-refill the inbuf
   based on a check before skipping to the next sync word, which
   could be incorrect.

I think it was aspect "B" that ended up triggering the erroneous EOF
problem fixed in the prior commit. This would depend on specific data
sizes and offsets occuring in the file such that a read would be
scheduled but then the buffer would be filled and left 100% full by
find_sync_word(). It's just lucky(?) that a particular person produced
such a file, and/or many files produced by Audacity have those
characteristics.
2022-04-22 14:11:02 -05:00
Jeff Epler 1841af90e2
Don't erroneously set EOF flag if there was room to read 0 bytes 2022-04-22 14:11:01 -05:00
foamyguy 16b81c855d adding bitmap property to TileGrid 2022-04-09 11:26:36 -05:00
foamyguy 666a5ff04c trying to make vectorio shape hidable 2022-04-09 10:09:46 -05:00
Jeff Epler f7be4345d9
Merge remote-tracking branch 'origin/main' into floppy 2022-04-07 08:37:46 -05:00
Dan Halbert 2693a4cfe1
Merge pull request #6069 from gamblor21/uzlib-module
zlib Module
2022-04-06 12:06:44 -04:00
Dan Halbert 83e1b5b058
Merge pull request #6248 from jepler/refactor-keypad
refactor keypad to share more code; fix initial keys pressed
2022-04-06 09:37:43 -04:00
Dan Halbert 359d8e5773
Merge pull request #6234 from jepler/merge-7.2.x
Merge 7.2.x
2022-04-05 16:53:22 -04:00
Jeff Epler d7c86c0e3e
refactor keypad to share more code
This saves 444 bytes on the pygamer build (both commits taken together)

testing performed:
 * pygamer (samd51) with ShiftRegisterKeys
 * macropad (rp2040) with Keys
 * UM feather s2 (esp32-s2) with KeyMatrix

Result:
 * all ports still worked nicely
 * keys held down at start always registered (>2 trials all boards, >100 trials esp32-s2)
 * keys held down are immediately registered after reset() (>100 trials esp32-s2)
 * double .reset() is OK, accessing .events throws (only tested esp32-s2)
2022-04-05 14:50:30 -05:00
Jeff Epler 203dad11bf
keypad: scan immediately on construct, .reset() 2022-04-05 14:50:30 -05:00
Jeff Epler fe98248a3d
Merge remote-tracking branch 'origin/7.2.x' into merge-7.2.x 2022-04-05 08:45:13 -05:00
Reece Robinson 4b0f80f081 Enable support for extended HID usage page and usage. Related to Support HID Usage Pages and Usages >255 #5529 2022-04-05 13:54:07 +12:00
Jeff Epler 683ece76db
MP3Decoder: Accurately inform when no more data
Some audio implementations, notably samd, really don't like it when
you return 0 samples of data. This was the case when reaching the
end of an MP3 file.

Now, we read forward in an MP3 file to the next sync word during
"get_buffer", so that we can accurately return GET_BUFFER_DONE when the
NEXT call WOULD HAVE resulted in 0 samples.

Tested with @gamblor21's "laugh.mp3" file on a Trellis M4 Express.
2022-04-04 09:16:27 -05:00
Mark 8ed7b114cd
Merge branch 'main' into uzlib-module 2022-04-03 11:48:37 -05:00
gamblor21 7d7e66f60f Fix no scaled framebuffer display 2022-03-23 17:37:56 -05:00
gamblor21 f9d7f46d67 Removing DecompIO 2022-03-23 17:02:58 -05:00
foamyguy fe8b9728e7 color index for vectorio shapes. 2022-03-19 11:30:37 -05:00
foamyguy 90fadc58fd implement color_number argument for vectorio.Rectangle 2022-03-18 18:28:29 -05:00
Scott Shawcroft dcc3ec171e
Merge remote-tracking branch 'adafruit/7.2.x' into merge_7.2.2 2022-03-15 13:56:11 -07:00
Scott Shawcroft 32ac396a41
Further refine autoreload
This unifies the delay into the post-run delay that also waits
for user input and fake sleep. This ensures we always delay.
Previous code would only delay if the code.py was running when
autoreload was triggered. Now it will always delay.

We also now suspend autoreload when a USB write starts and then
resume on completion. This should prevent reloading in between
sectors of a single write.
2022-03-14 16:49:30 -07:00
Dan Halbert e4cd9690f1 rework auto-reload delay logic 2022-03-11 14:03:04 -05:00
Scott Shawcroft 00dcf6bd03
Tweaks from review 2022-03-11 10:51:50 -08:00
Scott Shawcroft 83593a1558
Start of USB host API
This allows you to list and explore connected USB devices. It
only stubs out the methods to communicate to endpoints. That will
come in a follow up once TinyUSB has it. (It's in progress.)

Related to #5986
2022-03-07 18:07:25 -08:00
Scott Shawcroft 08b44eade5
Merge pull request #6114 from pewpew-game/displayio-9bit
Add support for 9-bit mode to displayio.FourWire
2022-03-04 16:55:02 -08:00
Radomir Dopieralski 102ee716a7 Add support for 9-bit mode to displayio.FourWire
If the ``command`` pin is None, that information will instead be
sent as a ninth bit in the SPI transactions.

Fix #6109
2022-03-04 22:59:17 +01:00
Tsutomu IKEGAMI c9aa4527a9 Fix freeze on bitmaptools.dither 2022-03-04 17:06:07 +09:00
Dan Halbert a45f9a83ea Merge remote-tracking branch 'adafruit/7.2.x' into merge-7.2.x-to-main 2022-02-24 13:07:56 -05:00
Kevin Matocha 790af2d9a6 fix REPL terminal garbled characters upon code.py finished 2022-02-21 14:58:16 -06:00
Kevin Matocha 6b2266b240 retains REPL terminal data after display.show(None) when terminal size is not changed 2022-02-21 10:33:48 -06:00
Kevin Matocha 03f42406d3 updated code so the REPL will retain its text if not resized when code stops 2022-02-21 10:33:08 -06:00
Michael Himing 4bd64885b4 msgpack.unpack requires a readable stream 2022-02-21 09:16:36 +11:00
gamblor21 664e02535b Renaming and documentation 2022-02-20 15:32:44 -06:00