Commit Graph

17992 Commits

Author SHA1 Message Date
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
Dan Halbert
b08b0264cc back to working; check for extended advertising support 2020-07-15 09:46:13 -04: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
Dan Halbert
3fcd999130
Merge pull request #3130 from pewpew-game/brownout-level
SAMD: make the brownout detection level configurable per board
2020-07-13 16:26:11 -04:00
Scott Shawcroft
b81195d1d5
Merge pull request #3141 from pewpew-game/main
Fluff M0: additional pins on version 1.3 of the board
2020-07-13 12:24:17 -07:00
Lucian Copeland
b8910676db Add missing enum preprocessor protection 2020-07-13 11:52:30 -04:00
Dan Halbert
f6869c69c5 wip: advertising; not tested 2020-07-12 19:45:23 -04:00
DavePutz
85fef83f73
Merge pull request #11 from adafruit/main
updating
2020-07-12 18:06:27 -05:00
Yihui Xiong
c8752ff93e use RGB LEDs as status indicators 2020-07-11 21:25:32 +08:00
Yihui Xiong
8e26fdc0e9 add LED status, remove unused macros 2020-07-11 10:51:31 +08:00
Scott Shawcroft
372bcf8a95
Fix stream version and add basic readinto test 2020-07-10 17:33:17 -07:00
Scott Shawcroft
734661e79c
Add support to json.load for any object with readinto
This way we don't need to load the whole string version of the
json into memory.
2020-07-10 16:42:32 -07:00
Lucian Copeland
b1ac6b4444 translations 2020-07-10 15:16:47 -04:00
Radomir Dopieralski
742f9cfdb0 Fluff M0: additional pins on version 1.3 of the board 2020-07-10 20:40:58 +02:00
Scott Shawcroft
37e77b21cd
Merge pull request #3140 from dunkmann00/docs-version-conf
Set version and release in build workflow
2020-07-10 11:15:23 -07:00
Yihui Xiong
7ff499046b use VID & PIDs granted by Seeed 2020-07-11 00:37:45 +08:00
Lucian Copeland
eb86010176 Enable RGB Matrix 2020-07-10 11:06:12 -04:00
George Waters
a7634e8bf2
Set version and release in build workflow 2020-07-09 15:32:19 -04:00
Scott Shawcroft
41fe62929f
Merge pull request #3137 from jepler/update-mp3-lib
lib/mp3: update to 1.2.2 release
2020-07-09 10:31:42 -07:00
Scott Shawcroft
0068c76fa6
Merge pull request #3135 from arms22/bless_dev_board_multi_sensor
Add new board BLE-SS dev board Multi Sensor
2020-07-09 10:29:57 -07:00
Scott Shawcroft
121044cd57
Merge pull request #3132 from jepler/remove-audioio-compat
audioio: Remove compatibility code
2020-07-09 10:23:40 -07:00
Lucian Copeland
edc48a505f Complete F405 pin and periph definitions 2020-07-09 13:10:18 -04:00