Commit Graph

1979 Commits

Author SHA1 Message Date
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