Commit Graph

718 Commits

Author SHA1 Message Date
Bernhard Boser
59c3e25168
disable on boards tight on memory. add stddef.h to imports (not actually needed). 2020-12-01 18:39:24 -08:00
Bernhard Boser
a310cde8c1
fixed res may not be initialized in read_size 2020-12-01 18:38:47 -08:00
Bernhard Boser
b805bf8a62
cleanup 2020-12-01 18:38:47 -08:00
Bernhard Boser
44bc75af37
output little endian; update example 2020-12-01 18:38:47 -08:00
Bernhard Boser
912691e0d2
removed blanks line at end of file 2020-12-01 18:38:14 -08:00
Bernhard Boser
513253bc3f
moved logic to shared-module and added documentation 2020-12-01 18:38:14 -08:00
Mark
237385798c
Merge branch 'main' into bus_device 2020-12-01 15:47:16 -06:00
Christian Walther
7ca36d45a4 Fix align32_size().
It not only caused crashes with requests larger than 64K (can happen with RGBMatrix), but also generated a lot longer code than necessary.
2020-11-28 17:54:34 +01:00
Christian Walther
a4b84cf0e1 Use movable allocation system for RGBMatrix allocations.
Hybrid allocation is now part of the infrastructure. Moving memory contents would not be necessary because displayio can recreate them, but does not hurt.
2020-11-28 17:54:34 +01:00
Christian Walther
ac91220361 Use movable allocation system for Sharp display framebuffer.
Hybrid allocation is now part of the infrastructure. Moving memory contents would not be necessary because displayio can recreate them, but does not hurt.
2020-11-28 17:54:34 +01:00
Christian Walther
c7404a3ff8 Add movable allocation system.
This allows calls to `allocate_memory()` while the VM is running, it will then allocate from the GC heap (unless there is a suitable hole among the supervisor allocations), and when the VM exits and the GC heap is freed, the allocation will be moved to the bottom of the former GC heap and transformed into a proper supervisor allocation. Existing movable allocations will also be moved to defragment the supervisor heap and ensure that the next VM run gets as much memory as possible for the GC heap.

By itself this breaks terminalio because it violates the assumption that supervisor_display_move_memory() still has access to an undisturbed heap to copy the tilegrid from. It will work in many cases, but if you're unlucky you will get garbled terminal contents after exiting from the vm run that created the display. This will be fixed in the following commit, which is separate to simplify review.
2020-11-28 17:50:23 +01:00
Dan Halbert
596e0e4bd2 merge from upstream 2020-11-27 16:06:57 -05:00
Dan Halbert
ef0830bfe2 merge from upstream + wip 2020-11-25 17:52:06 -05:00
James Bowman
fc344bc818 Fix opcode typo in VertexFormat() 2020-11-24 17:26:39 -08:00
Scott Shawcroft
491e314799
Merge pull request #3718 from jepler/epd-rotation
EPaperDisplay: add rotation property
2020-11-23 15:04:26 -08:00
Scott Shawcroft
2463a6d6ac
Fix Palette grayscale for EInk.
It needs to do the bitmasking that was only added to ColorConverter
in #3611
2020-11-18 16:32:07 -08:00
Jeff Epler
f61f8f999b EPaperDisplay: add rotation property
untested, because I don't want to mess my magtag demo up :) but it builds
2020-11-18 18:06:31 -06:00
Scott Shawcroft
78ccac930f
Add .busy property to EPaperDisplay 2020-11-13 18:57:52 -08:00
Scott Shawcroft
8d4296f964
Add board.DISPLAY to MagTag. Fix luma computation
* Initialize the EPaper display on the MagTag at start.
* Tweak the display send to take a const buffer.
* Correct Luma math
  * Multiply the blue component, not add.
  * Add all of the components together before dividing. This
    reduces the impact of truncated division.
2020-11-13 18:57:52 -08:00
gamblor21
03b110b44c Add abort check in I2C lock 2020-11-11 09:58:08 -06:00
foamyguy
46c9b28dd8 use full_change instead of moved 2020-11-09 18:14:31 -06:00
foamyguy
9adb77a2d0 set moved true when unhiding tilegrid 2020-11-08 19:28:46 -06:00
gamblor21
4c93db3595 Renamed to adafruit_bus_device 2020-11-03 18:35:20 -06:00
gamblor21
8bbbb2833a Fixes from testing SPI 2020-11-01 21:38:20 -06:00
gamblor21
78477a374a Initial SPI commit 2020-10-31 12:17:29 -05:00
Dan Halbert
144eb131ae
Merge pull request #3627 from adafruit/6.0.x
Merge 6.0.x bugfixes to main
2020-10-31 12:28:20 -04:00
gamblor21
e7da852db7 Fixing review comments 2020-10-29 16:13:03 -05:00
gamblor21
2374b0d013 Fixed whitespace issues 2020-10-27 09:13:14 -05:00
Scott Shawcroft
0d1649880f
Add grayscale EInk support 2020-10-26 16:59:59 -07:00
gamblor21
8a379830a8 Added doc and translations 2020-10-26 16:54:24 -05:00
Christian Walther
99a3750a2c Fix lost board.SPI and board.I2C after explicitly deiniting them.
After calling board.SPI().deinit(), calling board.SPI() again would return the unusable deinited object and there was no way of getting it back into an initialized state until the end of the session.
2020-10-26 22:44:38 +01:00
Christian Walther
f4f80e07ca Fix lost board.SPI and board.I2C after being used by display.
Fixes #3581.

Pins were marked as never_reset by common_hal_displayio_fourwire_construct() and common_hal_sharpdisplay_framebuffer_construct(), but these marks were never removed, so at the end of a session after displayio.release_displays(), {spi|i2c}_singleton would be set to NULL but the pins would not be reset. In the next session, board.SPI() and board.I2C() were unable to reconstruct the object because the pins were still in use.

For symmetry with creation of the singleton, add deinitialization before setting it to NULL in reset_board_busses(). This makes the pins resettable, so that reset_port(), moved behind it, then resets them.
2020-10-26 22:44:38 +01:00
Christian Walther
1117edae63 Fix erroneous claim of board.I2C() by deinited display.
At the end of a session that called displayio.release_displays() (and did not initialize a new display), a board.I2C() bus that was previously used by a display would wrongly be considered still in use. While I can’t think of any unrecoverable problem this would cause in the next session, it violates the assumption that a soft reboot resets everything not needed by displays, potentially leading to confusion.

By itself, this change does not fix the problem yet - rather, it introduces the same issue as in #3581 for SPI. This needs to be solved in the same way for I2C and SPI.
2020-10-26 22:44:38 +01:00
gamblor21
12d770b427 Added __probe_for_device 2020-10-25 10:15:45 -05:00
gamblor21
b637d3911e Initial commit 2020-10-24 20:48:35 -05:00
Jeff Epler
b520498c73 sharpdisplay: Re-use supervisor allocations if possible
This is enabled by #3482

I was unable to determine why previously I had added sizeof(void*)
to the GC heap allocation, so I removed that code as a mistake.
2020-10-22 12:36:12 -05:00
Jensen
fc3f2a3f7f displayio: Remove trailing whitespace 2020-10-16 20:05:39 -05:00
Jensen Kuras
575b2e607b
Merge branch 'main' into color-converter-transparency 2020-10-16 19:55:24 -05:00
Jensen
74c07a4bdc displayio: Add in opaque pixel option for future 2020-10-16 19:50:41 -05:00
Jeff Epler
88d07ef35b displayio: further ensure just one start_terminal call
@cwalther determined that for boards with 2 displays (monster m4sk),
start_terminal would be called for each one, leaking supervisor heap
entries.

Determine, by comparing addresses, whether the display being acted on
is the first display (number zero) and do (or do not) call start_terminal.

stop_terminal can safely be called multiple times, so there's no need
to guard against calling it more than once.

Slight behavioral change: The terminal size would follow the displays[0]
size, not the displays[1] size
2020-10-15 15:24:19 -05:00
Jensen
3c5a08628a Merge branch 'color-converter-transparency' of github.com:jensechu/circuitpython into color-converter-transparency 2020-10-14 21:52:49 -05:00
Jensen
2517e4b486 displayio: ColorConverter handle if opaque color is black 2020-10-14 21:51:40 -05:00
Jensen Kuras
de9ea47e8e
Merge branch 'main' into color-converter-transparency 2020-10-12 20:48:55 -05:00
Jensen
337019626a displayio: Add make_transparent to ColorConverter 2020-10-12 20:48:04 -05:00
Jensen
b359e2945a displayio: Add make_transparent and make_opaque to ColorConvertor 2020-10-12 20:48:04 -05:00
Jensen
57b44928a3 displayio: Pass transparent_color to ColorConverter
Signed-off-by: Jensen <jensechu@gmail.com>
2020-10-12 20:48:04 -05:00
Scott Shawcroft
1eb1434fc9
Merge pull request #3537 from jepler/update-protomatter-2
rgbmatrix: update protomatter to 1.0.5 tag
2020-10-12 15:45:51 -07:00
Scott Shawcroft
2e5bea2629
Merge pull request #3543 from jepler/rgbmatrix-brighness-crash
rgbmatrix: Don't crash when setting brightness=0
2020-10-12 15:24:58 -07:00
Jeff Epler
9696dbfd38 rgbmatrix: Don't crash when setting brightness=0
If the display is paused, `_PM_swapbuffer_maybe` will never return.
So, when brightness is 0, refresh does nothing.  This makes it necessary
to update the display when unpausing.

Closes: #3524
2020-10-12 13:28:20 -05:00
Jeff Epler
774f2e16ba displayio, framebufferio: Remove spurious call to supervisor_start_terminal
A call to supervisor_start_terminal remained in
common_hal_displayio_display_construct and was copied to other display
_construct functions, even though it was also being done in
displayio_display_core_construct when that was factored out.

Originally, this was harmless, except it created an extra allocation.
When investigating #3482, I found that this bug became harmful,
especially for displays that were created in Python code, because it
caused a supervisor allocation to leak.

I believe that it is safe to merge #3482 after this PR is merged.
2020-10-11 21:09:08 -05:00
Jeff Epler
5e38bb98cb rgbmatrix: update protomatter to 1.0.5 tag
this is compile-tested on
 stm32f405 feather
 matrixportal
 nrf52840 feather

but not actually tested-tested.
2020-10-10 14:30:37 -05:00
Limor "Ladyada" Fried
9535edb8f4
Merge pull request #3507 from jepler/issue3506-matrixportal-crash
displayio: Fix matrixportal crash
2020-10-02 22:16:32 -04:00
Jeff Epler
b1592564b2 displayio: Fix matrixportal crash
An RGBMatrix has no bus and no bus_free method.  It is always possible
to refresh the display.

This was not a problem before, but the fix I suggested (#3449) added
a call to core_bus_free when a FramebufferDisplay was being refreshed.
This was not caught during testing.

This is a band-aid fix and it brings to light a second problem in which
a SharpDisplay + FrameBuffer will not have a 'bus' object, and yet does
operate using a shared SPI bus.  This kind of display will need a
"bus-free" like function to be added, or it can have problems like
#3309.
2020-10-02 15:07:36 -05:00
Scott Shawcroft
b9890f2d42
Merge pull request #3497 from jepler/issue3473
sharpdisplay: Fix memory corruption across soft-reset
2020-10-01 11:00:25 -07:00
Scott Shawcroft
f303fb3d41
Merge pull request #3495 from tannewt/esp32s2_metro
Add Metro ESP32S2
2020-10-01 10:54:48 -07:00
Scott Shawcroft
be6e6eabd2
Merge pull request #3449 from FoamyGuy/sdcard_odb_fix
Sdcard odb fix
2020-10-01 10:13:13 -07:00
Jeff Epler
d7c3f811af sharpdisplay: Fix memory corruption across soft-reset
It was incorrect to NULL out the pointer to our heap allocated buffer in
`reset`, because subsequent to framebuffer_reset, but while
the heap was still active, we could call `get_bufinfo` again,
leading to a fresh allocation on the heap that is about to be destroyed.

Typical stack trace:
```
#1  0x0006c368 in sharpdisplay_framebuffer_get_bufinfo
#2  0x0006ad6e in _refresh_display
#3  0x0006b168 in framebufferio_framebufferdisplay_background
#4  0x00069d22 in displayio_background
#5  0x00045496 in supervisor_background_tasks
#6  0x000446e8 in background_callback_run_all
#7  0x00045546 in supervisor_run_background_tasks_if_tick
#8  0x0005b042 in common_hal_neopixel_write
#9  0x00044c4c in clear_temp_status
#10 0x000497de in spi_flash_flush_keep_cache
#11 0x00049a66 in supervisor_external_flash_flush
#12 0x00044b22 in supervisor_flash_flush
#13 0x0004490e in filesystem_flush
#14 0x00043e18 in cleanup_after_vm
#15 0x0004414c in run_repl
#16 0x000441ce in main
```
When this happened -- which was inconsistent -- the display would keep
some heap allocation across reset which is exactly what we need to avoid.

NULLing the pointer in reconstruct follows what RGBMatrix does, and that
code is a bit more battle-tested anyway.

If I had a motivation for structuring the SharpMemory code differently,
I can no longer recall it.

Testing performed: Ran my complicated calculator program over multiple
iterations without observing signs of heap corruption.

Closes: #3473
2020-10-01 09:22:09 -05:00
FoamyGuy
422a7d4013 remove remaining top level displayio background check 2020-09-30 17:25:58 -05:00
Scott Shawcroft
a739d314f1
Add Metro ESP32S2
Also fix two bugs:
* Crash when resetting board.SPI when it hasn't been inited.
* Reading back the output value is always false. Fixes #3353
2020-09-30 12:57:39 -07:00
Scott Shawcroft
5ac3c36d64
Merge pull request #3450 from mdroberts1243/New_quirk_for_SH1107
New quirk for sh1107
2020-09-30 12:03:10 -07:00
FoamyGuy
d1bda47d94 removing top level displayio background check 2020-09-30 14:03:03 -05:00
Mark Roberts
ef245ef54e
Removed redundant subrectangle sizing code 2020-09-30 11:06:13 -07:00
Mark Roberts
9f19a8a760
Ran pre-commit locally 2020-09-30 11:06:13 -07:00
mdroberts1243
b1e1237887
Merge branch 'main' into New_quirk_for_SH1107 2020-09-28 19:40:47 -04:00
Mark Roberts
db74f97e60 modified _stage/__init__.c call to set region to update 2020-09-28 19:10:47 -04:00
Jeff Epler
f4e36fc7f6 CAN: Use mp_obj_t insteaed of canio_message_obj_t, get rid of rtr field 2020-09-28 17:22:00 -05:00
Jeff Epler
a4cc3ad6cb canio: RemoteTransmissionRequest: Split implementation, keep one structure
This already begins obscuring things, because now there are two sets of
shared-module functions for manipulating the same structure, e.g.,
common_hal_canio_remote_transmission_request_get_id and
common_hal_canio_message_get_id
2020-09-28 17:22:00 -05:00
Jeff Epler
8d45be1cd9 canio: Split RemoteTransmissionRequest to its own class
It reuses most of canio.Message's implementation, and structure
2020-09-28 17:22:00 -05:00
Jeff Epler
79ca430ddf Match: address -> id 2020-09-28 17:22:00 -05:00
Scott Shawcroft
ffeaef5d82
Merge pull request #3453 from DavePutz/issue3367
Issue #3367 Changed delay calls to avoid conflicts with qspi_disable
2020-09-28 14:18:51 -07:00
Mark Roberts
b921543571 Requested changes take 1 2020-09-25 21:27:29 -04:00
Scott Shawcroft
b9d68bc5a6
Change I2C default to 100khz
Greater that 100khz is technically out of the original spec.

Background here: https://github.com/adafruit/Adafruit_CircuitPython_CLUE/issues/36
2020-09-25 11:07:22 -07:00
Mark Roberts
19dbff67f2 Fixed page set mask to be four bits! 2020-09-25 00:26:39 -04:00
Mark Roberts
06a3d15266 Mostly-working-version with comments 2020-09-24 22:07:33 -04:00
Mark Roberts
5a176c2c67 Removed redundant send of page setting 2020-09-22 13:41:25 -04:00
root
dbf8a9ad69 Changed delay calls to avoid conflicts with qspi_disable 2020-09-22 10:25:31 -05:00
Mark Roberts
5536e574db Changes to compile cleanly 2020-09-21 22:08:16 -04:00
Mark Roberts
08189edf24 Quirk coded up for ...set_region_to_update 2020-09-21 21:07:42 -04:00
FoamyGuy
ff1a90a9c3 Merge branch 'adafruit_main' into sdcard_odb_fix 2020-09-21 17:58:05 -05:00
Mark Roberts
f21dc253e0 Initial commit bool column_and_page_addressing 2020-09-21 18:42:16 -04:00
Jeff Epler
4869dbdc67 canio: rename from _canio
This reflects our belief that the API is stable enough to avoid incompatible changes during 6.x.
2020-09-21 16:44:26 -05:00
Jeff Epler
c39ec1581e _canio: Message: setting data clears rtr, and vice versa 2020-09-21 16:44:26 -05:00
Jeff Epler
44c5b2bbb1 Respond to review comments
Thanks @tannewt!
2020-09-21 16:44:26 -05:00
Jeff Epler
2cb4707f92 Message: add extended address flag 2020-09-21 16:44:26 -05:00
Jeff Epler
65ca1c7bbc _canio: Message: Setting data should set the size to match 2020-09-21 16:44:26 -05:00
Jeff Epler
a2e1867f69 _canio: Minimal implementation for SAM E5x MCUs
Tested & working:

 * Send standard packets
 * Receive standard packets (1 FIFO, no filter)

Interoperation between SAM E54 Xplained running this tree and
MicroPython running on STM32F405 Feather with an external
transceiver was also tested.

Many other aspects of a full implementation are not yet present,
such as error detection and recovery.
2020-09-21 16:44:26 -05:00
Lucian Copeland
e504438fd2 Remove unlicensed file, fix reset pin type check 2020-09-14 11:58:13 -04:00
Lucian Copeland
ecc219fe50 Merge remote-tracking branch 'upstream/main' into esp32-displayio-fix 2020-09-14 10:44:31 -04:00
FoamyGuy
e114b5ab54 fixes showing OnDiskBitmap with adafruit_sdcard 2020-09-11 21:37:00 -05:00
Scott Shawcroft
7611e71a1b
Merge pull request #3374 from kmatch98/shape_update
Add dirty rectangle tracking to Shape display element
2020-09-11 12:47:54 -07:00
Scott Shawcroft
01daf5b8ce
Merge pull request #3378 from DavePutz/issue3266
Fix for #3266: ensure SPI lock is free after a soft reboot
2020-09-11 12:41:06 -07:00
root
870326b221 Moved SPI unlock code 2020-09-11 10:54:46 -05:00
Kevin Matocha
37e85aebd2 Fix off-by-one error, simplify the logic, add comments 2020-09-10 21:34:03 -05:00
Scott Shawcroft
9256e6b376
Merge pull request #3302 from xiongyihui/main
support to get HID OUT report
2020-09-10 17:35:04 -07:00
Lucian Copeland
f95ad7b27c Fix reset pin null reference, construct error null reference 2020-09-10 15:37:43 -04:00
root
59165cabbe Removed unneeded pointer 2020-09-09 10:36:55 -05:00
root
61e1c906bf Merge branch 'issue3266' of https://github.com/DavePutz/circuitpython into issue3266 2020-09-09 09:34:55 -05:00
root
24a18c63f9 Moved SPI unlock to reset_board_busses() 2020-09-09 09:32:25 -05:00
Kevin Matocha
d600759bc8 Utilize MIN and MAX functions from py/misc.h 2020-09-08 20:02:34 -05:00
DavePutz
918a4733b4
Merge pull request #25 from DavePutz/main
update from main
2020-09-07 10:14:36 -05:00