Commit Graph

274 Commits

Author SHA1 Message Date
Scott Shawcroft 3a2bcbc5c7
Enable title bar on all builds
* Tweak scroll area position so last line is complete and top is
  under the title bar.
* Pick Blinka size based on the font to minimize unused space in
  title bar. Related to #2791
* Update the title bar after terminal is started. Fixes #6078

Fixes #6668
2022-08-04 16:33:10 -07: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
Scott Shawcroft ac460dd1e1
Merge branch 'main' into esp32 2022-07-13 15:30:53 -07:00
Scott Shawcroft 8093f8e555
Default gifio to camera setting 2022-07-12 14:12:25 -07:00
Dan Halbert d869b441f4 further ESP32 sdkconfig fixes; add CIRCUITPY_STATUS_BAR 2022-07-08 15:27:00 -04:00
Scott Shawcroft 07b2697ae3
WIP websocket to serial 2022-07-01 16:57:10 -07:00
Dan Halbert 8bb369cac5 refactor debug UART to console UART; get working on ESP32 2022-06-30 23:16:46 -04:00
Scott Shawcroft 1a3d2a5b5e
Shrink nrf52833 builds
Make them CIRCUITPY_FULL_BUILD = 0 and rework the boards to have
the same modules enabled (ish.)

Also make ZLIB require FULL_BUILD and disable advanced `micropython`
module APIs by default on all builds.
2022-06-13 15:36:15 -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 dc5565a5ce
Merge pull request #6436 from dhalbert/judicious-lto
LTO: Use -flto and -flto-partition only as needed
2022-05-27 10:31:06 -07:00
Dan Halbert d631ec38c6
Merge pull request #6407 from tannewt/dotenv
Add dotenv read support
2022-05-26 12:11:33 -04:00
Dan Halbert 95fc7e4713 harmless change to force all ports to build 2022-05-26 11:52:58 -04: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 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
Jeff Epler 510890b207
Enable squeezing property storage in flash
.. and enable it on atmel-samd and raspberrypi. On trinket_m0 this saves
96 net bytes of flash. There are 216 bytes actually saved by reducing
the flash storage size of the property descriptors, but added code in
several paths takes back over half of the 'raw savings'.

By organizing the "get-only" and "get-set" (but no delete) properties
each in a different section, we can represent then more efficiently.

Testing performed: that a get-only property can still be gotten but
can't be set or deleted; that a get-set property can sill be gotten or
set but can't be deleted.  Tested on pygamer.

Because this requires linker file support, I only enabled it on two of
the ports.
2022-05-03 08:48:53 -05:00
Dan Halbert 3a8fb4e956
Merge pull request #5852 from jepler/floppy
Add floppyio
2022-04-26 11:40:19 -04:00
Dan Halbert 4aea8049c5
Merge pull request #6279 from mjs513/main
Added Settable Clock for MIMXRT BOARDS
2022-04-20 08:31:41 -04:00
George White 32fc084b39 Removed compiler flag in favor of MP_WEAK implementation 2022-04-18 13:10:12 +00:00
George White f502703e52 Add hook to do some flash setup before filesystem init 2022-04-18 13:10:12 +00:00
mjs513 fd41c1ac5b Update based on PR Comments 2022-04-14 06:45:16 -04:00
Jeff Epler f7be4345d9
Merge remote-tracking branch 'origin/main' into floppy 2022-04-07 08:37:46 -05:00
Mark 8ed7b114cd
Merge branch 'main' into uzlib-module 2022-04-03 11:48:37 -05: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
Dan Halbert f13d218749
Merge pull request #6125 from tannewt/usb_host
Start of USB host API
2022-03-11 21:41:28 -05: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
Dan Halbert 1164f2b081 implement: from __future__ import annotations 2022-03-04 14:16:40 -05:00
gamblor21 664e02535b Renaming and documentation 2022-02-20 15:32:44 -06:00
gamblor21 ba229f1007 Initial commit of uzlib module 2022-02-19 10:41:42 -06:00
Jeff Epler 684faab110
Enable the "lookup cache" for FULL_BUILDs
.. and remove a stanza for the "cache map lookup in bytecode" option,
which has been removed by upstream in 1.18; it's superceded by these
other improvements.
2022-02-18 08:32:39 -06:00
Jeff Epler 4f47a5e61c
Adapt from our FROZEN_MPY_DIRS to manifests, incuding preprocessing 2022-02-16 15:34:00 -06:00
Jeff Epler d816a4f19d
Add floppyio
Initially enabled for samd51, this enables reading raw flux data as well
as DOS/MFM formatted media.

This is only the low-level code for reading & decoding flux pulses from a floppy drive.
high level details will live in a Python library.

adafruit-circuitpython-floppy will take care of details like stepping
from track to track, etc.
2022-01-13 15:37:36 -06:00
EmergReanimator 6dbb662787 Allow to tailor tinyusb configuration for port specific needs 2022-01-05 19:28:07 +01:00
Jeff Epler 1d13c4ccd1
Centralize LONGINT_IMPL handling
This closes #5782
2021-12-27 10:21:47 -06:00
Scott Shawcroft ee5536386d
Merge remote-tracking branch 'adafruit/main' into rpi 2021-11-24 14:23:23 -08:00
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
gamblor21 d063bf2675 Initial commit for IS31 2021-11-20 13:46:11 -06:00
Dan Halbert b01e2d6674 enable running asyncio 2021-11-10 16:00:38 -05:00
Jeff Epler 3e020a73a8 Disable gifio if no displayio & for small boards
Technically all gifio needs from displayio is the definition of
colorspaces, but let's just disable it for now.
2021-10-26 08:54:18 -05:00
Jeff Epler c34b6f757f Implement gifio.GifWriter
This involves:
 * Adding a new "L8" colorspace for colorconverters
 * factoring out displayio_colorconverter_convert_pixel
 * Making a minimal "colorspace only" version of displayio for the
   unix port (testing purposes)
 * fixing an error message

I only tested writing B&W animated images, with the following script:
```python
import displayio
import gifio

with gifio.GifWriter("foo.gif", 64, 64, displayio.Colorspace.L8) as g:
    for i in range(0, 256, 14):
        data = bytes([i, 255-i] * 32 + [255-i, i] * 32) * 32
        print("add_frame")
        g.add_frame(data)

# expected to raise an error, buffer is not big enough
with gifio.GifWriter("/dev/null", 64, 64, displayio.Colorspace.L8) as g:
    g.add_frame(bytes([3,3,3]))
```
2021-10-26 08:54:18 -05:00
Jeff Epler 53c5bde924 core: Enable new performance optimizations
These two optional optimzations take a little codespace but improve
bytecode performance:
 * https://github.com/micropython/micropython/pull/7680
 * https://github.com/micropython/micropython/pull/7688
2021-10-15 10:39:47 -05:00
Scott Shawcroft 973a90f2aa
Rename esp32s2 port to espressif
This is in preparation for ESP32-S3 support and potentially others.

Related to #4363
2021-09-13 16:44:55 -07:00
microDev d526925d49
make aesio module full build dependent 2021-09-02 19:02:01 +05:30
Jeff Epler 7520feed1c Move ParallelBus to its own module 2021-08-29 07:33:54 -05:00
microDev 25437dcb33
Merge branch 'main' into atexit 2021-08-20 09:45:54 +05:30
microDev 1c4a6c3667
atexit module refinements
- add test for atexit module
- add callback to gc collection
- fix callback memory allocation
- execute callback on both code and repl exit
2021-08-16 21:37:32 +05:30
Scott Shawcroft de796e2304
Move OneWire to `onewireio` from `busio`
This will allow finer grained inclusion in 8.0.0

Fixes #5135
2021-08-12 10:47:14 -07:00
Scott Shawcroft fb6b438580
Make `getpass` and `traceback` full build only
This leaves much more space on SAMD21 builds that aren't "full builds".
These are new APIs that we don't need to add to old boards.

Also, tweak two Arduino boards to save space on them.
2021-08-11 14:47:35 -07:00
Scott Shawcroft 0c1d6cef75
Merge remote-tracking branch 'adafruit/main' into fix_cp_irremote 2021-08-11 13:43:59 -07:00
Scott Shawcroft 083960ce90
Fix SAMD51 builds and Prox Trinkey
Adds CIRCUITPY_BUSIO_UART to disable UART by raising ValueError
that no pins work.
2021-08-11 11:53:26 -07:00
microDev 51f8603783
add getpass module 2021-08-09 17:50:28 +05:30
microDev 063e3946d6
Merge pull request #5094 from jepler/quirc
Add qrio: Decode QR codes with quirc lib
2021-08-07 09:30:20 +05:30
Jeff Epler bd903f2f03 Add qrio: Decode QR codes with quirc lib 2021-08-04 09:16:00 -05:00
microDev a3998d0626
add atexit module 2021-07-30 09:32:28 +05:30
microDev f371c0a609
add traceback module 2021-07-28 18:06:23 +05:30
Dan Halbert 901a6c27c0 remove gamepad; deprecate gamepadshift 2021-07-26 22:15:09 -04:00
Scott Shawcroft f84cb94819
Remove OSError(0) and old network modules
The newer modules are `socketpool` and `ssl`.

Fixes #3924, related to #2021, closes #1880, closes #2273, closes #2274
2021-07-21 17:33:40 -07:00
Scott Shawcroft 0fadf028ef
Create first BLE-only board, Micro:Bit v2
This fixes build issues with USB off, tweaks the README to allow
for BLE-only boards and adds the Micro:Bit v2 definition.

Fixes #4546
2021-07-14 09:55:51 -07:00
Kattni Rembor 4579bf9b12 Rename rainbow to rainbowio 2021-07-12 14:40:01 -04:00
Kattni Rembor 289575a811 Adding rainbow module. 2021-07-08 15:55:13 -04:00
Scott Shawcroft 3177973843
Add BLE serial service 2021-06-25 15:00:10 -07:00
Dan Halbert 04b69cde9b turn off gamepad on most builds;turn off keypad where appropriate 2021-06-17 13:46:45 -04:00
Dan Halbert 7d23206018 Inital keypad work: Keys working: one pin per key
keypad.Buttons and keypad.State

Buttons -> Keys; further work

wip

wip

wip: compiles

about to try

keypad.Keys working
2021-06-08 20:27:31 -04:00
Limor "Ladyada" Fried 9752162508
Merge pull request #4765 from dhalbert/rotary-trinkey-rev-c-pins
Update various Trinkey pins and add _pixelbuf
2021-05-15 11:52:33 -04:00
Dan Halbert 1e2a945782 Make busio.SPI be NotImplementedError on proxlight to save space 2021-05-14 21:52:54 -04:00
Dan Halbert fa6c06fb38 count in/out endpoints; allow more usb modules on low-endpoint boards 2021-05-13 21:59:02 -04:00
Dan Halbert 0651ef17dd Fix endpoint checking; Clean up safe mode printing. 2021-05-12 15:53:52 -04:00
Scott Shawcroft 42f4065c8a
Merge remote-tracking branch 'adafruit/main' into merge_1.13 2021-05-06 11:17:53 -07:00
Dan Halbert fc8e1c4c2e address review comments 2021-05-05 12:35:12 -04:00
Scott Shawcroft f0bb26d70f
Merge MicroPython 1.13 into CircuitPython 2021-05-04 18:06:33 -07:00
Dan Halbert 8bb3c6fd79 handle := defs in shared_bindings_matrix.py; update adafruit_hid 2021-05-04 18:07:01 -04:00
Dan Halbert adc3d7d55e update Python API according to review comments 2021-05-03 22:29:02 -04:00
Dan Halbert d2b558993e merge from main, including MicroPython 1.12 merge 2021-05-03 20:56:04 -04:00
Dan Halbert 96101016ec Include pulseio only on CIRCUITPY_FULL_BUILD 2021-04-30 23:13:32 -04:00
Dan Halbert 8500e846c6 partially working 2021-04-27 23:53:23 -04:00
Dan Halbert f98a54628b wip: compiles 2021-04-27 14:37:36 -04:00
Dan Halbert 7a40b4daec very much WIP 2021-04-26 23:54:01 -04:00
Dan Halbert c26e49c2e6 wip: starting to try to compile 2021-04-25 23:17:41 -04:00
Dan Halbert 9d1fcc3b14 merge from main 2021-04-25 10:27:52 -04:00
Dan Halbert 2ba2574ebf
Merge pull request #4619 from tyomitch/microbit
[build] Allow USB to be set to 0
2021-04-24 10:31:29 -04:00
Artyom Skrobov 4e3c1d4a4c [build] Allow USB to be set to 0
Unify USB-related makefile var and C def as CIRCUITPY_USB.

Always define it as 0 or 1, same as all other settings.

USB_AVAILABLE was conditionally defined in supervisor.mk,
but never actually used to #ifdef USB-related code.

Loosely related to #4546
2021-04-23 11:13:34 -04:00
Dan Halbert 51ccf8dc30 wip: revert usb_descriptor changes; use raw descriptors instead 2021-04-19 23:24:18 -04:00
Jeff Epler fc4538f845 WIP: Implement 'ParallelImageCapture' for samd51 2021-04-16 17:18:59 -05:00
Dan Halbert 4a7e129287 wip: latent usb device enabling/disabling 2021-04-13 23:33:44 -04:00
Artyom Skrobov c6ee471b52 Merge branch 'main' of https://github.com/adafruit/circuitpython into patch-3 2021-04-13 00:32:19 -04:00
Jeff Epler 3ce0b512f8 rasberrypi: IncrementalEncoder: factor out state machine 2021-04-08 16:25:47 -05:00
Artyom Skrobov 8056af8648 [synthio] add a simple MidiTrack implementation 2021-03-26 16:38:10 -04:00
Artyom Skrobov d7dc3801ab [ure] to save space, disable debug dumps by default
Has to stay enabled in unix port for the sake of tests/extmod/ure_debug.py
2021-03-26 13:24:20 -04:00
Dan Halbert 5ace7af933 disable default usb_cdc 2021-03-11 11:20:29 -05:00
Jeff Epler 4f040af481 vm: Make the speed-size trade-off compile time settable
.. and enable for all samd21 boards
2021-03-05 18:29:27 -06:00
Kevin Matocha a7a4f93ff8 Updated build configs to turn off BITMAPTOOLS for smaller builds 2021-02-25 15:44:32 -06:00
Kevin Matocha b720028642 Add bitmaptools module 2021-02-23 23:23:14 -06:00
Dan Halbert 7a4198885e Fix typos for CIRCUITPY_USB_HID_SYS_CONTROL 2021-02-23 09:22:20 -05:00
Dan Halbert 076a7b7161 CIRCUITPY_BITOPS merge error 2021-02-19 15:30:27 -05:00
Dan Halbert 67406488d1 merge from upstream; re-alphabetize 2021-02-19 14:22:50 -05:00
Jeff Epler 7fd4567893 bitops: rename from _bit_transpose, describe the algorithm 2021-02-18 15:41:23 -06:00
Jeff Epler 9cf7d73c6c core: add bit_transpose function
.. this version can only handle exactly 8 bits "across".  The restriction
may be relaxed in a future revision.
2021-02-18 11:32:47 -06:00
Dan Halbert d54b5861a3 wip 2021-02-12 19:01:14 -05:00
Dan Halbert f0564b4986 merge from upstream; complicated webusb merge 2021-02-11 18:50:02 -05:00
Dan Halbert 0802b22ed6 usb descriptors all set; rework of enabling for USB devices 2021-02-04 19:23:40 -05:00