Commit Graph

331 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
Jeff Epler ef35ca1d3e
vectorio: Simplify argument checking of x/y values 2022-09-22 08:39:33 -05:00
Jeff Epler 267ec1dc4f
unify some 'must/should be an int' messages 2022-09-22 08:39:32 -05:00
Dan Halbert 02cc6c2aee Merge remote-tracking branch 'adafruit/main' into remove-autobrightness 2022-08-10 08:35:53 -04:00
Dan Halbert 41bcd7b260 Remove support for auto-brightness 2022-08-09 22:40:21 -04:00
Jeff Epler 64b1d003df
Allow a Bitmap to be constructed from a buffer (in C anyway)
.. so that Camera.take() can return one without copying
2022-08-04 15:11:58 -05:00
foamyguy a45de19731 use validate_int_range(). remove string translation entry 2022-06-23 07:28:04 -05:00
foamyguy 8daa1be701 validate bounds of pixel index in make_opaque and is_transparent 2022-06-21 22:11:58 -05:00
foamyguy fcf46552f0 validate bounds of pixel index in make_transparent 2022-06-21 22:03:59 -05:00
Scott Shawcroft 6446010753
Wi-Fi autoconnect and title bar status
This adds support for CIRCUITPY_WIFI_SSID and CIRCUITPY_WIFI_PASSWORD
in `/.env`. When both are defined, CircuitPython will attempt to
connect to the network even when user code isn't running. If the
user code attempts to a network with the same SSID, it will return
immediately. Connecting to another SSID will disconnect from the
auto-connected network. If the user code initiates the connection,
then it will be shutdown after user code exits. (Should match <8
behavior.)

This PR also reworks the default displayio terminal. It now supports
a title bar TileGrid in addition to the (newly renamed) scroll area.
The default title bar is the top row of the display and is positioned
to the right of the Blinka logo when it is enabled. The scroll area
is now below the Blinka logo.

The Wi-Fi auto-connect code now uses the title bar to show its
state including the IP address when connected. It does this through
the "standard" OSC control sequence `ESC ] 0 ; <s> ESC \` where <s>
is the title bar string. This is commonly supported by terminals
so it should work over USB and UART as well.

Related to #6174
2022-06-09 14:55:54 -07:00
Scott Shawcroft b90563d504
Merge pull request #6442 from FoamyGuy/tilegrid_contains
tilegrid.contains() function
2022-06-06 11:02:43 -07:00
Dan Halbert 80ae14202a
Merge pull request #6416 from FoamyGuy/display_brightness_pwm
display brightness pwm 500hz frequency
2022-06-05 23:52:42 -04:00
foamyguy bc0fdaa026 fix tilegrid.contains() docstring 2022-06-03 17:01:24 -05:00
foamyguy ffc451b338 argument for backlight_pwm_frequency and use it in pyportal titano build 2022-05-28 12:01:05 -05:00
foamyguy db318726a2 tilegrid.contains() function 2022-05-27 18:05:44 -05:00
Scott Shawcroft 9d10a3da66
Conditionalize LTO 2022-05-27 12:59:54 -07:00
Dan Halbert a01dec1df9 message consolidation and more use of validators 2022-05-19 15:38:37 -04:00
Dan Halbert 936f5bf23e
Merge pull request #6338 from jepler/fix-display-invalid-sh1107
Fix display invalid sh1107
2022-05-13 20:33:43 -04:00
Dan Halbert ae8347f5e5 add error msg for SH1107 fix 2022-05-13 12:54:46 -04:00
Alec Delaney cb3932ce29 Make other documentation links prettier 2022-05-13 11:51:30 -04:00
Dan Halbert c1cc9b8bbf
Merge pull request #6353 from tekktrik/doc/add-communication-links
Add links to guides for "essential" modules, others
2022-05-06 22:45:40 -04:00
Alec Delaney 042eb84d84 Add Learn guide link to displayio 2022-05-04 14:01:03 -04:00
Jeff Epler b292a925d5
remove stray semicolon 2022-05-03 09:23:47 -05:00
Jeff Epler 78cf0a90af
Make MP_PROPERTY_GETTER / _GETSET fully declare the property
This will enable setting data attributes, namely, the section of the
symbol.
2022-05-03 08:48:53 -05:00
Jeff Epler 31da335cac
Introduce, use MP_PROPERTY_GETTER, _GETSET
Later, these can be changed in cunning ways to save flash storage.
2022-05-03 08:48:52 -05:00
foamyguy 6e3fe07943 remove redundant type check. remove blank line. revert locale change 2022-04-19 09:07:35 -05:00
foamyguy 459f896dd4 remove refactored function 2022-04-18 20:36:41 -05:00
foamyguy 9fdd804365 enforce new bitmap same size as previous 2022-04-18 20:31:47 -05:00
foamyguy 65f085709c back to not using function 2022-04-18 10:25:49 -05:00
foamyguy cea55cde9f enforce bitmap and tile_size in set_bitmap 2022-04-10 11:13:42 -05:00
foamyguy 16b81c855d adding bitmap property to TileGrid 2022-04-09 11:26:36 -05:00
Jeff Epler d24f3b812d
Document TileGrid limitation to tile values 0..255
Closes #6149
2022-04-05 09:07:35 -05:00
Radomir Dopieralski 102ee716a7 Add support for 9-bit mode to displayio.FourWire
If the ``command`` pin is None, that information will instead be
sent as a ninth bit in the SPI transactions.

Fix #6109
2022-03-04 22:59:17 +01:00
foamyguy dc01505cfc bitmap.blit type checking and raise error 2022-02-14 19:05:53 -06:00
Kevin Matocha 65837a9941 update doc string 2022-02-02 09:23:37 -06:00
Kevin Matocha 0290fc35d2 Removing some unnecessary files that were changed 2022-02-01 08:28:40 -06:00
Dan Kulinski fbd9e3284b Add two byte length check 2022-01-14 15:25:40 -07:00
Scott Shawcroft 674c845fb6
Merge pull request #5760 from jepler/rename_under_typing
circuitpython_stubs: Use `circuitpython_typing` for cp-specific typing
2021-12-22 14:05:04 -08:00
Jeff Epler 166793f843 circuitpython_stubs: Use `circuitpython_typing` for cp-specific typing
Installing stubs for a module named `_typing` seems like a dubious
decision.
2021-12-22 11:14:21 -06:00
foamyguy 8b71519317 code format 2021-12-20 10:48:08 -06:00
foamyguy 2ce9dc7680 Merge branch 'adafruit_main' into tilegrid_size_props 2021-12-20 07:31:08 -06:00
Randall Bohn fd655301b5
edit docstring for pixel_shader 2021-12-15 13:07:12 -07:00
foamyguy c4be8a5c94 tilegrid size properties 2021-12-13 09:44:08 -06:00
Scott Shawcroft 927a720de9
Fix I2C and feedback from Dan 2021-11-23 17:23:13 -08:00
Timon a1052d5f73
Initial broadcom port for Raspberry Pi
This targets the 64-bit CPU Raspberry Pis. The BCM2711 on the Pi 4
and the BCM2837 on the Pi 3 and Zero 2W. There are 64-bit fixes
outside of the ports directory for it.

There are a couple other cleanups that were incidental:
* Use const mcu_pin_obj_t instead of omitting the const. The structs
  themselves are const because they are in ROM.
* Use PTR <-> OBJ conversions in more places. They were found when
  mp_obj_t was set to an integer type rather than pointer.
* Optimize submodule checkout because the Pi submodules are heavy
  and unnecessary for the vast majority of builds.

Fixes #4314
2021-11-22 14:54:44 -08:00
Jeff Epler 06bb6ea5a2
use MP_OBJ_NULL in preference to 0 2021-11-12 13:21:53 -06:00
Jeff Epler c6dbc7df3a
Add displayio bitmaps to unix build 2021-11-12 10:47:17 -06:00
Jeff Epler b453d18579 ColorConverter: fix a docstring 2021-11-08 10:36:39 -06: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