Commit Graph

2059 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