Commit Graph

226 Commits

Author SHA1 Message Date
Jeff Epler
c243c13f02 framebufferio: Handle auto refresh flag at reset
if we don't set the flag via accessor fn the tick enable might become wrong
2020-07-20 08:52:35 -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
fcddfd0f39
Merge pull request #3083 from tannewt/esp32s2_busio
Add busio support for the ESP32-S2
2020-07-01 21:02:08 -05:00
Scott Shawcroft
ed6e81d688
Switch SPI to polling DMA and enable displayio 2020-06-24 13:10:08 -07:00
DavePutz
058c16e98c
Issue #3014 - refresh after changing to transparent
Adding     self->needs_refresh = true; in common_hal_displayio_palette_make_opaque() and common_hal_displayio_palette_make_transparent()
2020-06-10 17:11:28 -05:00
Diego Elio Pettenò
dd5d7c86d2 Fix up end of file and trailing whitespace.
This can be enforced by pre-commit, but correct it separately to make it easier to review.
2020-06-03 10:56:35 +01:00
warriorofwire
58c8e00745 vectorio: clean up after group removal
VectorShape tells the Group to redraw whatever it left behind when it is removed now.
2020-05-10 15:36:23 -07:00
warriorofwire
6660311a96 vectorio: respect display transpose and mirror.
VectorShape now just uses the Group's and Display's absolute transforms.
2020-05-10 14:18:13 -07:00
warriorofwire
4086600b61 vectorio: switch per-shape transform to Display
Rather than maintain a transform per-shape, we'll just use whatever
  settings are on the Display.  Currently only transpose is done.
2020-05-09 22:15:51 -07:00
warriorofwire
206d0e598a Add vectorio: for drawing shapes
vectorio builds on m4 express feather

Concrete shapes are composed into a VectorShape which is put into a displayio Group for display.

VectorShape provides transpose and x/y positioning for shape implementations.

Included Shapes:

* Circle
  - A radius; Circle is positioned at its axis in the VectorShape.
  - You can freely modify the radius to grow and shrink the circle in-place.

* Polygon
  - An ordered list of points.
  - Beteween each successive point an edge is inferred.  A final edge closing the shape is inferred between the last
    point and the first point.
  - You can modify the points in a Polygon.  The points' coordinate system is relative to (0, 0) so if you'd like a
      top-center justified 10x20 rectangle you can do points [(-5, 0), (5, 0), (5, 20), (0, 20)] and your VectorShape
      x and y properties will position the rectangle relative to its top center point

* Rectangle
  A width and a height.
2020-05-09 15:38:22 -07:00
hierophect
c311b5c002
Merge pull request #2842 from hierophect/stm32-h7-displayio
STM32: Add displayio to F7/H7
2020-05-05 12:37:08 -04:00
Lucian Copeland
61b0994631 Fix flag typo 2020-05-01 14:46:06 -04:00
Lucian Copeland
4f71bd295d Make PulseIO optional within DisplayIO 2020-04-30 14:47:50 -04:00
Scott Shawcroft
bebf27e733
Merge remote-tracking branch 'adafruit/master' into lower_power
This isn't perfect and needs a bit more testing.
2020-04-20 18:25:13 -07:00
Jeff Epler
5fcc6d6286 RGBMatrix: finish renaming from Protomatter
This gets all the purely internal references.  Some uses of
protomatter/Protomatter/PROTOMATTER remain, as they are references
to symbols in the Protomatter C library itself.
2020-04-17 18:44:07 -05:00
Jeff Epler
3d6258f63d Rename Protomatter -> RGBMatrix
This is a quick rename, it changes the user-facing names but not the
internal names of things.
2020-04-17 18:43:57 -05:00
Jeff Epler
a32337718d Rename _protomatter -> protomatter
I originally believed that there would be a wrapper library around it,
like with _pixelbuf; but this proves not to be the case, as there's
too little for the library to do.
2020-04-17 18:43:57 -05:00
Scott Shawcroft
b580b34cbf
Merge remote-tracking branch 'adafruit/master' into lower_power 2020-04-14 17:14:44 -07:00
Jeff Epler
d8362ef654 displayio: swap colors in palettes too
.. change the in-rom palette to be in RGB565 order
2020-04-14 18:25:00 -05:00
Jeff Epler
5dae23c0e7 protomatter: release the protomatter object during release_displays() 2020-04-14 18:24:58 -05:00
Jeff Epler
1f3821220e fix build for non-displayio & non-protomatter targets 2020-04-14 18:24:58 -05:00
Jeff Epler
3a94412cd3 protomatter: more memory allocation fixes
- bump supervisor alloc count by 4 (we actually use 5)
 - move reconstruct to after gc heap is reset
 - destroy protomatter object entirely if not used by a FramebufferDisplay
 - ensure previous supervisor allocations are released
 - zero out pointers so GC can collect them
2020-04-14 18:24:58 -05:00
Jeff Epler
09dc46a984 Add Protomatter and FramebufferDisplay 2020-04-14 18:24:54 -05:00
Jeff Epler
8cba145c90 displayio: implement, use allocate_new_display_bus_or_raise 2020-04-14 18:24:54 -05:00
Jeff Epler
6378d600c4 displayio: implement, use allocate_display_or_raise 2020-04-14 18:24:54 -05:00
caternuson
a9fb34eb93 make packed word and copy it in 2020-04-13 16:48:27 -07:00
caternuson
dc75746842 add docstring, clean up 2020-04-09 08:59:26 -07:00
caternuson
49fff2d9b4 initial working fill 2020-04-09 08:43:50 -07:00
Scott Shawcroft
4ee6754ccd
Save backlight_on_high correctly.
Fixes #2750
2020-04-08 10:32:54 -07:00
Scott Shawcroft
8fe512c7e9
Merge remote-tracking branch 'adafruit/master' into lower_power 2020-03-31 15:13:58 -07:00
Jeff Epler
54e8c63b4f
Merge pull request #2730 from tannewt/fix_fourwire_phase_polarity
Add polarity and phase to FourWire.
2020-03-28 07:28:37 -05:00
siddacious
9e0c00dfd4 adding a backlight polarity flag to Display 2020-03-25 22:51:20 -07:00
Scott Shawcroft
6b7acc65b6
Add polarity and phase to FourWire.
It was fixed as 0/0 even though it used to get it from the current
SPI state. This makes it more explicit with kwargs.

Thanks to magpie_lark and kmatocha on the Adafruit Support forum
for finding the issue: https://forums.adafruit.com/viewtopic.php?f=60&t=162515
2020-03-25 11:22:46 -07:00
Scott Shawcroft
6f60afe8c5
First try at lowering the power consumption 2020-03-13 11:12:30 -07:00
Lucian Copeland
3c86005546 Implement requested changes 2020-01-28 17:11:25 -05:00
Lucian Copeland
70932cab42 Simplify the flash-display conflict fix 2020-01-24 14:33:28 -05:00
Lucian Copeland
2afca4e942 Fix flash-display conflict error 2020-01-24 14:25:36 -05:00
Jeff Epler
a63da7a6c0 displayio: make 'rotation' property settable 2019-12-16 15:23:41 -06:00
Hierophect
ab74f45bfb Define polarity and phase in Fourwire 2019-12-05 11:44:21 -05:00
Jeff Epler
95d9c49e43 Merge remote-tracking branch 'origin/master' into tick-refactor 2019-11-29 11:27:09 -06:00
Scott Shawcroft
d32dc814d3
Fix ePaper so it works after a GC.
We weren't correctly collecting the start and stop sequences. As
a result, the GC would free the space and allocate other info
there.

Thanks to JacobT on Discord for the bug report!
2019-11-26 12:48:36 -08: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
de5691acf5 Add never_reset and reset to pin common hal, adjust files 2019-11-15 12:47:00 -05:00
Melissa LeBlanc-Williams
39b38256fd Fixed I2CDisplay reset issue 2019-11-08 12:35:35 -08:00
Scott Shawcroft
6ad860a963
Merge pull request #2101 from matthewnewberg/display_io_dither
Add random dithering to ColorConverter
2019-09-09 10:11:07 -07:00
Matthew Newberg
4604a69498 Move dither parameter to ColorConverter constructor and parameter 2019-09-05 21:55:45 -04:00
Matthew Newberg
3ab6a23434 Removed unused return value in displayio_colorconverter_convert 2019-09-04 20:42:24 -04:00
Scott Shawcroft
70407e4d87
Bitpack bools in TileGrid and Group 2019-09-04 10:27:21 -07: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
Scott Shawcroft
b53f169824
Fix I2CDisplay bus_free to not grab lock
Fixes #2098
2019-09-03 14:46:47 -07:00
Dave Astels
b318896b85 Capture rotation 2019-09-03 12:35:41 -04:00
Matthew Newberg
d87bfaf480 Add random dithering to ColorConverter 2019-08-31 22:07:09 -04:00
Scott Shawcroft
bea77c651a
Minor renames 2019-08-26 16:37:59 -07:00
Scott Shawcroft
7324b70a7c
Rework based on Dan's review 2019-08-23 15:27:21 -07:00
Scott Shawcroft
72e7ffa324
More cleanup 2019-08-22 16:16:09 -07:00
Scott Shawcroft
8d836fa248
Regular display fixes including refresh tweaks 2019-08-22 14:25:46 -07:00
Scott Shawcroft
f2a1972ba8
Add refresh_time to use if busy_pin is not given 2019-08-22 14:23:33 -07:00
Scott Shawcroft
3a98de1236
Add reset() to display busses to detect whether it works 2019-08-22 14:23:33 -07:00
Scott Shawcroft
24b30965c4
Refresh ePaper displays once code.py is done running 2019-08-22 14:23:32 -07:00
Scott Shawcroft
36a23e0fe3
Rework refresh API and factor common display stuff out
NOT TESTED! Just compiles

Fixes #1691
2019-08-22 14:23:27 -07:00
Scott Shawcroft
c247e7df9c
Begin refresh rework. 2019-08-22 14:08:33 -07:00
Scott Shawcroft
70680d5b22
EPaper displays work mostly. 2019-08-22 14:08:33 -07:00
Dave Astels
d547d59cba Merge remote-tracking branch 'adafruit/master' into displayio_fill_area 2019-08-21 15:02:51 -04:00
Dan Halbert
e3dc5e3a66 Merge remote-tracking branch 'adafruit/master' into run-background-tasks
Restore dependencies indicated by indentation in circuitpy_mpconfig.h.
2019-08-19 12:41:20 -04:00
Scott Shawcroft
b3de7efc07
Fix I2CDisplay lifecycle and splash lifecycle.
Fixes https://github.com/adafruit/Adafruit_CircuitPython_DisplayIO_SSD1306/issues/2
2019-08-14 15:53:58 -07:00
Jeff Epler
e3c0428838 shared-module: Use RUN_BACKGROUND_TASKS 2019-08-11 08:53:02 -05:00
Scott Shawcroft
26f64dd8ec
Merge remote-tracking branch 'adafruit/4.1.x' into merge_in_410 2019-08-05 17:53:08 -07:00
Dave Astels
cd092df9d8 Merge remote-tracking branch 'adafruit/master' into displayio_fill_area 2019-07-31 18:46:41 -04:00
Dave Astels
1f9cb44fa3 Expose rotation with a property 2019-07-31 15:00:21 -04:00
Scott Shawcroft
af8cfbedfb
Add knobs for SSD1322 and two fixes.
* Fix terminal clear after first successful code.py run.
* Fix transmitting too many bytes for column constraint with single
  byte bounds.
2019-07-25 15:41:12 -07:00
Scott Shawcroft
1d1b8703b6
Review feedback including NO_BRIGHTNESS_COMMAND macro 2019-07-19 16:11:13 -07:00
Scott Shawcroft
6797ec6ed3
Add support for grayscale displays that are < 8 bit depth.
This also improves Palette so it stores the original RGB888 colors.

Lastly, it adds I2CDisplay as a display bus to talk over I2C. Particularly
useful for the SSD1306.

Fixes #1828. Fixes #1956
2019-07-19 16:06:11 -07:00
Scott Shawcroft
d9089f52ce
Fix it's -> its 2019-07-19 10:42:20 -07:00
Scott Shawcroft
4a6bdb6fe4
Track a dirty area for in-memory bitmaps
This fixes the bug that bitmap changes do not cause screen updates
and optimizes the refresh when the bitmap is simply shown on the
screen. If the bitmap is used in tiles, then changing it will
cause all TileGrids using it to do a full refresh.

Fixes #1981
2019-07-18 16:47:28 -07:00
Dan Halbert
6a001786a9 merge from master 2019-07-09 08:58:49 -04:00
Scott Shawcroft
13c3d06c6a
Merge pull request #1952 from tannewt/fixup_tilegrid_dirty
Fix TileGrid's dirty tracking when changing top left
2019-06-18 10:29:12 -07:00
Dan Halbert
1356819de1 Handle None for BLE name; fix ScanEntry bug; compile issue 2019-06-17 23:16:40 -04:00
Scott Shawcroft
4013bcde9e
Add baudrate to FourWire and shorten delay. 2019-06-17 17:48:05 -07:00
Scott Shawcroft
7490adf8e9
Use width for x. Thanks @deshipu 2019-06-17 16:23:38 -07:00
Scott Shawcroft
da3d75f7b1
Fix TileGrid's dirty tracking when changing top left 2019-06-17 16:23:37 -07:00
Scott Shawcroft
6f6dcafd90
Minor tweaks based on Dan's feedback 2019-06-13 00:34:19 -07:00
Scott Shawcroft
a35d9b469d
Refactor deinit check to reduce code size. 2019-06-12 11:36:43 -07:00
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
Dan Halbert
4fc189b60c Merge latest 4.0.x fixes into master 2019-06-11 16:16:29 -04:00
Dan Halbert
62de2506e4 Include display objects in gc. 2019-06-06 17:49:32 -04:00
Scott Shawcroft
5d0791cafb
Fix off-by-one error
It caused the bottom and right edges to be one pixel short.
2019-05-31 15:50:55 -07: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
Scott Shawcroft
00c39805f1
Remove old comment 2019-05-15 14:17:09 -07:00
Scott Shawcroft
5608e273a0
Add index and remove to Group. 2019-05-15 11:33:16 -07:00
Scott Shawcroft
e64bbc41ec
Handle -scale to 0 correctly in Group
Fixes #1839
2019-05-09 11:38:30 -07:00
Scott Shawcroft
f548305c07
Merge pull request #1815 from dhalbert/stop-flicker
Turn off auto_brightness if brightness is set
2019-04-18 15:48:39 -07:00
Dan Halbert
0113e0970e add Display.__init__() args for brightness and auto_brightness 2019-04-18 15:59:16 -04:00
Scott Shawcroft
c372567330
Fix off by one error in OnDiskBitmap
It resulted in the first row of pixels being pulled for out of bounds.

Fixes #1801
2019-04-17 15:17:11 -07:00
Scott Shawcroft
72992070c5
Fix boards with no shared busses. 2019-04-09 11:36:10 -07:00
Scott Shawcroft
de48e4b262
Merge remote-tracking branch 'adafruit/master' into fix_cpx_display 2019-04-08 17:15:08 -07:00
Scott Shawcroft
0f003ac5b8
Reorganize board busses into shared-bindings and shared-module. 2019-04-08 16:58:50 -07:00
Radomir Dopieralski
8323721232 Stop hard-coding SPI frequency in FourWire
Instead remember and use the frequency, polarity and phase that was
set when the bus was first created.
2019-04-06 15:15:29 +02: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
Melissa LeBlanc-Williams
97baa7899f Added comment regarding parameter loop 2019-04-05 11:11:27 -07:00