Commit Graph

557 Commits

Author SHA1 Message Date
Scott Shawcroft
eb21fc3e31
Add partial display update support.
Different operations to the display tree have different costs. Be
aware of these costs when optimizing your code.
* Changing tiles indices in a TileGrid will update an area
covering them all.
* Changing a palette will refresh every object that references it.
* Moving a TileGrid will update both where it was and where it moved to.
* Adding something to a Group will refresh each individual area it
covers.
* Removing things from a Group will refresh one area that covers all
previous locations. (Not separate areas like add.)
* Setting a new top level Group will refresh the entire display.

Only TileGrid moves are optimized for overlap. All other overlaps
cause sending of duplicate pixels.

This also adds flip_x, flip_y and transpose_xy to TileGrid. They
change the direction of the pixels but not the location.

Fixes #1169. Fixes #1705. Fixes #1923.
2019-06-12 11:32:39 -07:00
Carlos
9de46f3edd [supervisor/shared/rgb_led_status.c] Initial support for RGB led as Status 2019-06-04 21:22:38 -05:00
Scott Shawcroft
7a117f52ed
Make point 2 in areas exclusive and simplify full_coverage. 2019-05-22 15:00:47 -07:00
Scott Shawcroft
3fad7de8db
Rework the pixel computation to use areas
This changes the displayio pixel computation from per-pixel to
per-area. This is precursor work to updating portions of the screen
(#1169). It should provide mild speedups because bounds checks are
done once per area rather than once per pixel. Filling by area also
allows TileGrid to maintain a row-associative fill pattern even when
the display's refresh is orthogonal to it.
2019-05-21 17:41:06 -07:00
Dan Halbert
dae8b21bb9
Merge pull request #1869 from tannewt/fix_programmatic_safe_mode
Update `on_next_reset` for new safe mode.
2019-05-09 23:03:39 -04:00
Scott Shawcroft
b87565138e
Rework safe mode so we can trigger on all resets 2019-05-09 10:15:28 -07:00
Scott Shawcroft
837d3f57ee
Update on_next_reset for new safe mode.
Fixes #1831
2019-05-08 15:23:40 -07:00
Terri Oda
a9b05d37d7 Make status light flash blue for incompatible mpy (fixes #1369) 2019-05-08 11:54:08 -07:00
Scott Shawcroft
796fc3f5ab
Update font location and shrink a bunch of builds 2019-04-12 15:25:48 -07:00
hexthat
a123cdc5ac
Update supervisor.mk 2019-04-12 12:55:55 -07:00
Radomir Dopieralski
1eede2d1e3 Allow overriding the font per board definition
This way boards with smaller screens can use smaller fonts
2019-04-12 12:09:53 +02:00
Scott Shawcroft
0f003ac5b8
Reorganize board busses into shared-bindings and shared-module. 2019-04-08 16:58:50 -07:00
Scott Shawcroft
7686f93ef4
Fix crash when getting board.SPI outside the VM
If one of the default pins was already in use it would crash.

The internal API has been refined to allow us to get the value
without causing an init of the singleton.

Fixes #1753
2019-04-05 19:06:37 -07:00
Dan Halbert
4f201964a6 Merge remote-tracking branch 'adafruit/master' into usb-disconnect 2019-04-05 11:11:31 -04:00
Dan Halbert
e5e9d2ba47 @hathach's changes; check cdc connected during string write 2019-04-04 18:58:35 -04:00
hathach
9d43a25d6e update tinyusb to fix disconnect/suspend issue with #1681 2019-04-04 17:59:20 -04:00
Scott Shawcroft
6fcda1dec4
Support multi-byte values with Bitmap
It also corrects the behavior of single byte values.

Fixes #1744
2019-04-04 12:50:35 -07:00
Scott Shawcroft
ceb6f2e4fc
Rework flash flush so it preserves the cache
This should make filesystem writes quicker and cause less heap
churn.
2019-04-03 18:28:27 -07:00
Scott Shawcroft
a5520f8a3d
Set the terminal tilegrid NULL after free
Without this, a double free can occur when a display (and terminal)
is released and then a crash occurs. Upon a second release,
different memory is released (sometimes the heap). When this is
followed by an allocation for the flash cache, the cache can
overwrite the active heap causing crashes.

Fixes #1667
2019-04-03 15:24:15 -07:00
Scott Shawcroft
503642e794
Make status LED brightness change immediate.
Fixes #1516
2019-03-26 16:43:35 -07:00
Scott Shawcroft
2c93ce5a28
Merge pull request #1672 from dhalbert/regular-fs-flush
flush flash filesystem once a second
2019-03-26 13:47:43 -07:00
Dan Halbert
2229f17911 reset flush timer on call to filesystem_flush() 2019-03-25 20:42:08 -04:00
Dan Halbert
2459eabd66 flush flash filesystem once a second 2019-03-20 12:21:36 -04:00
Scott Shawcroft
5e2fec714c
Move Glyph and BuiltinFont into fontio
It was confusing in displayio.

Fixes #1662
2019-03-19 16:22:09 -07:00
Scott Shawcroft
a086631607
Long live shared bus singletons
Without long living them you may clone them when long living a
module that uses them.

Fixes #1603
2019-03-14 15:17:53 -07:00
Scott Shawcroft
d6b2199f36
Stub out safe mode for mpy-cross 2019-03-12 11:18:30 -07:00
Scott Shawcroft
03be42ab84
Enter safe mode when an allocation is attempted on an uninitialized heap. 2019-03-12 11:18:26 -07:00
Dan Halbert
d218069f03
Merge pull request #1584 from tannewt/disable_concurrent_write_protection
Add option to disable the concurrent write protection
2019-02-21 17:15:50 -05:00
Scott Shawcroft
ed1ace09e9
Fix unix build by using filesystem stub 2019-02-21 13:23:28 -08:00
Scott Shawcroft
1a0596a2fb
Add option to disable the concurrent write protection
This allows writing to the filesystem from the host computer and
CircuitPython by increasing the risk of filesystem corruption.
2019-02-21 10:45:41 -08:00
Dan Halbert
0dc2600587
Merge pull request #1552 from tannewt/onsdbitmap
Fix displaying images off of SD cards.
2019-02-19 19:28:53 -05:00
Scott Shawcroft
46fd60c703
Prevent infinite display update recursion and fix VFS mounting
Fixes #1529
2019-02-19 14:50:31 -08:00
Dan Halbert
9c24c804fb Fix #ifdefs in port.c to call xxx_reset() rroutines properly. Remove most uses of EXPRESS_BOARD. 2019-02-18 22:44:31 -05:00
Dan Halbert
90bc09a31e
Merge pull request #1553 from tannewt/group_children
Store the original layer in Group
2019-02-16 08:47:09 -05:00
Dan Halbert
7b3f7605b8 address @tannewt changes: move and rename common files; remove PORT_HEAP_SIZE 2019-02-15 20:32:32 -05:00
Scott Shawcroft
c9f036ed40
Store the original layer in Group
As is we would return the native superclass object only.

Fixes #1551
2019-02-15 14:29:59 -08:00
Scott Shawcroft
c17f147be9
A variety of displayio improvements
This changes a number of things in displayio:
* Introduces BuiltinFont and Glyph so the built in font can be used by libraries. For boards with
  a font it is available as board.TERMINAL_FONT. Fixes #1172
* Remove _load_row from Bitmap in favor of bitmap[] access. Index can be x/y tuple or overall index. Fixes #1191
* Add width and height properties to Bitmap.
* Add insert and [] access to Group. Fixes #1518
* Add index param to pop on Group.
* Terminal no longer takes unicode character info. It takes a BuiltinFont instead.
* Fix Terminal's handling of [###D vt100 commands used when up arrowing into repl history.
* Add x and y positions to Group plus scale as well.
* Add bitmap accessor for BuiltinFont
2019-02-11 20:55:05 -08:00
Lionel Debroux
943216deda Make several const char / const char * arrays static to save a bit of space.
Signed-off-by: Lionel Debroux <lionel_debroux@yahoo.fr>
2019-02-07 20:10:43 +01:00
Scott Shawcroft
03068a9388
Fix built-in inits and terminal allocate 2019-02-01 01:00:10 -08:00
Scott Shawcroft
ec03887040
Fix hallowing and nrf builds 2019-01-31 11:42:15 -08:00
Scott Shawcroft
4672866eec
Remove Sprite references 2019-01-31 11:42:14 -08:00
Scott Shawcroft
601a910f4e
More improvements to Terminal:
* Fix Hallowing.
* Fix builds without displayio.
* Fix y bounds that appears as untrollable row of pixels.
* Add scrolling to TileGrid.
* Remove Sprite to save space. TileGrid is a drop in replacement.
2019-01-31 11:42:14 -08:00
Scott Shawcroft
1a1dbef992
Hook up the terminal based on the first display. 2019-01-31 11:42:14 -08:00
Scott Shawcroft
590e029198
Begin font parsing and packing for terminal 2019-01-31 11:42:13 -08:00
Dan Halbert
323108e2ba
Merge pull request #1503 from hathach/nrf-tinyusb-sd
update tinyusb, work better with sd
2019-01-31 10:36:12 -05:00
Elias Santistevan
9984b26a32 Updates devices.h to include the W25Q32FV flash chip that is on the SparkFun LumiDrive and Redboard Turbo 2019-01-30 13:53:00 -07:00
hathach
a51f2b0716 refactor nrfx from supervisor/usb.c 2019-01-30 22:30:23 +07:00
hathach
164e1e2341 re-init usb hardware when enable/disable SD 2019-01-30 14:13:07 +07:00
hathach
d1fb384a4a
update tinyusb, work better with sd 2019-01-29 21:03:18 +07:00
Scott Shawcroft
edc8383e22
Improvements thanks to danh's review 2019-01-18 16:37:06 -08:00
Scott Shawcroft
6404aaf411
Fix up nrf and using board.SPI in FourWire 2019-01-17 18:19:07 -08:00
Scott Shawcroft
760bd8d8a4
share fourwire and make nrf compile 2019-01-17 15:15:59 -08:00
Scott Shawcroft
05d8885a1a
Rework displays in prep for dynamic support and 8bit parallel. 2019-01-16 12:05:20 -08:00
Scott Shawcroft
747f2cfe26
Add subclass support to displayio.
Also, swap make_news to accept a kwarg map and refine param checking.

Fixes #1237
2019-01-14 17:29:19 -08:00
Scott Shawcroft
3dd59c3d5f
Polish thanks to Dan's feedback 2019-01-10 11:00:40 -08:00
Scott Shawcroft
b5e40f52c2
Add USB MIDI support for SAMD and nRF.
The API should be identical to using a UART for MIDI.

Fixes #672
2019-01-09 14:02:11 -08:00
Dan Halbert
bce6d124af Don't check for corrupt heap too early; Fix QSPI timing 2018-12-20 21:28:36 -05:00
Scott Shawcroft
89ef6eef57
Fix unused parameter 2018-12-07 09:56:35 -08:00
Scott Shawcroft
808ca676b6
Fix unix 2018-12-06 17:12:30 -08:00
Scott Shawcroft
df6c8eaed7
Add stack.c stub for mpy-cross 2018-12-06 15:29:26 -08:00
Scott Shawcroft
6ef8639971
Rework safe mode and have heap overwrite trigger it.
This creates a common safe mode mechanic that ports can share.
As a result, the nRF52 now has safe mode support as well.

The common safe mode adds a 700ms delay at startup where a reset
during that window will cause a reset into safe mode. This window
is designated by a yellow status pixel and flashing the single led
three times.

A couple NeoPixel fixes are included for the nRF52 as well.

Fixes #1034. Fixes #990. Fixes #615.
2018-12-06 14:24:20 -08:00
Scott Shawcroft
7ad2e6ace3
Add stack validity check and raise an error when it happens.
The backtrace cannot be given because it relies on the validity
of the qstr data structures on the heap which may have been
corrupted.

In fact, it still can crash hard when the bytecode itself is
overwritten. To fix, we'd need a way to skip gathering the
backtrace completely.

This also increases the default stack size on M4s so it can
accomodate the stack needed by ASF4s nvm API.
2018-12-04 23:26:04 -08:00
Scott Shawcroft
b25bf062fb
Add correct flash chip for Particle Mesh boards 2018-12-04 18:20:51 -08:00
Scott Shawcroft
15c1fc873c
Add particle boards, fix cp32 and try to speed up atmel build 2018-12-04 18:20:48 -08:00
Scott Shawcroft
77760090e2
Fix up spi flash define 2018-11-30 14:55:06 -08:00
Scott Shawcroft
d446d328d8
Fix QSPI on Feather nRF52840
We were writing with quad page program including the address (0x38)
which is unsupported by the GD25Q16C but it is supported by the
flash on the DK. So, we use the single address, quad data command
(0x32).
2018-11-27 00:13:24 -08:00
Scott Shawcroft
324301e3bc
Update tinyusb to include control fixes. 2018-11-23 13:28:10 -08:00
Scott Shawcroft
b67c53edfa
Factor out of external flash as well.
Plus some cleanup.

Fixes #1324
2018-11-14 18:30:47 -08:00
Scott Shawcroft
87ddd64481
Factor out fake partition 2018-11-14 17:59:11 -08:00
Scott Shawcroft
47212ee31e
start debug 2018-11-14 17:21:48 -08:00
Scott Shawcroft
d012fd1553
Only write to usb when its around. 2018-11-09 17:06:55 -08:00
Scott Shawcroft
355abc835e
Fix output overflow and make help translatable 2018-11-09 16:41:08 -08:00
Scott Shawcroft
43f7ca7985
Incorporate feedback:
* Clean up board defines.
* Add flush on eject and stay ejected.
* Swith back to NONE protocol for CDC.
2018-11-09 11:33:56 -08:00
Scott Shawcroft
168e23e466
Build refinement to handle warnings and quiet output 2018-11-09 00:11:43 -08:00
Scott Shawcroft
9d91111b1b
Move atmel-samd to tinyusb and support nRF flash.
This started while adding USB MIDI support (and descriptor support is
in this change.) When seeing that I'd have to implement the MIDI class
logic twice, once for atmel-samd and once for nrf, I decided to refactor
the USB stack so its shared across ports. This has led to a number of
changes that remove items from the ports folder and move them into
supervisor.

Furthermore, we had external SPI flash support for nrf pending so I
factored out the connection between the usb stack and the flash API as
well. This PR also includes the QSPI support for nRF.
2018-11-08 17:25:30 -08:00
Dan Halbert
9ea809bef7 add pin claiming to devices 2018-08-31 18:38:05 -04:00
Scott Shawcroft
2cd166b573
Fix esp and samd 2018-08-16 17:41:35 -07:00
Scott Shawcroft
137a30ad75
fix mpy-cross 2018-08-16 17:40:57 -07:00
Scott Shawcroft
de5a9d72dc
Compress all translated strings with Huffman coding.
This saves code space in builds which use link-time optimization.
The optimization drops the untranslated strings and replaces them
with a compressed_string_t struct. It can then be decompressed to
a c string.

Builds without LTO work as well but include both untranslated
strings and compressed strings.

This work could be expanded to include QSTRs and loaded strings if
a compress method is added to C. Its tracked in #531.
2018-08-16 17:40:57 -07:00
Scott Shawcroft
e72cebbad6
Fix crash due to unsigned index and 0 boundary loop. 2018-08-16 00:29:18 -07:00
Scott Shawcroft
933add6cd8
Support internationalisation. 2018-08-07 14:58:57 -07:00
Dan Halbert
dfa2581ffd
Merge pull request #1057 from tannewt/flexible_heap
Add basic memory allocation outside Python runtime
2018-08-02 18:43:06 -04:00
Scott Shawcroft
4b247eacd8
Add todo for handling improper free. 2018-08-02 14:45:21 -07:00
Scott Shawcroft
5704bc8c93
Share memory.c and a bit of polish. 2018-08-02 14:35:46 -07:00
Scott Shawcroft
168aa394db
Move pin struct to the peripherals library.
Its slimmed down by removing the qstr and bit packing TCC info.

The trinket m0 build actually grows by 20 bytes. The arduino zero
build shrinks by 188 bytes.
2018-08-02 13:59:05 -07:00
Scott Shawcroft
a88cdaca6a
Remove rogue execute bit. Must a common incorrect shortcut for me. :-) 2018-07-31 12:42:21 -07:00
Scott Shawcroft
12cf5e51c2
Allow for resizing the stack area. 2018-07-31 05:18:23 -07:00
Scott Shawcroft
777542c716
Add basic memory allocation outside Python runtime
This allows for the heap to fill all space but the stack. It also
allows us to designate space for memory outside the runtime for
things such as USB descriptors, flash cache and main filename.

Fixes #754
2018-07-31 05:18:03 -07:00
Scott Shawcroft
ec78d3cefd
Mark pointers in cpu registers as in use.
This prevents bugs where gc_collect is called from C code that did
a recent allocation.
2018-07-03 05:45:50 -07:00
Scott Shawcroft
fd71e56891 atmel-samd: Re-org helper peripheral files into their own subdirectory.
Ideally in the future they won't depend on ASF4 or MicroPython.
2018-06-01 15:07:31 -07:00
Roy Hooper
06b6a10a5e switch autoreload to reloadexception 2018-05-14 17:44:50 -04:00
Roy Hooper
698912633f Rename reload_next_character to reload_requested to make it match it's intended use 2018-05-14 17:00:38 -04:00
Scott Shawcroft
5f9b3f2b87 Fix the status neopixel flashing.
We were storing the wrong current color.
2018-04-12 13:33:58 -07:00
Dan Halbert
5f98953ed8 esp8266 and nrf: raise NotImplementedError 2018-04-10 12:08:41 -04:00
Dan Halbert
aa8c262d14 add storage.erase_filesystem() to erase and reformat CIRCUITPY 2018-04-09 12:52:42 -04:00
Bryan Siepert
942b7ffbe0 fixes hardware dotstar support for 3.0 and addresses issue #514 2018-03-08 20:39:47 -08:00
Scott Shawcroft
bf05183158 Merge remote-tracking branch 'adafruit/2.x' into merge_2x 2018-02-27 15:24:16 -08:00
microbuilder
60a23f0fb6 nRF52 update with internal file system support 2017-12-21 13:49:14 +01:00
mrmcwethy
a38d8948b3 M4 status LED flashing with no main.py present #447 Initialized stack variable 2017-11-22 22:57:50 -08:00
Scott Shawcroft
ecc47d5258 Create supervisor module.
It can control autoreload and the rgb status led.
2017-11-16 09:04:17 -08:00
bsiepert
b4fc464a4d support for doubled file extensions ala issue #383 (#415)
Fixes #383
2017-11-07 23:00:44 -08:00
Scott Shawcroft
3177e10e9e atmel-samd: Add samd21 neopixel support.
Also, fix and enable the status neopixel.

Fixes #264
2017-10-31 22:38:09 -07:00
Scott Shawcroft
4aeef100f6 atmel-samd: More USB polish
* Introduce a python script to generate the USB descriptor instead of
  a bunch of C macros. In the future, we can use this dynamically in
  CircuitPython.
* Add support for detecting read-only mass storage mounts.

Fixes #377
2017-10-30 18:29:20 -07:00
Dan Halbert
fabaa2ec30 merge 2.x changes into master; touch up Makefile CFLAGS logic 2017-10-12 20:10:31 -04:00
Scott Shawcroft
80654779e1 atmel-samd: Add support for internal filesystems. (#311)
* atmel-samd: Add support for internal filesystems.

This allows us to re-enable `os`. `random` is also enabled because
it solely depends on `os`.

Fixes #266. Its also a pre-requisite for #260.

* atmel-samd: Update SAMD51 linker script comments and MICROPY_MAX_STACK_USAGE enabling.
2017-10-10 14:36:00 -04:00
Scott Shawcroft
0bbb7a8199 Add support for patching newer ASF4 code. (#292)
* atmel-samd: Support patching after updating ASF4.

This makes it possible to automatically fix newer code.

* atmel-samd: Update ASF4 to include flash APIs for SAMD51.

This is the first automatic update that has caused a few deletions
where code was previously copied instead of moved.

This is a prerequisite for #260.
2017-09-28 23:33:44 -04:00
Scott Shawcroft
6839fff313 Move to ASF4 and introduce SAMD51 support. (#258)
* atmel-samd: Remove ASF3. This will break builds.

* atmel-samd: Add ASF4 for the SAMD21 and SAMD51.

* Introduce the supervisor concept to facilitate porting.

The supervisor is the code which runs individual MicroPython VMs. By
splitting it out we make it more consistent and easier to find.

This also adds very basic SAMD21 and SAMD51 support using the
supervisor. Only the REPL currently works.

This begins the work for #178.
2017-09-22 21:05:51 -04:00