Commit Graph

36 Commits

Author SHA1 Message Date
Jeff Epler
907c5d387f
Tweak black_bindings
Originally, black_bindings found each contiguous "//|" block and sent
it to black independently. This was slower than it needed to be.

Instead, swap the comment prefix: when running black, take off
"//|" prefixes and put "##|" prefixes on all un-prefixed lines.
Then, after black is run, do the opposite operation

This more than doubles the overall speed of "pre-commit run --all",
from 3m20s to 55s CPU time on my local machine (32.5s to under 10s
"elapsed" time)

It also causes a small amount of churn in the bindings, because
black now sees enough context to know whether one 'def' follows another
or ends the 'def's in a 'class'. In the latter case, it adds an extra
newline, which becomes a "//|" line.

I'm less sure why a trailing comma was omitted before down in
rp2pio/StateMachine.c but let's roll with it.
2022-09-30 11:18:13 -05:00
Jeff Epler
b2cc8d2aad
run black_bindings across all bindings 2022-09-27 15:21:42 -05:00
Alec Delaney
cb3932ce29 Make other documentation links prettier 2022-05-13 11:51:30 -04:00
Alec Delaney
042eb84d84 Add Learn guide link to displayio 2022-05-04 14:01:03 -04:00
Jeff Epler
c34b6f757f Implement gifio.GifWriter
This involves:
 * Adding a new "L8" colorspace for colorconverters
 * factoring out displayio_colorconverter_convert_pixel
 * Making a minimal "colorspace only" version of displayio for the
   unix port (testing purposes)
 * fixing an error message

I only tested writing B&W animated images, with the following script:
```python
import displayio
import gifio

with gifio.GifWriter("foo.gif", 64, 64, displayio.Colorspace.L8) as g:
    for i in range(0, 256, 14):
        data = bytes([i, 255-i] * 32 + [255-i, i] * 32) * 32
        print("add_frame")
        g.add_frame(data)

# expected to raise an error, buffer is not big enough
with gifio.GifWriter("/dev/null", 64, 64, displayio.Colorspace.L8) as g:
    g.add_frame(bytes([3,3,3]))
```
2021-10-26 08:54:18 -05:00
Scott Shawcroft
838d30b3a4
Fix incorrect macros 2021-08-30 14:40:14 -07:00
Jeff Epler
83120eb1b2 Actually fix building ports without parallel displays 2021-08-29 11:49:47 -05:00
Jeff Epler
f4bb3cc2c8 Fix stubs & doc redirects 2021-08-29 11:43:51 -05:00
Jeff Epler
7520feed1c Move ParallelBus to its own module 2021-08-29 07:33:54 -05:00
Rob Capellini
17af5cd492 Use MP_REGISTER_MODULE with displayio, terminalio, and fontio
Convert from using MICROPY_PORT_BUILTIN_MODULES_STRONG_LINKS to using MP_REGISTER_MODULE for displayio, terminalio, and fontio modules.

Related to #5183.
2021-08-24 20:07:10 -04:00
Jeff Epler
d83a21b984 ColorConverter: Add "BGR" color modes.
The BGR565_SWAPPED mode is needed for OV2640 cameras.
2021-06-30 10:29:31 -05:00
Jeff Epler
8565a9ab90 shared-bindings: Fix type of Colorspace values in docs 2021-04-23 12:39:37 -05:00
Jeff Epler
05a81a066e displayio: Improve docs about Colorspaces 2021-04-23 09:57:24 -05:00
Jeff Epler
76d68f21ac displayio: Add RGB555/565/_SWAPPED format support
This is helpful when displaying frames from an OV7670 camera, which
uses the RGB565_SWAPPED format internally.
2021-04-19 10:23:47 -05:00
microDev
a52eb88031
run code formatting script 2021-03-15 19:27:36 +05:30
dherrada
bce77adecd Added type hints previously missed 2020-07-03 16:03:19 -04: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
Scott Shawcroft
24b30965c4
Refresh ePaper displays once code.py is done running 2019-08-22 14:23:32 -07:00
Scott Shawcroft
70680d5b22
EPaper displays work mostly. 2019-08-22 14:08:33 -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
cfe24b8532
Improve rST consistency for rst2pyi use 2019-05-30 19:02:47 -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
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
73bc614a4b
Remove doc reference to Sprite 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
73cf490635
Add TileGrid 2019-01-31 11:42:13 -08:00
Scott Shawcroft
dc024cf411
Add a bit more to the docs 2019-01-18 12:59:23 -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
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
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