Commit Graph

16541 Commits

Author SHA1 Message Date
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
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 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
Scott Shawcroft a6c20208b3
Merge pull request #3148 from weblate/weblate-circuitpython-main
Translations update from Weblate
2020-07-14 11:20:27 -07: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
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
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
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
Jeff Epler f1509debc3 lib/mp3: update to 1.2.2 release
This fixes the audio clipping bug
2020-07-09 10:05:08 -05:00
Yihui Xiong 678f266394 fix pre-commit check 2020-07-09 10:25:46 +00:00
Radomir Dopieralski e0733d153e SAMD: configurable brownout, separate the variables 2020-07-09 12:17:07 +02:00
Yihui Xiong 8fef69809c add m60 keyboard and nrf52840 m.2 devkit to build action
Signed-off-by: Yihui Xiong <yihui.xiong@hotmail.com>
2020-07-09 10:04:26 +00:00
Yihui Xiong 96f6ce222c add makerdiary m60 keyboard
Signed-off-by: Yihui Xiong <yihui.xiong@hotmail.com>
2020-07-09 10:02:27 +00:00
Yihui Xiong e81d22cd67 add makerdiary nrf52840 m.2 devkit
Signed-off-by: Yihui Xiong <yihui.xiong@hotmail.com>
2020-07-09 10:01:04 +00:00
arms22 bb5cdcf954 Add new board BLE-SS dev board Multi Sensor 2020-07-09 11:26:45 +09:00
Jeff Epler 6d97f6fccc audioio: Remove compatibility code
These items were aliased from audiocore to audioio for compatibility
with 4.x, but according to our deprecation schedule can be removed
in 6.0.
2020-07-08 20:31:35 -05:00
Scott Shawcroft ce214e82a5
Merge pull request #3127 from Arudinne/Raytac_MDBT50Q-DB-40
Add new board Raytac MDBT50Q-DB-40
2020-07-08 11:34:56 -07:00
Scott Shawcroft dcf80e39dc
Merge pull request #3067 from jepler/stm-spi-pin-search
STM32: revamp SPI pin search code
2020-07-08 11:32:26 -07:00
Radomir Dopieralski 83a27edd20 SAMD: make the brownout detection level configurable per board
Not all boards have external flash or other components that make them
require 2.7V -- sometimes we can get considerably longer battery life
by decreasing this requirement.

In particular, pewpew10 and pewpew_m4 are powered directly from
battery, with no LDO, and should work fine down to 1.6V.
2020-07-08 19:59:53 +02:00
Arudinne 768149fb01 modified: ports/nrf/boards/raytac_mdbt50q-db-40/pins.c 2020-07-08 10:36:41 -05:00
Jeff Epler 959b4da9bb make translate 2020-07-07 14:38:34 -05:00
Arudinne 5a9aac472a modified: ports/nrf/boards/raytac_mdbt50q-db-40/pins.c 2020-07-07 14:37:59 -05:00