Commit Graph

249 Commits

Author SHA1 Message Date
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
Scott Shawcroft 4e8de3c554
Swap sphinx to autoapi and the inline stubs 2020-05-12 17:28:24 -07:00
dherrada 2ebe3035df
Did board, digitalio, displayio 2020-05-07 10:54:09 -04:00
Jeff Epler 507e17fbf1 displayio: Fix "bus type" problem introduced at 8cba145c90
When allocate_display_bus_or_raise was factored out, the assignment
of the bus's Python type was lost.  Restore it.

This would have affected displays of any type other than RGBMatrix, when
they were created dynamically.  Boards with displays configured in flash
were unaffected.

Closes: #2792
2020-04-21 13:48:34 -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 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
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
Scott Shawcroft a870908718
Don't break the function signature 2020-03-26 14:11:20 -07: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
Dan Halbert fdcdc1320b Make ParallelBus reset ping arg required 2020-03-06 14:30:30 -05:00
Dan Halbert 817b5be320 rename routines to be clearer; fix wiznet arg types 2020-03-05 16:35:31 -05:00
Dan Halbert 8435935429 update uses of assert_pin_free; remove redundant checks 2020-02-29 15:37:32 -05:00
Dan Halbert b6206406de new pin validation routines; don't use mp_const_none if NULL will do 2020-02-28 23:43:04 -05:00
Melissa LeBlanc-Williams 33774e790c Updated OnDiskBitmap RTD example for 5.x 2020-02-14 10:23:23 -08:00
Dan Halbert a4ebd2f7c1 allow tuple or list for Palette color 2020-02-03 22:09:53 -05:00
Scott Shawcroft 5d24ade5c9
Tweak error messages to reduce code size. 2020-01-29 17:32:07 -08:00
David Glaude 01d49eb0a7
Update Shape.c
Make no sense to say this is experimental and will change in 4.0.0 when we are already above 4.0.0.
This should be removed, or updated to say it will not be in x.0.0
2019-12-30 16:54:16 +01:00
Jeff Epler a63da7a6c0 displayio: make 'rotation' property settable 2019-12-16 15:23:41 -06: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 6ad860a963
Merge pull request #2101 from matthewnewberg/display_io_dither
Add random dithering to ColorConverter
2019-09-09 10:11:07 -07:00
Scott Shawcroft d9e0641606
Set dither default to False and document it 2019-09-08 21:30:52 -07:00
Matthew Newberg 8e55232492 Use kwargs for dither in ColorConverter constructor 2019-09-06 16:23:24 -04:00
Matthew Newberg b2fb5ac1c1 Fix comment on color converter 2019-09-06 16:11:15 -04:00
Matthew Newberg 4604a69498 Move dither parameter to ColorConverter constructor and parameter 2019-09-05 21:55:45 -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
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 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
Scott Shawcroft 8fa8737465
Initial ePaper work 2019-08-22 14:08:32 -07:00
Dave Astels 99a3da3b60 Get rid of the last bits of array dependancy 2019-08-21 15:24:39 -04:00
Dave Astels d547d59cba Merge remote-tracking branch 'adafruit/master' into displayio_fill_area 2019-08-21 15:02:51 -04:00
Dave Astels 8bbab01316 Remove unneeded lines 2019-08-21 13:57:52 -04:00
Dave Astels 56aad056da getting the buffer info should happen first (due to its check) 2019-08-20 17:00:24 -04:00
Dave Astels eb0a8cc0bf Move the get_buffer call earlier 2019-08-20 13:48:12 -04:00
Dave Astels 0fd886fa7f Remove array cast 2019-08-20 13:45:58 -04:00
Dave Astels f3d476aad8 Remove temporarily comments code 2019-08-20 12:25:56 -04:00
Dave Astels 53bb95a023 Rework to simplify 2019-08-20 10:05:41 -04:00
Dave Astels 10bc0d29d1 Switch to positional parameters 2019-08-20 10:05:09 -04:00
Dave Astels 2b7897cded Fix typo 2019-08-20 10:03:36 -04:00
Dave Astels 7a235f3746 Simplify to only extracting one line
Since this was the usecase, doing so simplifies the function significantly.
2019-08-16 21:10:09 -04:00
Jeff Epler 32a6d36405 shared-bindings: Use RUN_BACKGROUND_TASKS 2019-08-11 08:53:02 -05:00
Dave Astels 239ad19765 Pass in preallocated result buffer 2019-08-07 15:27:43 -04:00
Dave Astels 263f6f439b Remove obsolete experimental property 2019-08-07 15:27:04 -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
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
Dave Astels 741cd9c40a Get fill_area working 2019-07-31 12:47:32 -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
Dave Astels b6178c9d85 WIP on exposing fill_area 2019-07-25 15:05:30 -04: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 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
Scott Shawcroft 745ff8f8c1
Fix Group subscr to detect delete correctly
Fixes #1957
2019-07-02 18:15:23 -07:00
Craig Forbes db74b92e77 Fix displayio.Display docstring type for display_bus.
Add docs for group parameter for Display.show.
2019-06-18 16:59:05 -05:00
Scott Shawcroft 4013bcde9e
Add baudrate to FourWire and shorten delay. 2019-06-17 17:48:05 -07:00
Scott Shawcroft 6f6dcafd90
Minor tweaks based on Dan's feedback 2019-06-13 00:34:19 -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
sommersoft 9e4396bdcd
Merge pull request #1920 from tannewt/fix_rst
Improve rST consistency for rst2pyi use
2019-06-07 23:41:00 -05:00
Scott Shawcroft cfe24b8532
Improve rST consistency for rst2pyi use 2019-05-30 19:02: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 5608e273a0
Add index and remove to Group. 2019-05-15 11:33:16 -07:00
Scott Shawcroft b7b55e0c0a
Make Group iterable via a generic native iterator.
Fixes #1694
2019-05-14 15:15:23 -07:00
Dan Halbert d3ce9280e2
Merge pull request #1883 from tannewt/fix_1881
Check native object in case of early access
2019-05-14 15:30:44 -04:00
Matt Land 0b1c1c1d92
Update Palette.c
Remove None, add in byte and bytearray examples
2019-05-14 08:03:34 -05:00
Scott Shawcroft f29de51325
Check native object in case of early access
If a native displayio object is accessed before it's super().__init__()
has been called, then a placeholder is given that will cause a crash if
accessed. This is tricky to get right so we detect this case and raise
a NotInplementedError instead of crashing.

Fixes #1881
2019-05-13 17:31:30 -07:00
Matt Land ad211b23be
add documentation of transparency 2019-05-10 17:35:51 -05:00
Matt Land 214dfed703
Add documentation for Palette shared binding
Add documentation for the palette subscript operator and how to use it.
2019-05-10 16:41:13 -05:00
Dan Halbert 0113e0970e add Display.__init__() args for brightness and auto_brightness 2019-04-18 15:59:16 -04:00
Dan Halbert 4fc0f8b25c Turn off auto_brightness if brightness is set 2019-04-18 13:57:27 -04:00
Scott Shawcroft 5028f87b09
Tweak pybadge and fix display bugs
* Update pybadge pins and flash for rev D
* TileGrid now validates the type of the pixel_shader.
* Display actually handles incoming subclass objects.
* MicroPython will inspect native parents to see if special
  accessors are used.
2019-04-09 18:32:52 -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 4b3cb7b6db Expose displayio.Display.bus
With the bus exposed, we can send custom commands to the display, to
leverage advanced features specific to the display, which are not
exposed by default.
2019-04-06 14:25:08 +02:00
Scott Shawcroft 04a4e8a38d
Always check TileGrid's x, y
When using an int index you could end up writing past the end of
TileGrid's memory.

Fixes #1747
2019-04-05 13:10:47 -07:00
Melissa LeBlanc-Williams 8f1fc6c07d Added option to easily treat SPI parameter data as commands 2019-04-04 23:15:00 -07:00
Melissa LeBlanc-Williams 2e0268cb09 Simplified cs toggling into fourwire only 2019-03-27 20:17:22 -07:00
Melissa LeBlanc-Williams f3ec0514cd Simplified into fourwire only 2019-03-27 20:11:32 -07:00
Melissa LeBlanc-Williams 2f7b338a4b Comment Cleanup 2019-03-26 18:56:25 -07:00
Melissa LeBlanc-Williams f4cede4747 Removed parameter so CS is always toggled 2019-03-26 18:46:13 -07:00
Melissa LeBlanc-Williams b2ad16f5c8 Removed parameter so CS is always toggled 2019-03-26 18:34:07 -07:00
Melissa LeBlanc-Williams 5f0e71ccb4 Merge branch 'master' of https://github.com/adafruit/circuitpython into ssd1351-fix 2019-03-26 18:23:02 -07:00
Melissa LeBlanc-Williams 0df40534f3 Merge branch 'master' of https://github.com/adafruit/circuitpython 2019-03-26 18:22:30 -07:00
Radomir Dopieralski 81fe8060d7 Properly calculate BPP for displayio.Bitmap
Fix #1669
2019-03-25 19:40:40 +01:00
Melissa LeBlanc-Williams c3329e224d Added Single Byte Boundaries option for certain displays 2019-03-24 23:59:28 -07:00
Melissa LeBlanc-Williams d9de1b9926 Updated RTD comment to reflect new param defaulting True 2019-03-24 08:23:46 -07:00
Melissa LeBlanc-Williams 0c33f7fdb4 Enable CS toggle for displayio by default 2019-03-23 20:23:23 -07:00
Melissa LeBlanc-Williams 2bb63cbeb3 Added new parameter description in displayio RTD comment 2019-03-23 18:53:04 -07:00
Melissa LeBlanc-Williams fadb5a1024 Added option to toggle cs in displayio init sequence 2019-03-23 18:34:42 -07:00
Scott Shawcroft 4b0afc855d
Fix up sphinx 2019-03-19 18:37:41 -07: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 afbf59019e
Update displayio docs to add detail to display bus comments
Fixes #1599
2019-03-12 17:18:33 -07:00
Scott Shawcroft 224e9b1009
Standardize TileGrid to x and y properties over position
This brings it inline with Group. Also fixes #1613

This also includes a number of fixes for where a method is called
through a subclass. We now correctly get the native object.
Fixes #1567

Lastly, this adds subscript support to TileGrid for changing tile
indices. Similar to Bitmap, it accepts ints or 2-tuples.
2019-03-12 17:18:33 -07:00
Scott Shawcroft ea45877ca5
Accept x and y kwargs into Group for initial position. 2019-03-12 17:17:32 -07:00
Dan Halbert 1f31877d55 Rework background display task to allow reads from SPI SD card during display. Clarify code. Handle multiple displays better. 2019-03-07 00:08:16 -05:00
Dan Halbert c854f6617a check display-bus transaction status and act accordingly 2019-03-06 13:45:48 -05:00
Dan Halbert 2eaa98ad71
Merge pull request #1601 from penguindustin/master
added height and width attributes for displayio
2019-03-06 12:43:55 -05:00
Dustin Mendoza 4145f87fcd changed from mp_int_t to uint16_t 2019-03-05 21:25:09 -08:00
Dustin Mendoza 9737a45b33 changed width and height to be properties 2019-03-02 14:50:10 -08:00
Bryan Siepert 945550f4bd Fixed the OnDiskBitmap example to reflect code changes 2019-03-02 09:12:40 -08:00
Dustin Mendoza f127be4dd2 added height and width attributes for displayio 2019-02-25 16:39:20 -08:00
Dan Halbert 379258112a
Merge pull request #1548 from tannewt/shape_arg_check
Arg check width and height into Shape.
2019-02-14 07:42:39 -05:00
Scott Shawcroft b13adfc228
Arg check width and height into Shape.
Fixes #1537
2019-02-13 17:34:39 -08:00
Scott Shawcroft 473bdf48f6
A safe mode fix and displayio fixes
* Fixes safe mode on the SAMD51. The "preserved" value was being
clobbered by the bootloader.
* Fixes auto-reload loop when in safe mode.
* Fixes reading Group children with [].
* Check that a TileGrid actually moves before queueing a refresh.
2019-02-13 15:31:06 -08:00
TG-Techie e674f11df2
Update Shape.c 2019-02-12 19:16:27 -05:00
Scott Shawcroft 1e16b3e134
Tweaks based on dhalbert's feedback. 2019-02-12 14:18:53 -08:00
Scott Shawcroft 5258bc4318
Fixup doc reference 2019-02-11 20:55:06 -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
Scott Shawcroft 845783a457
Clarify rotation parameter 2019-02-01 09:33:33 -08:00
Scott Shawcroft 448ae64d8e
Add support for display rotation and raw commands
Display rotation is relative to the scan order of the display.
The scan order can be found by scrolling the display with command
0x37 `display_bus.send(0x37, struct.pack(">H", i % 128))`

Fixes #1504
2019-02-01 00:32:03 -08:00
Scott Shawcroft d72cd5b2d6
Correct TileGrid class name. 2019-01-31 11:42:15 -08:00
Scott Shawcroft 354a26963b
Correctly handle no backlight pin. 2019-01-31 11:42:15 -08:00
Scott Shawcroft 2c069a5685
Polish up comments 2019-01-31 11:42:15 -08:00
Scott Shawcroft 73bc614a4b
Remove doc reference to Sprite 2019-01-31 11:42:15 -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 6145f08cc8
Support adjustable backlight brightness 2019-01-31 11:42:14 -08:00
Scott Shawcroft 69bc5e189b
Rudamentary backlight support 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 fb0970ec6e
Add terminalio 2019-01-31 11:42:13 -08:00
Scott Shawcroft 73cf490635
Add TileGrid 2019-01-31 11:42:13 -08:00
Bryan Siepert ab2ad7ba45 adding height and width to OnDiskBitmap for #1460 2019-01-20 22:33:22 -08:00
Scott Shawcroft b41d386d02
simplify arg checking for display 2019-01-18 17:04:18 -08:00
Scott Shawcroft edc8383e22
Improvements thanks to danh's review 2019-01-18 16:37:06 -08:00
Scott Shawcroft dc024cf411
Add a bit more to the docs 2019-01-18 12:59:23 -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 2d136d58bf
Fix other builds and hallowing 2019-01-17 14:45:29 -08:00
Scott Shawcroft 84292ad890
External fourwire works and blinka splash after 2019-01-17 00:20:16 -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 619bc4caae
Support subclasses of Shape as bitmaps. 2019-01-14 17:29:18 -08:00
Scott Shawcroft a14762a16c
Add support for rendering a shape.
Fixes #1171
2019-01-14 17:29:15 -08:00
Scott Shawcroft f21cf15c38
Add OnDiskBitmap which loads pixel data straight from disk.
Also, renamed Sprite's palette to pixel_shader so it can be
anything that produces colors based on values (including color values).
Added a ColorConverter that converts RGB888 (found in bitmaps) to
RGB565 for the display.

Fixes #1182
2018-09-12 15:25:59 -07:00
Scott Shawcroft 86288f14f1
Merge translations and update title underline 2018-09-06 14:56:26 -07:00
Scott Shawcroft 1683eb913d
Minor tweaks based on feedback 2018-09-06 14:49:49 -07:00
Scott Shawcroft 121903b6ee
Tweaks based on feedback 2018-08-31 14:21:48 -07:00
Scott Shawcroft 6697544cdf
Introduce displayio to render graphics to displays.
It's designed to minimize RAM footprint by using Sprites to
represent objects on the screen. The object model also facilitates
partial screen updating which reduces the bandwidth needed to display.

This is all handled in C. Python simply manipulates the objects with
the ability to synchronize to frame timing.
2018-08-31 12:31:52 -07:00