Commit Graph

152 Commits

Author SHA1 Message Date
Dan Halbert 1b3028bed1 make translate and remove backslash-r's 2019-12-12 14:51:50 -05:00
Dan Halbert 7889b999cc Fix flash write error handling; clean up safe mode message printing 2019-12-12 14:41:49 -05:00
Jeff Epler f4a5c17b5e supervisor: external_flash: don't call m_free when it's bad
It's extremely dubious that we have these handles that we think
are to GC'd memory at a time when the gc pool may not be initialized.
Hopefully, they WERE valid GC memory and are undisturbed by the teardown
of the interpreter that can lead to this state.

In this case, don't try to m_free them, the memory will become free when
the GC heap is reinitialized.

Closes: #2338 (together with previous commit)
2019-12-10 17:07:20 -06:00
Jeff Epler b22fbcd77d supervisor: external_flash: don't call m_malloc_maybe when it's bad 2019-12-10 17:06:09 -06:00
Scott Shawcroft e8a54eacaa
Comment supervisor ble data arrays. 2019-12-06 11:13:22 -08:00
Scott Shawcroft 17c8356b8c
Add connection interval and debugging
This also sets TinyUSB to master and to not include its submodules.

It also fixes an old displayio example comment and retries gattc
reads.
2019-12-04 14:39:02 -08:00
Scott Shawcroft 15886b1505
Merge pull request #2345 from jepler/compressed-unicode
translation: Compress as unicode, not bytes
2019-12-02 17:11:49 -08:00
Jeff Epler e06a3bbceb translation: Compress as unicode, not bytes
By treating each unicode code-point as a single entity for huffman
compression, the overall compression rate can be somewhat improved
without changing the algorithm.  On the decompression side, when
compressed values above 127 are encountered, they need to be
converted from a 16-bit Unicode code point into a UTF-8 byte
sequence.

Doing this returns approximately 1.5kB of flash storage with the
zh_Latn_pinyin translation. (292 -> 1768 bytes remaining in my build
of trinket_m0)

Other "more ASCII" translations benefit less, and in fact
zh_Latn_pinyin is no longer the most constrained translation!
(de_DE 1156 -> 1384 bytes free in flash, I didn't check others
before pushing for CI)

English is slightly pessimized, 2840 -> 2788 bytes, probably mostly
because the "values" array was changed from uint8_t to uint16_t,
which is strictly not required for an all-ASCII translation.  This
could probably be avoided in this case, but as English is not the
most constrained translation it doesn't really matter.

Testing performed: built for feather nRF52840 express and trinket m0
in English and zh_Latn_pinyin; ran and verified the localized
messages such as
    Àn xià rènhé jiàn jìnrù REPL. Shǐyòng CTRL-D chóngxīn jiāzài.
and
    Press any key to enter the REPL. Use CTRL-D to reload.
were properly displayed.
2019-12-02 09:46:46 -06:00
Jeff Epler 95d9c49e43 Merge remote-tracking branch 'origin/master' into tick-refactor 2019-11-29 11:27:09 -06:00
Ayan Pahwa 718a28c886 update filesystem.c 2019-11-26 01:13:46 +05:30
Ayan Pahwa 5e1740d11f Not creating code.py file for non-express boards 2019-11-26 00:06:03 +05:30
Ayan Pahwa 9c6466cffb Fix build failure for boards with less memory 2019-11-25 22:31:01 +05:30
Ayan Pahwa 180b485f8b Enable creation of code.py only for full builds 2019-11-23 20:58:33 +05:30
Ayan Pahwa 262cfd4ea3 Passing address of char_written at f_write 2019-11-23 20:47:30 +05:30
Ayan Pahwa 5823f5ed04 Add \n to file end 2019-11-23 20:43:24 +05:30
Jeff Epler 46c5775ba4 supervisor: tick: add supervisor_fake_tick 2019-11-20 14:37:13 -06:00
Jeff Epler a9baa0f954 supervisor: tick: document 2019-11-20 14:37:13 -06:00
Jeff Epler 70719597ab supervisor: tick: Rewrite without atomics 2019-11-20 14:37:13 -06:00
Ayan Pahwa a0ef667a14 Supervisor: create code.py file with sample code 2019-11-19 01:59:29 +05:30
Jeff Epler 568636d562 run_background_tasks: Do nothing unless there has been a tick
This improves performance of running python code by 34%, based
on the "pystone" benchmark on metro m4 express at 5000 passes
(1127.65 -> 1521.6 passes/second).

In addition, by instrumenting the tick function and monitoring on an
oscilloscope, the time actually spent in run_background_tasks() on
the metro m4 decreases from average 43% to 0.5%. (however, there's
some additional overhead that is moved around and not accounted for
in that "0.5%" figure, each time supervisor_run_background_tasks_if_tick
is called but no tick has occurred)

On the CPB, it increases pystone from 633 to 769, a smaller percentage
increase of 21%.  I did not measure the time actually spent in
run_background_tasks() on CPB.

Testing performed: on metro m4 and cpb, run pystone adapted from python3.4
(change time.time to time.monotonic for sub-second resolution)

Besides running a 5000 pass test, I also ran a 50-pass test while
scoping how long an output pin was set.  Average: 34.59ms or 1445/s on m4,
67.61ms or 739/s on cbp, both matching the other pystone result reasonably
well.

import pystone
import board
import digitalio
import time

d = digitalio.DigitalInOut(board.D13)
d.direction = digitalio.Direction.OUTPUT

while True:
    d.value = 0
    time.sleep(.01)
    d.value = 1
    pystone.main(50)
2019-11-18 11:26:48 -06:00
Jeff Epler 7f744a2369 Supervisor: move most of systick to the supervisor
This code is shared by most parts, except where not all the #ifdefs
inside the tick function were present in all ports.  This mostly would
have broken gamepad tick support on non-samd ports.

The "ms32" and "ms64" variants of the tick functions are introduced
because there is no 64-bit atomic read.  Disabling interrupts avoids
a low probability bug where milliseconds could be off by ~49.5 days
once every ~49.5 days (2^32 ms).

Avoiding disabling interrupts when only the low 32 bits are needed is a minor
optimization.

Testing performed: on metro m4 express, USB still works and
time.monotonic_ns() still counts up
2019-11-18 11:01:23 -06:00
Hierophect 8ff1bc0132 add missing include 2019-11-15 12:49:47 -05:00
Hierophect de5691acf5 Add never_reset and reset to pin common hal, adjust files 2019-11-15 12:47:00 -05:00
Thea Flowers 73989dbcaf Add board configuration for Winterbloom Sol 2019-11-04 23:11:42 -08:00
Dan Halbert 8cd2f87e99
Merge pull request #2236 from tannewt/bleio_tweaks
Refine _bleio
2019-11-04 22:27:54 -05:00
Scott Shawcroft 47e50e5659
Merge remote-tracking branch 'adafruit/master' into bleio_tweaks 2019-11-01 13:20:58 -07:00
Dan Halbert 99fe905039 Reduce DotStar status brightness; macros for status colors 2019-11-01 13:37:36 -04:00
Dan Halbert ab6fd34828 add object types to rgb status objects;mark spi rgb objects as never_reset 2019-10-25 22:32:43 -04:00
Dan Halbert cdeb0857a9 Initial Itsy nRF52840 defn 2019-10-25 11:15:34 -04:00
Scott Shawcroft ece8352126
Fix build by removing unused vars 2019-10-22 17:24:04 -07:00
Scott Shawcroft ae30a1e5aa
Refine _bleio
This PR refines the _bleio API. It was originally motivated by
the addition of a new CircuitPython service that enables reading
and modifying files on the device. Moving the BLE lifecycle outside
of the VM motivated a number of changes to remove heap allocations
in some APIs.

It also motivated unifying connection initiation to the Adapter class
rather than the Central and Peripheral classes which have been removed.
Adapter now handles the GAP portion of BLE including advertising, which
has moved but is largely unchanged, and scanning, which has been enhanced
to return an iterator of filtered results.

Once a connection is created (either by us (aka Central) or a remote
device (aka Peripheral)) it is represented by a new Connection class.
This class knows the current connection state and can discover and
instantiate remote Services along with their Characteristics and
Descriptors.

Relates to #586
2019-10-21 18:57:03 -07:00
Kamil Tomaszewski f3151bb6c4 Use get top and limit stack functions 2019-10-18 11:05:08 +02:00
Scott Shawcroft 1a7c787d3c
Merge branch 'master' into master 2019-10-14 19:47:46 -07:00
arturo182 e0f60d0c17 Add IS25LP128F flash device definition 2019-10-14 23:42:53 +02:00
Cedar Grove Maker Studios f1ab9aaa9c
add def for AT25SF161-SSHD-T 2MiB SPI flash chip 2019-10-14 11:58:14 -07:00
Hierophect eacdb1da6e Disable timeout, remove redundancy 2019-10-03 14:43:25 -04:00
Hierophect 8a4bbae077 Fix typo causing parsing error 2019-10-02 18:18:52 -04:00
Hierophect 9aa6d215fd Add some definitions for when F412 can be implemented 2019-10-02 16:03:22 -04:00
Dan Halbert b8200d7295 fix atmel-samd filesystem_tick'ing; clear_temp_status() should check for status indicator in use 2019-09-09 23:17:52 -04:00
Scott Shawcroft 949f8761b8
Add .hidden to TileGrid and Group
This allows for one to preserve ordering within a Group while
hiding something temporarily.

Fixes #1688
2019-09-03 16:15:27 -07:00
Dan Halbert 35c7646ee4
Make trivial change to redo GitHub Actions build.
The GitHub Actions build for this PR is failing for reasons that make no sense. Make a tiny commit change to see if it will refresh things and work again.
2019-09-03 08:52:21 -04:00
arturo182 12c97b42a4 Add GD25Q32C flash device definition 2019-09-02 23:22:52 +02:00
Dan Halbert 4b97ec9d23 Merge in 4.x status dotstar fix 2019-09-02 10:25:38 -04:00
Scott Shawcroft 0876d5c4ad
Disable bitbangio on Itsy M0
Also, switch CIRCUITPY_BITBANG_APA102 to makefile setting so it can alter included files
2019-08-27 15:21:47 -07:00
Scott Shawcroft 7324b70a7c
Rework based on Dan's review 2019-08-23 15:27:21 -07:00
Scott Shawcroft 9993a99906
Add initial Monster M4SK build 2019-08-22 14:24:32 -07:00
Scott Shawcroft 70680d5b22
EPaper displays work mostly. 2019-08-22 14:08:33 -07:00
Dan Halbert 243334da75 Merge remote-tracking branch 'adafruit/master' into ble-pairing 2019-08-05 23:06:24 -04:00
Scott Shawcroft 26f64dd8ec
Merge remote-tracking branch 'adafruit/4.1.x' into merge_in_410 2019-08-05 17:53:08 -07:00
Dan Halbert ee518b9141 Merge remote-tracking branch 'adafruit/master' into ble-pairing 2019-07-31 11:22:48 -04:00