Commit Graph

2109 Commits

Author SHA1 Message Date
Dan Halbert 5edc59f070
Merge pull request #6337 from jepler/property-storage
Optimize flash storage of properties
2022-05-06 09:55:18 -04:00
Dan Halbert 98ae047525 Compile more SAMD things conditionallly 2022-05-04 11:41:48 -04:00
Dan Halbert b181caaefc add board.LED to Metro M4 AirLift LIte and PyRuler 2022-05-03 16:08:01 -04: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
Jeff Epler 78cf0a90af
Make MP_PROPERTY_GETTER / _GETSET fully declare the property
This will enable setting data attributes, namely, the section of the
symbol.
2022-05-03 08:48:53 -05:00
Jeff Epler 31da335cac
Introduce, use MP_PROPERTY_GETTER, _GETSET
Later, these can be changed in cunning ways to save flash storage.
2022-05-03 08:48:52 -05:00
Dan Halbert 816a26e8b7
Merge pull request #6321 from dhalbert/samd21-ticks-for-display
Preserve ticks for displays across VMs
2022-04-28 09:37:21 -04:00
Michael Wisslead e63a327107 Bound PulseIn start indexes to maxlen. 2022-04-28 02:28:34 +00:00
Dan Halbert b25d810af9 Preserve ticks for displays across VMs 2022-04-27 20:06:47 -04:00
Dan Halbert b7541088f4 shrink circuitplayground_express_crickit 2022-04-26 17:51:47 -04:00
Dan Halbert 7a77aae4be shrink feather_m0_supersized 2022-04-26 16:52:43 -04:00
Dan Halbert 6b25ccf1a4 remove stray space 2022-04-26 14:26:42 -04:00
Dan Halbert 63abd9a9cf
Merge pull request #6312 from dhalbert/adjust-neopixel-timings
test and adjust NeoPixel timings on multiple ports
2022-04-26 13:18:47 -04:00
Dan Halbert 3a8fb4e956
Merge pull request #5852 from jepler/floppy
Add floppyio
2022-04-26 11:40:19 -04:00
Dan Halbert 4eeaf41edc test and adjust NeoPixel timings on multiple products 2022-04-25 23:12:24 -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
Dan Halbert 76d54ca8ad shrink sparkfun_redboard_turbo 2022-04-21 12:58:46 -04:00
George White 3b5171c4ff Move hook implementation to supervisor 2022-04-18 14:09:36 +00:00
George White 32fc084b39 Removed compiler flag in favor of MP_WEAK implementation 2022-04-18 13:10:12 +00:00
George White 0ba93b20e5 Setup flash pins on Sparkfun SAMD51 Micromod 2022-04-18 13:10:12 +00:00
foamyguy 948040f1f0 disable onewire instead of displayio on boards without room 2022-04-10 10:00:37 -05:00
foamyguy 7ad5fa511e disable displayio for some boards 2022-04-09 16:24:06 -05:00
Jeff Epler 766bf8f671
disable floppyio on kicksat-sprite 2022-04-07 10:57:37 -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
Mark 8ed7b114cd
Merge branch 'main' into uzlib-module 2022-04-03 11:48:37 -05:00
gamblor21 9d67e62f4d Removed from small board 2022-04-03 11:47:19 -05:00
Jeff Epler 372306411a
samd: Don't rely on RTC interrupt
I instrumented RTC_Handler and determined that on SAMD51 it was possible
for the interrupt to be delivered well before the actual overflow of the
RTC COUNT register (e.g., a value as small as 0xffff_fffd could be seen
at the time of overflow)

Rather than depending on the overflow interrupt coming in at the same time
as COUNT overflows (exactly), rely only on observed values of COUNT in
_get_count, overflowing when it wraps around from a high value to a low
one.

With this change, PLUS a second change so that it is possible to warp
the RTC counter close to an overflow and test in 20ms instead of 3 days,
there was no problem detected over 20000+ overflows. Before, a substantial
fraction (much greater than 10%) of overflows failed.

Fixes #5985

Change to common-hal/rtc/RTC.c for time warping (plus make rtc_old_count non-static):
```patch
 void common_hal_rtc_set_calibration(int calibration) {
+
+    common_hal_mcu_disable_interrupts();
+
+        RTC->MODE0.COUNT.reg = 0xffffff00;
+        rtc_old_count = 0;
+        do {
+        while ((RTC->MODE0.SYNCBUSY.reg & (RTC_MODE0_SYNCBUSY_COUNTSYNC | RTC_MODE0_SYNCBUSY_COUNT)) != 0) { }
+    }
+    while(RTC->MODE0.COUNT.reg < 0xffffff00);
+    common_hal_mcu_enable_interrupts();
+
+    mp_printf(&mp_plat_print, "Warping RTC in calibration setter count=%08x rtc_old_count=%08x\n", RTC->MODE0.COUNT.reg, rtc_old_count);
```

Test program:
```python
import time
from rtc import RTC

i = 0
while True:
    RTC().calibration = 1 # Warps to ~16ms before overflow, with patch to RTC code
    t0 = time.monotonic_ns()
    et = t0 + 20_000_000 # 20ms
    while (t1 := time.monotonic_ns()) < et: pass
    i += 1
    print(f"{i:6d}: duration {t1-t0}")
    if t1-t0 > 200_000_000: break
    print()
```
2022-03-25 14:48:03 -05:00
Jeff Epler d91ca7369c
Merge remote-tracking branch 'origin/main' into revamp-duplicate-usb-check 2022-03-24 09:44:41 -05:00
Jeff Epler a07ac72cc5
Improve the USB vid:pid duplicate checker
To me, it made more sense to track which boards go together in a cluster;
when reviewing a request to actually use a duplicate vid/pid, you want
to know what board(s) it is aliasing.

I also revamped the detection of non-USB boards so that a board .mk file
that couldn't be parsed by the code here would raise a problem instead
of just being skipped for the purposes of checking.

There were some lines with comments on the end, and some variation in
capitalization of the IDs. These are all normalized and a (sometimes
unfriendly!) error printed when it's incorrect.

Before this, here were some ways to trick the duplicate vid/pid checker:
```
USB_PID = 0XABCD
USB_PID = 0xAbCd
USB_PID = 0xABCD # harmless comment?
```
None of these things were ever done on purpose.
2022-03-24 09:42:11 -05:00
Scott Shawcroft 4363361c87
Board definition clean up
Removes:
* AUTORESET_DELAY_MS which never did anything but was introduced
  somehow.
* CIRCUITPY_BOOT_BUTTON in all but one ESP board because they all have
  them. There is a default based on the strapping pins.
* BOARD_USER_SAFE_MODE_ACTION because it was all the same for boards
  with boot buttons. Now the safe mode code manages the message.
2022-03-21 17:58:43 -07:00
Scott Shawcroft c098474854
Disable aesio and traceback on matrixportal to save space 2022-03-16 10:41:17 -07: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 f602296e59
Re-enable BLE on MatrixPortal. Remove PortalBase
We have a guide that uses it. It was removed in #6043 without
realizing that.

Fixes #6152
2022-03-14 17:04:46 -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 7cb66dd316
Merge pull request #6142 from dhalbert/7.2.x-autoreload-fake-sleep
7.2.x autoreload rework (again)
2022-03-11 16:46:04 -08:00
Dan Halbert e4cd9690f1 rework auto-reload delay logic 2022-03-11 14:03:04 -05:00
Dan Halbert 19e7647f3d turn off MIDI on sensebox_mcu for sapce 2022-03-10 18:20:04 -05:00
Dan Halbert a7260a8b61 squeeze arduino_zero further 2022-03-10 15:56:51 -05:00
Dan Halbert c5947fd6de squeeze arduino_zero and sensebox_mcu 2022-03-10 12:46:08 -05:00
Dan Halbert 6ddab0f3c8 shrink matrixportal_m4 2022-03-10 11:20:44 -05:00
Dan Halbert 9b2e22a6df Make autoreload checking more robust
- Add reset for autoreload. De-request ticks.
- Separate state a little more in autoreload.c
- Rename some routines.
- Remove redundant settings of CIRCUITPY_AUTORELOAD_DELAY_MS.
2022-03-09 11:07:55 -05:00
Scott Shawcroft 4ac6ef0086
Fix SAMD51 builds on GCC11.2
Fixes #5351
2022-03-08 10:41:34 -08:00
Dan Halbert 1c8f671f0a
Merge pull request #6118 from pewpew-game/parallel-reset-optional
paralleldisplay: reset and read pins should be optional
2022-03-08 09:34:25 -05:00
Dan Halbert 05a4d24a0f
Merge pull request #6117 from dhalbert/__future__
implement `from __future__ import annotations`
2022-03-08 09:33:36 -05:00
Dan Halbert eff6057fa3 shrink matrixportal_m4 2022-03-07 21:37: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
Michael Himing 78d7bce02a seeeduino_xiao_kb: Copy pins from seeeduino_xiao 2022-03-08 08:58:32 +11:00
Scott Shawcroft ff865b60da
Merge pull request #5298 from pewpew-game/logo-remove
Add a flag for removing the Blinka logo from the REPL
2022-03-07 12:53:56 -08:00
Dan Halbert 96aec37ead fix whitespace 2022-03-07 09:11:29 -05:00
Dan Halbert e91c2e13fb
Seediuno XIAO SAMD21: inverted pins 2022-03-07 09:03:32 -05:00
Rick Sorensen be3129a917
Update ports/atmel-samd/boards/seeeduino_xiao/pins.c
Co-authored-by: Dan Halbert <halbert@halwitz.org>
2022-03-06 22:59:54 -06:00
Rick Sorensen 6fd0643b1e Remove trailing white space 2022-03-06 21:15:37 -06:00
Rick Sorensen d7ef8f18df pins.c: added comment of reverse wiring for XIAO LEDs 2022-03-06 20:07:42 -06:00
Rick Sorensen 36a27806d8 pins.c: Modify and correct LED pin mappings and names for Xiao
Added YELLOW_LED=LED=D13,
      BLUE1_LED=RX_LED,
      BLUE2_LED=TX_LED
2022-03-06 19:20:37 -06:00
Radomir Dopieralski b69a06b2ed Also fix the read pin in the atmel and rp2040 ports 2022-03-06 11:33:07 +01:00
Radomir Dopieralski 93ea1bd9bd Add a flag for removing the Blinka logo from the REPL
There may be several reasons why we might want to remove the logo form
the REPL: a fork of CircuitPython that doesn't have the right to use the
logo, an especially small display that needs all the room it has to be
useful, displays that are especially vulnerable to burn-in, maybe even
the smaller chips where we want to save as much flash memory as
possible.
2022-03-05 15:38:59 +01:00
James Bowman 353ea6f70e Add EVE support to Feather M4 CAN 2022-02-27 18:34:30 -08:00
Dan Halbert 01d880829a
Merge pull request #6041 from t-ikegami/enable_uasyncio
Enable _uasyncio module
2022-02-25 13:42:29 -05:00
Dan Halbert 61425864f0 turn off onewireio in matriportal_m4 2022-02-25 12:22:45 -05:00
Scott Shawcroft 9e16487203
Merge pull request #6048 from t-ikegami/atmel-samd-fix-alarm
Fix atmel-samd alarm module
2022-02-23 15:29:54 -08:00
Tsutomu IKEGAMI 6499d18bb8 Remove board_deep_sleep_hook, which should be done in board_deinit. 2022-02-21 19:21:42 +09:00
gamblor21 edee8e3409 disable on some boards 2022-02-21 00:47:05 -06:00
gamblor21 6f537e50c3 Disable in M0 builds 2022-02-20 16:03:25 -06:00
Tsutomu IKEGAMI bd9dd3dc63 Fix atmel-samd alarm module. 2022-02-17 23:00:26 +09:00
Melissa LeBlanc-Williams 8f741e7767 Removed more frozen libs and disabled unlikely used modules 2022-02-16 14:47:12 -08:00
Melissa LeBlanc-Williams 0aadb4e256 Remove DisplayText Frozen Lib from MatrixPortal saving about 60K 2022-02-16 14:04:00 -08:00
Melissa LeBlanc-Williams 726bf02ea8 Add PortalBase and Fake Requests and update Frozen Libs on Portal boards 2022-02-16 10:12:54 -08:00
George White f3b67cc104 MicroMod SAMD51: Correct default MISO 2022-02-12 17:49:50 +00:00
Scott Shawcroft 54589de15b
Merge pull request #6004 from dhalbert/samd-rtc-count-overflow
fetch RTC count more atomically
2022-02-10 10:16:57 -08:00
Dan Halbert b18b0fd5b9 fetch RTC count more atomically 2022-02-09 15:32:16 -05:00
Chris Osterwood 7247990c3e
Update pins.c
Fix typo
2022-02-09 14:26:20 -05:00
Chris Osterwood 8e3f719056
Update mpconfigboard.mk
Add build flags to turn off subsystems which are not relevant to the USB Hub
2022-02-09 13:54:08 -05:00
Chris Osterwood 4c371db5b2
Update pins.c
Adds a pin which is used by recent firmware for PCB hardware identification.
2022-02-09 13:53:19 -05:00
Dan Halbert 72317c309d turn off CIRCUITPY_ONEWIREIO by default for skinny SAMD21 builds 2022-02-09 11:40:07 -05:00
Scott Gauche a8d8651873 Canonical C style for half_duplex = true/false 2022-02-08 23:13:22 -05:00
Scott Gauche 309f4fb2b9 add half_duplex false param to spi construct function call in some board files 2022-02-08 22:59:26 -05:00
Scott Gauche 89ad767b8f add half_duplex to spi constructs in other ports but raise not implemented errors 2022-02-08 22:25:23 -05:00
Jeff Epler 07e710b0a0
Merge remote-tracking branch 'origin/main' into floppy 2022-02-04 09:01:36 -06:00
Dan Halbert e355ea2b91 shrink seeeduino_xiao build 2022-02-03 13:27:36 -05:00
Jeff Epler 31febc336b
fix sam e51 comment & floppy building 2022-02-02 21:37:47 -06:00
Jeff Epler 224069551a
disable onewireio on seeduino xiao (samd21)
I don't understand how this stopped fitting, as none of the added code
is used in this build.
2022-02-02 21:36:58 -06:00
Jeff Epler 1be8ae75d4
skip floppyio if not full build 2022-02-02 17:07:02 -06:00
Dan Halbert 0129735dbe
Merge pull request #5969 from Life-Imaging-Services/crc32
crc32() code moved into binascii
2022-02-02 18:07:02 -05:00
Dan Halbert 0d43e3e734 squeeze datum_imu build 2022-02-02 13:44:40 -05:00
Dan Halbert a04cd6444b
Merge pull request #5966 from Neradoc/add-alias-stemma-i2c
Add alias board.STEMMA_I2C for all boards with qwiic/stemma/QT
2022-02-02 11:08:13 -05:00
Neradoc b2c8fd3938 add board.STEMMA_I2C alias to some boards 2022-02-02 01:18:46 +01:00
Dan Halbert d0453f460d shrink sensebox; fix doc error 2022-02-01 10:12:26 -05:00
Dan Halbert cc410ad6a3 common-hal I2C combined write_read 2022-01-31 22:03:30 -05:00
Scott Shawcroft 43dae6c8d1
Merge pull request #5951 from dhalbert/track-board-default-objects
Track creation of board.I2C(), etc.
2022-01-31 14:29:19 -08:00
Dan Halbert 20a17bec25 shrink arduino_mkrzero and sparkfun_samd21_dev 2022-01-31 09:16:03 -05:00
Dan Halbert 93a60eecab
Merge pull request #5946 from tammymakesthings/pr4218-neopixel-show-after-deinit
Fixes neopixel show() after deinit() not raising an exception
2022-01-29 18:30:37 -05:00
Dan Halbert a88969d306 Revert "Disabled audioio, audiobusio, USB midi for sparkfun_redboard_turbo to save flash space"
This reverts commit 5e2166673b.
2022-01-29 17:06:26 -05:00
Dan Halbert 6e98186f0d turn off more things on SAMD21 full builds 2022-01-29 17:05:51 -05:00
Tammy Cravit 5e2166673b Disabled audioio, audiobusio, USB midi for sparkfun_redboard_turbo to save flash space 2022-01-29 14:31:58 -07:00
Dan Kulinski 19f9163892 Bringing branch up to date with current main 2022-01-25 11:02:00 -07:00
Dan Kulinski 60801066b2 Fix magtag, openbook for EPaperDisplay constructor 2022-01-24 12:34:01 -07:00
Scott Shawcroft 9a353a4f56
Merge pull request #5422 from Neradoc/nera-secondary-I2C
Allow multiple board buses
2022-01-21 11:08:14 -08:00
microDev 67293c265c
Merge branch 'main' into board-bus 2022-01-21 10:08:39 +05:30
Dan Halbert fed5227de9 shrink stringcar_m0_express 2022-01-20 20:34:04 -05:00
Scott Shawcroft 13db65566d
ESP NeoPixel fixes
This tweaks the RMT timing to better match the 1/3 and 2/3 of 800khz
guideline for timing. It also ensures a delay of 300 microseconds
with the line low before reset.

Pin reset is now changed to the IDF default which pulls the pin up
rather than CircuitPython's old behavior of floating the pin.

Fixes #5679
2022-01-19 16:29:07 -08: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
Jeff Epler db5f99c63e
Add a function to get low level register access
The port is free to return NULL for any/all of these, and the caller has
to check.

This will be used in the floppy code, because aside from getting the
registers, it looks like all is independent of MCU.
2022-01-13 15:29:03 -06:00
Scott Shawcroft d5ca7f0348
Merge pull request #5842 from dhalbert/pdmin-fix
Fixes SAMD PDMIn
2022-01-12 10:50:04 -08:00
Dan Halbert dd54e8f657 PDMIn: enable IRQ; need a volatile; call pdmin_reset()
enable IRQ for PDMIn
2022-01-12 11:44:43 -05:00
Brian Dean 1fb4f02de2 ports/atmel-samd/boards/bdmicro_vina_d51/pins.c: Add LED_AUX pin. 2022-01-06 16:32:17 -05:00
Dan Halbert 9d2a32d07e countio: add selectable rise and fall detection, pulls 2021-12-31 16:34:58 -05:00
Jeff Epler 34e8bfd09e
explicitly use mpz long ints on this board 2021-12-27 16:39:04 -06:00
Jeff Epler 1d13c4ccd1
Centralize LONGINT_IMPL handling
This closes #5782
2021-12-27 10:21:47 -06:00
Dan Halbert 325c2161e9 shrink CPX crickit build 2021-12-23 12:24:16 -05:00
Dan Halbert bbe30514ef Fix other INTENCLR and INTENSET to write whole reg 2021-12-12 22:25:44 -05:00
Dan Halbert c06eee9841 Clear TAMPER interrupt properly; make keypad module table const 2021-12-12 22:00:08 -05:00
microDev b6858e4ca7
allow multiple board buses
Co-authored-by: Neradoc <neraOnGit@ri1.fr>
2021-12-11 23:07:21 +05:30
Dan Halbert e0e3224253 forgot a check for BOARD_HAS_CRYSTAL 2021-12-07 15:42:31 -05:00
Dan Halbert 7e21344cf0 fix FrequencyIn for crystalless boards and simplify clock logic 2021-12-07 13:12:24 -05:00
Dan Halbert 92bb909bf0 add a frequencyin_reset() for VM restart 2021-12-05 17:06:42 -05:00
Dan Halbert e8ea9c75a1 check for missing pins; deinit txrx leds 2021-11-30 19:16:21 -05:00
Dan Halbert 57c33059f3 board_deinit() everywhere 2021-11-30 11:00:10 -05:00
Dan Halbert 95c09ac66f
Merge pull request #5610 from tannewt/rpi
Initial broadcom port for Raspberry Pi
2021-11-24 19:02:23 -05:00
Scott Shawcroft e6a68cc4a7
Shrink 3 SAMD builds by disabling onewireio 2021-11-24 14:27:49 -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
Dan Halbert 582a923ec9
Merge pull request #5579 from jepler/fix-optimization-same54
same54: Use the same optimization as other sam d5x/e5x
2021-11-16 08:32:08 -05:00
Dan Halbert 73430af78b
-O2 without -fno-inline-functions 2021-11-15 22:36:23 -05:00
Jeff Epler 1039e1116b
same54: Use the same optimization as other sam d5x/e5x
It's likely that this is a relic of my early testing.
2021-11-12 18:54:56 -06:00
Jeff Epler dfef5014ed
enable rainbowio with newly free space 2021-11-12 17:31:12 -06:00
microDev b5dd8891e2
turn off `onewireio` on `feather_m0_adalogger` 2021-11-12 20:02:22 +05:30
Dan Halbert adac5ee596
Merge pull request #5563 from jepler/enable-error-missing-prototypes
Additional missing-prototypes fixes
2021-11-11 11:57:43 -05:00
Jeff Epler cd6599ce65
A few more missing-prototypes fixes 2021-11-11 08:42:30 -06:00
Dan Halbert f058c5ec8c fix kicksat-sprite 2021-11-10 23:05:06 -05:00
Jeff Epler 340d6b9213
more missing-prototypes fixes 2021-11-10 21:00:17 -06:00
Dan Halbert e7d9dc323b shrink kicksat-sprite, simmel, pyb_nano_v2 2021-11-10 21:12:41 -05:00
Dan Halbert 58485bc0b1 Switch SAMD51 and SAME51 back to -Os from -O2
The SAMx51 builds were getting very close to full on larger translations. This PR
adds 1400 bytes of enabled features, and pushed some over the edge.
2021-11-10 16:00:38 -05:00
Jeff Epler ebc8359c67
disable missing-prototypes diagnostics in yet another tinyusb file 2021-11-10 12:47:55 -06:00
Jeff Epler 5cba23e04d
More missing-prototypes fixes 2021-11-10 12:22:07 -06:00
Jeff Epler 621953c960
Additional missing-prototypes fixes
I think this correctly enables missing-prototypes in atmel-samd
and raspberrypi ports.
2021-11-10 10:55:53 -06:00
Dan Halbert a69496b0e7
Merge pull request #5562 from microDev1/traceback
Refactor traceback handling
2021-11-10 11:53:35 -05:00
microDev 53a68f7ce6
turn off `onewireio` on `arduino_nano_33_iot` 2021-11-10 20:25:46 +05:30
Jeff Epler 63fbf98186
Enable -Wmissing-prototypes for atmel-samd 2021-11-09 20:05:00 -06:00
Scott Shawcroft bb71f8c9b3
Merge pull request #5544 from jepler/alphablend
bitmaptools: add alphablend
2021-11-08 10:50:03 -08:00
Jeff Epler 6790f95953 Fix disabling of FRAMEBUFFERIO on atmel-samd
.. this needs to imply the disabling of RGBMATRIX too
2021-11-05 15:19:01 -05:00
Jeff Epler 43b593725b atmel-samd: Fix converting watchdog seconds to cycles
It's intended that the actual timeout always be at least the requested
timeout.  However, due to multiplying by the wrong factor to get from
seconds to cycles, a timeout request of e.g., 8.1s (which is less than
8.192s) would give an actual timeout of 8, not 16 as it should.
2021-11-05 11:40:08 -05:00
Jeff Epler 8e8c44afea Merge remote-tracking branch 'origin/main' into alphablend 2021-11-05 11:24:51 -05:00
Jeff Epler d532ad388b disable framebufferio so bitmaptools can fit 2021-11-05 11:24:03 -05:00
Jeff Epler 334a9c85ce Merge remote-tracking branch 'origin/main' into gifio 2021-11-04 20:22:00 -05:00
Jeff Epler a8614a61dc ParallelImageCapture: Add continuous capture on espressif
By having a pair of buffers, the capture hardware can fill one buffer while
Python code (including displayio, etc) operates on the other buffer.  This
increases the responsiveness of camera-using code.

On the Kaluga it makes the following improvements:
 * 320x240 viewfinder at 30fps instead of 15fps using directio
 * 240x240 animated gif capture at 10fps instead of 7.5fps

As discussed at length on Discord, the "usual end user" code will look like
this:

    camera = ...

    with camera.continuous_capture(buffer1, buffer2) as capture:
        for frame in capture:
            # Do something with frame

However, rather than presenting a context manager, the core code consists of
three new functions to start & stop continuous capture, and to get the next
frame.  The reason is twofold.  First, it's simply easier to implement the
context manager object in pure Python.  Second, for more advanced usage, the
context manager may be too limiting, and it's easier to iterate on the right
design in Python code.  In particular, I noticed that adapting the
JPEG-capturing programs to use continuous capture mode needed a change in
program structure.

The camera app was structured as
```python
while True:
    if shutter button was just pressed:
        capture a jpeg frame
    else:
        update the viewfinder
```

However, "capture a jpeg frame" needs to (A) switch the camera settings and (B)
capture into a different, larger buffer then (C) return to the earlier
settings. This can't be done during continuous capture mode. So just
restructuring it as follows isn't going to work:

```python
with camera.continuous_capture(buffer1, buffer2) as capture:
    for frame in capture:
        if shutter button was just pressed:
            capture a jpeg frame, without disturbing continuous capture mode
        else:
            update the viewfinder
```

The continuous mode is only implemented in the espressif port; others
will throw an exception if the associated methods are invoked.  It's not
impossible to implement there, just not a priority, since these micros don't
have enough RAM for two framebuffer copies at any resonable sizes.

The capture code, including single-shot capture, now take mp_obj_t in the
common-hal layer, instead of a buffer & length.  This was done for the
continuous capture mode because it has to identify & return to the user the
proper Python object representing the original buffer.  In the Espressif port,
it was convenient to implement single capture in terms of a multi-capture,
which is why I changed the singleshot routine's signature too.
2021-11-03 11:02:46 -05:00
Jeff Epler 18eaee9beb reenable RAINBOWIO on these boards 2021-11-01 12:52:13 -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 8c7760b1a6 don't include gifio on samd21 boards 2021-10-26 08:54:18 -05:00
Dan Halbert e868f1b1fe
Merge pull request #5510 from jepler/cmd25-v2
sdcardio: Use CMD25 across multiple writeblocks() calls
2021-10-26 08:46:28 -04:00
Scott Shawcroft 5315348b11
Merge pull request #5425 from maholli/samd-sleep
functioning samd deep sleep ('alarm.time' & 'alarm.pin')
2021-10-25 14:42:12 -07:00