Commit Graph

16897 Commits

Author SHA1 Message Date
Scott Shawcroft 1160635608
Enable PYSTACK to keep function state out of the heap 2020-07-17 17:03:42 -07:00
Lucian Copeland 207369ec09 Add boilerplate, create basic PWMOut test 2020-07-17 17:28:23 -04:00
Jeff Epler 9cdf5e148a
Merge pull request #2879 from jepler/background-callback
Use a linked list of background tasks to perform
2020-07-17 15:46:03 -05:00
Jeff Epler 98eef79faa background_callback_gc_collect: We must traverse the whole list 2020-07-17 14:55:46 -05:00
Jeff Epler 6912d31560 uchip: reclaim some flash space 2020-07-17 14:32:05 -05:00
dherrada 612c6bb86b
Merge branch 'main' into type_hints 2020-07-17 14:55:30 -04:00
dherrada d64b4e3059 Made more requested changes 2020-07-17 14:53:51 -04:00
Jeff Epler a18a392109 background_callback: Add gc collect callback
A background callback must never outlive its related object.  By
collecting the head of the linked list of background tasks, this will
not happen.

One hypothetical case where this could happen is if an MP3Decoder is
deleted while its callback to fill its buffer is scheduled.
2020-07-17 08:36:26 -05:00
Lucian Copeland dc6902a33e Exclude timers from H7 builds 2020-07-16 17:11:24 -04:00
dherrada bfcaa4b2b4 Made requested changes in displayio 2020-07-16 16:11:22 -04:00
Lucian Copeland 6a49766df0 Fix pulseIO reset and frequency issues, remove IRQ conflict 2020-07-16 15:45:18 -04:00
Dan Halbert 88d8956378
Merge pull request #3143 from tannewt/improve_json
Add support to json.load for any object with readinto
2020-07-16 14:33:33 -04:00
Scott Shawcroft 72f6d7ee21
Merge pull request #3155 from jepler/esp32s2-parallel-build
esp32s2: Take care to invoke the sub-build-system only once
2020-07-16 11:26:53 -07:00
Scott Shawcroft 7bb508bf43
Merge pull request #3157 from tinkeringtech/tinkeringtech-scoutmakes-azul
Addition of Tinkeringtech ScoutMakes Azul nRF52840 based platform to CircuitPython
2020-07-16 11:03:31 -07:00
Scott Shawcroft 3610520ca4
Merge pull request #3156 from jepler/esp32s2-serial-number
esp32s2: Use the device's EUI-48 address as unique ID
2020-07-16 11:00:02 -07:00
Lucian Copeland cdfc3a2d37 Check out active protomatter PR 2020-07-16 12:08:40 -04:00
TinkeringTech 416a32ab01 fixed build.yml file formatting errors 2020-07-15 21:58:40 -04:00
TinkeringTech 49fcfd14d2 Added the TinkeringTech ScoutMakes Azul platform to CircuitPython 2020-07-15 21:49:34 -04:00
Jeff Epler 81105cb9ef supervisor: usb: note that it's unusual to need to call usb_background 2020-07-15 11:49:44 -05:00
Jeff Epler 1df48176ce supervisor: factor supervisor_background_tasks from sundry ports 2020-07-15 11:49:44 -05:00
Jeff Epler 6160d11c5a supervisor: factor out, Handle USB via background callback 2020-07-15 11:49:44 -05:00
Jeff Epler a2919a6fb2 esp32s2: Use the device's EUI-48 address as unique ID
On my hardware, esptool reports
    MAC: 7c:df:a1:02:6c:b8
after this change, the USB descriptor says SerialNumber: 7CDFA1026CB8
and microcontroller.cpu.id has
    >>> "".join("%02x" % byte for byte in microcontroller.cpu.uid)
    'c7fd1a20c68b'

Note that the nibble-swapping between USB and cpu.uid is typical.
For instance, an stm32 board has USB SerialNumber
24002500F005D42445632302 but hex-converted microcontroller.cpu.id
420052000f504d4254363220.
2020-07-15 11:45:13 -05:00
Jeff Epler 910f69c42b esp32s2: Take care to invoke the sub-build-system only once
This allows "make -j" in the outer build system to function properly,
with a potentially large decrease in build times on high end desktop
systems.
2020-07-15 10:30:07 -05:00
Jeff Epler 36b4646516 background_callback: Avoid CALLBACK_CRITICAL_BEGIN with nothing to do
CALLBACK_CRITICAL_BEGIN is heavyweight, but we can be confident we do
not have work to do as long as callback_head is NULL.

This gives back performance on nRF.
2020-07-15 09:26:47 -05:00
Jeff Epler af520729fe displayio, framebufferio: Enable supervisor tick when a display is auto-refresh
This is a step towards restoring the efficiency of the background
tasks
2020-07-15 09:26:47 -05:00
Jeff Epler bdab6c12d4 MP3Decoder: take advantage of background callback
Before this, the mp3 file would be read into the in-memory buffer
only when new samples were actually needed.  This meant that the time
to read mp3 content always counted against the ~22ms audio buffer length.

Now, when there's at least 1 full disk block of free space in the input
buffer, we can request that the buffer be filled _after_ returning from
audiomp3_mp3file_get_buffer and actually filling the DMA pointers.  In
this way, the time taken for reading MP3 data from flash/SD is less
likely to cause an underrun of audio DMA.

The existing calls to fill the inbuf remain, but in most cases during
streaming these become no-ops because the buffer will be over half full.
2020-07-15 09:26:47 -05:00
Jeff Epler 742aa740f6 samd: audio: Move to background callback
Testing performed: Played half of the Bartlebeats album :) :)
2020-07-15 09:26:47 -05:00
Jeff Epler 8c4a9f6444 supervisor: tick: only run background tasks once per tick 2020-07-15 09:26:47 -05:00
Jeff Epler 1474fccd2f supervisor: Add a linked list of background callbacks
In time, we should transition interrupt driven background tasks out of the
overall run_background_tasks into distinct background callbacks,
so that the number of checks that occur with each tick is reduced.
2020-07-15 09:26:47 -05:00
Jeff Epler dc74ae83da nRF: Always use sd_nvic_critical_region calls
The motivation for doing this is so that we can allow
common_hal_mcu_disable_interrupts in IRQ context, something that works
on other ports, but not on nRF with SD enabled.  This is because
when SD is enabled, calling sd_softdevice_is_enabled in the context
of an interrupt with priority 2 or 3 causes a HardFault.  We have chosen
to give the USB interrupt priority 2 on nRF, the highest priority that
is compatible with SD.

Since at least SoftDevice s130 v2.0.1, sd_nvic_critical_region_enter/exit
have been implemented as inline functions and are safe to call even if
softdevice is not enabled.  Reference kindly provided by danh:
 https://devzone.nordicsemi.com/f/nordic-q-a/29553/sd_nvic_critical_region_enter-exit-missing-in-s130-v2

Switching to these as the default/only way to enable/disable interrupts
simplifies things, and fixes several problems and potential problems:
 * Interrupts at priority 2 or 3 could not call common_hal_mcu_disable_interrupts
   because the call to sd_softdevice_is_enabled would HardFault
 * Hypothetically, the state of sd_softdevice_is_enabled
   could change from the disable to the enable call, meaning the calls
   would not match (__disable_irq() could be balanced with
   sd_nvic_critical_region_exit).

This also fixes a problem I believe would exist if disable() were called
twice when SD is enabled.  There is a single "is_nested_critical_region"
flag, and the second call would set it to 1.  Both of the enable()
calls that followed would call critical_region_exit(1), and interrupts
would not properly be reenabled.  In the new version of the code,
we use our own nesting_count value to track the intended state, so
now nested disable()s only call critical_region_enter() once, only
updating is_nested_critical_region once; and only the second enable()
call will call critical_region_exit, with the right value of i_n_c_r.

Finally, in port_sleep_until_interrupt, if !sd_enabled, we really do
need to __disable_irq, rather than using the common_hal_mcu routines;
the reason why is documented in a comment.
2020-07-15 09:26:47 -05:00
Jeff Epler 51b9a1aeca tick.c: adjust whitespace 2020-07-15 09:26:47 -05:00
Lucian Copeland 818b96ae61 Fix IRQ enum protections 2020-07-14 16:33:36 -04:00
Scott Shawcroft a6c20208b3
Merge pull request #3148 from weblate/weblate-circuitpython-main
Translations update from Weblate
2020-07-14 11:20:27 -07:00
DavePutz e5f7adcf5d
Fix to pass mpy-cross build 2020-07-13 22:54:52 -05:00
DavePutz 14799f9ee6
more formatting fix 2020-07-13 22:43:46 -05:00
DavePutz 30361f6f2a
Fix formatting 2020-07-13 22:39:30 -05:00
DavePutz e963cff72d
Issue #2949 Run background checks during long multiplications 2020-07-13 22:27:06 -05:00
DavePutz 40f1bd0c7c
Merge pull request #12 from adafruit/main
Update from adafruit/main
2020-07-13 22:23:58 -05:00
Hosted Weblate a2233ced87 Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: CircuitPython/main
Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/
2020-07-14 02:14:25 +02:00
Scott Shawcroft 90ad9beff5
Merge pull request #3136 from xiongyihui/master
Add 2 boards nRF52840 M.2 devkit and M60 Keyboard
2020-07-13 17:14:18 -07:00
Scott Shawcroft 08375c7930
Merge pull request #2780 from AndrewR-L/patch-1
busio/UART: Correct and clarify readline() return.
2020-07-13 16:29:58 -07:00
Scott Shawcroft 51c888d4be
Merge pull request #3003 from Flameeyes/master
License tagging according to REUSE specifications.
2020-07-13 16:28:49 -07:00
Scott Shawcroft 3ddb598f0d
Merge pull request #3131 from weblate/weblate-circuitpython-main
Translations update from Weblate
2020-07-13 16:04:03 -07:00
Scott Shawcroft d712d1281c
Merge branch 'main' into master 2020-07-13 15:53:44 -07:00
Alvaro Figueroa 0ab2c7b10a Translated using Weblate (Spanish)
Currently translated at 100.0% (779 of 779 strings)

Translation: CircuitPython/main
Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/es/
2020-07-13 22:26:18 +02:00
_fonzlate f1b3c88d6e Translated using Weblate (Dutch)
Currently translated at 100.0% (779 of 779 strings)

Translation: CircuitPython/main
Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/nl/
2020-07-13 22:26:18 +02:00
Jonny Bergdahl 7b31ededcd Translated using Weblate (Swedish)
Currently translated at 100.0% (779 of 779 strings)

Translation: CircuitPython/main
Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/sv/
2020-07-13 22:26:17 +02:00
Alvaro Figueroa 8e7dab34c2 Translated using Weblate (Spanish)
Currently translated at 99.8% (778 of 779 strings)

Translation: CircuitPython/main
Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/es/
2020-07-13 22:26:17 +02:00
Wellington Terumi Uemura 9f81922be3 Translated using Weblate (Portuguese (Brazil))
Currently translated at 100.0% (779 of 779 strings)

Translation: CircuitPython/main
Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/
2020-07-13 22:26:17 +02:00
Hosted Weblate 0354d4a225 Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: CircuitPython/main
Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/
2020-07-13 22:26:17 +02:00