Commit Graph

1221 Commits

Author SHA1 Message Date
Dan Halbert
51c547a5b9 add generic arg validation routines; add interval args to keypad 2021-06-21 12:13:39 -04:00
Dan Halbert
154e91ab85 add EventQueue.store_next() to allow reusing event objects 2021-06-21 08:18:06 -04:00
Dan Halbert
8cd7e774e7 add KeyMatrix columns_to_anodes arg 2021-06-18 12:03:47 -04:00
Dan Halbert
af66931f71 Added keypad.ShiftRegisterKeys 2021-06-17 20:51:45 -04:00
Dan Halbert
a152bd3b72 add .num_keys and .store_states() to Keys and KeyMatrix 2021-06-17 12:02:54 -04:00
Dan Halbert
cd31136c30 factor out keypad.EventQueue 2021-06-16 15:55:54 -04:00
Dan Halbert
3d18c5c327 Use a single list of keypad scanners 2021-06-16 13:29:38 -04:00
Dan Halbert
1803a6a71d both Keys and KeyMatrix work 2021-06-15 11:15:09 -04:00
Dan Halbert
350652ee21 Keys works; more testing to do 2021-06-14 22:59:17 -04:00
Dan Halbert
32eec85230 compiles 2021-06-14 20:54:43 -04:00
Dan Halbert
627c426259 wip 2021-06-14 16:00:15 -04:00
Dan Halbert
01a8a95b2c fix signed/unsigned compilation problem 2021-06-10 01:14:16 -04:00
Dan Halbert
d3d9e0a487 add debouncing 2021-06-10 00:07:23 -04:00
Tsutomu IKEGAMI
0a7c839c13 Fix format (expand tab) 2021-06-10 12:11:12 +09:00
Tsutomu IKEGAMI
72c4a5a523 Fix coordinate conversion algorithm of partial refresh area in displayio.TileGrid 2021-06-10 11:47:51 +09:00
Dan Halbert
7d23206018 Inital keypad work: Keys working: one pin per key
keypad.Buttons and keypad.State

Buttons -> Keys; further work

wip

wip

wip: compiles

about to try

keypad.Keys working
2021-06-08 20:27:31 -04:00
lady ada
467a4e7664 fix comment 2021-06-07 19:51:57 -04:00
lady ada
b39dd84560 move the col/row offsets to the top so oleds can take advantage of em 2021-06-07 19:43:49 -04:00
lady ada
2ff9e9766f handclang 2021-06-07 12:39:59 -04:00
lady ada
8f1c25c8ae fix SH110x mode, the SH1107 is actually column not row mode BUT the SD1107 module we use is vertical orientation (confusing!) so row/col are NOT swapped. we will have to fix the SH1107 driver to match. this fix required for SH1106 (which uses the same page mode commands but ISNT rotated) 2021-06-06 18:25:40 -04:00
Tsutomu IKEGAMI
a4be61912c Fix move cursor esc sequence of terminalio to meet ANSI standard 2021-06-03 20:40:37 +09:00
Dan Halbert
3930440bc5 Fix usb_cdc.enable(console=False, data=True) 2021-06-02 11:29:56 -04:00
Scott Shawcroft
6ee9acc900
Merge pull request #4755 from jepler/esp32s2-protomatter
Esp32s2 protomatter
2021-06-01 13:32:34 -07:00
Jeff Epler
9df8f235b1 OnDiskBitmap: INCOMPATIBLE CHANGE: Allow them to use palettes
Before, when an OnDiskBitmap was a paletted bitmap type, the palette
was internal to the OnDiskBitmap, and it internally performed the palette
conversion itself.  When using with a tilegrid, a ColorConverter() object
always had to be passed.

Now, an OnDiskBitmap has a "pixel_shader" property.  If the bitmap is
a paletted bitmap type, it is a (modifiable) Palette object.  Otherwise,
it is a ColorConverter() object as before. This allows palette effects
to be applied to paletted OnDiskBitmaps.

Code that used to say:
```python
face = displayio.TileGrid(odb, pixel_shader=displayio.ColorConverter())
```
must be updated to say:
```python
face = displayio.TileGrid(odb, pixel_shader=odb.pixel_shader)
```

Compatible code for 6.x and 7.x can say
```python
face = displayio.TileGrid(odb, pixel_shader=getattr(odb, 'pixel_shader', ColorConverter())
```
2021-05-28 10:53:21 -05:00
Jeff Epler
9ff6ccba48 remove commented-out code 2021-05-27 11:33:17 -05:00
Jeff Epler
11288c1c28 esp32s2: Add rgbmatrix support 2021-05-26 11:21:59 -05:00
Jeff Epler
0d7f257eae displayio: Pause rgbmatrix during soft-reset
We can't handle rgbmatrix's interrupts from here until the display is
reinitialized, so set the display as paused.

With this change, I can survive multiple cycles with wifi+rgbmatrix
on an esp32s2.  Before, it usually failed.
2021-05-26 11:18:02 -05:00
Dan Halbert
0f66832829
Merge branch 'main' into hid_devices-gc 2021-05-24 18:17:52 -04:00
Scott Shawcroft
0d92558012
Merge pull request #4800 from dhalbert/too-many-hid-devices
Handle too many HID devices properly
2021-05-24 14:26:41 -07:00
Dan Halbert
5a9b95e611 unlock board.I2C() on reset 2021-05-21 17:49:50 -04:00
Dan Halbert
c6eb0283dc Don't set num_hid_devices before it's validated 2021-05-21 17:34:30 -04:00
Dan Halbert
5a81f275cf Don't change number of HID devices until it's vetted 2021-05-21 17:29:21 -04:00
Dan Halbert
7d0cda2614 gc all pointers in hid_devices properly 2021-05-21 16:32:55 -04:00
Scott Shawcroft
5643355e90
Merge remote-tracking branch 'adafruit/main' into simplify_status_led 2021-05-20 08:35:15 -07:00
Dan Halbert
aebee2de73 Handle USB_HIGHSPEED for MIDI also 2021-05-19 07:43:47 -04:00
Kamil Tomaszewski
da248d1594 spresense: Fix USB CDC and MSC 2021-05-18 17:02:16 +02:00
Dan Halbert
fa6c06fb38 count in/out endpoints; allow more usb modules on low-endpoint boards 2021-05-13 21:59:02 -04:00
Scott Shawcroft
1a0b4193b7
Simplify the status LED to save power
This also removes the need to pin share because we don't use the
status LED while user code is running.

The status flashes fallback to the HW_STATUS LED if no RGB LED is
present. Each status has a unique blink pattern as well.

One caveat is the REPL state. In order to not pin share, we set the
RGB color once. PWM and single color will be shutoff immediately but
DotStars and NeoPixels will hold the color until the user overrides
it.

Fixes #4133
2021-05-13 14:41:20 -07:00
Scott Shawcroft
a70fc0caee
Merge pull request #4744 from tannewt/merge_1.14
Merge MicroPython 1.14
2021-05-11 16:11:58 -07:00
Scott Shawcroft
e02a26453c
Merge MicroPython 1.14 into CircuitPython 2021-05-11 15:07:40 -07:00
ajs256
3c8b8cdba7 make translate 2021-05-10 16:57:38 -07:00
ajs256
7cd8e98962 Make two error messages sentence case 2021-05-10 16:51:13 -07:00
Dan Halbert
f504af3127 fix HID; fix interface name table creation 2021-05-09 00:42:45 -04:00
Jeff Epler
5e06c91244
Merge pull request #4716 from tyomitch/main
s/Circuit Python/CircuitPython/g
2021-05-08 08:47:29 -05:00
Scott Shawcroft
42f4065c8a
Merge remote-tracking branch 'adafruit/main' into merge_1.13 2021-05-06 11:17:53 -07:00
Artyom Skrobov
908d83d1f2 s/Circuit Python/CircuitPython/g
Some comments and messages used the non-standard spelling
2021-05-06 16:22:35 +03:00
Scott Shawcroft
3fda0c0a1b
Fix board builds and use MP_ERROR_TEXT in py and extmod 2021-05-05 17:51:52 -07:00
Dan Halbert
adc3d7d55e update Python API according to review comments 2021-05-03 22:29:02 -04:00
Dan Halbert
d2b558993e merge from main, including MicroPython 1.12 merge 2021-05-03 20:56:04 -04:00
Dan Halbert
5b5de4b92e fix sHID report doc and API 2021-05-03 20:53:31 -04:00
Scott Shawcroft
b35fa44c8a
Merge MicroPython 1.12 into CircuitPython 2021-05-03 14:01:18 -07:00
Dan Halbert
be7b2b00a8 uncrustify with newer version of uncrustify 2021-04-30 10:40:12 -04:00
Dan Halbert
71a8cadb09 working! 2021-04-29 22:26:38 -04:00
Dan Halbert
abfb020d41 MSC, CDC, HID keyboard definitely working 2021-04-29 17:41:43 -04:00
Dan Halbert
f06d54524d merge from adafruit 2021-04-28 23:48:26 -04:00
Dan Halbert
587aedd14f rework storage allocation 2021-04-28 13:00:44 -04:00
Dan Halbert
8500e846c6 partially working 2021-04-27 23:53:23 -04:00
Dan Halbert
f98a54628b wip: compiles 2021-04-27 14:37:36 -04:00
Scott Shawcroft
17fcd499b2
Merge pull request #4649 from tannewt/merge_1.11_2
Merge MicroPython v1.11 into CircuitPython
2021-04-27 11:02:02 -07:00
Dan Halbert
7a40b4daec very much WIP 2021-04-26 23:54:01 -04:00
Scott Shawcroft
76033d5115
Merge MicroPython v1.11 into CircuitPython 2021-04-26 15:47:41 -07:00
Dan Halbert
c26e49c2e6 wip: starting to try to compile 2021-04-25 23:17:41 -04:00
Dan Halbert
9d1fcc3b14 merge from main 2021-04-25 10:27:52 -04:00
Dan Halbert
aea3c4d3ab wip 2021-04-25 10:23:59 -04:00
Dan Halbert
2ba2574ebf
Merge pull request #4619 from tyomitch/microbit
[build] Allow USB to be set to 0
2021-04-24 10:31:29 -04:00
Dan Halbert
556a126917 wip: getting closer 2021-04-23 21:44:13 -04:00
Scott Shawcroft
80e8b4ac14
Merge pull request #4635 from jepler/pcc
WIP: Implement 'ParallelImageCapture' for samd51
2021-04-23 13:31:53 -07:00
Artyom Skrobov
4e3c1d4a4c [build] Allow USB to be set to 0
Unify USB-related makefile var and C def as CIRCUITPY_USB.

Always define it as 0 or 1, same as all other settings.

USB_AVAILABLE was conditionally defined in supervisor.mk,
but never actually used to #ifdef USB-related code.

Loosely related to #4546
2021-04-23 11:13:34 -04:00
Dan Halbert
2b4c88d633 wip: partial HID, still needs rework 2021-04-23 00:18:05 -04:00
Dan Halbert
64e0958916 wip: descriptor building 2021-04-21 23:25:36 -04:00
Dan Halbert
6b18a51d57 wip: working on descriptor templates 2021-04-20 22:20:34 -04:00
Dan Halbert
51ccf8dc30 wip: revert usb_descriptor changes; use raw descriptors instead 2021-04-19 23:24:18 -04: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
Scott Shawcroft
5ccd5dc08b
Fix struct.pack with padding bytes
It used to validate the following arg could fit in a single byte.
Now, it always uses zero to pad.
2021-04-16 12:39:23 -07:00
Dan Halbert
6cb751ab06 wip: revamp API names 2021-04-14 22:10:09 -04:00
Scott Shawcroft
3978b50b8d
Merge pull request #4489 from gamblor21/audiomixer_rp2040
Add non M4 audiomixer support
2021-04-14 12:19:17 -07:00
Dan Halbert
4a7e129287 wip: latent usb device enabling/disabling 2021-04-13 23:33:44 -04:00
gamblor21
cd8deb0b72 Removed all the M4 comments 2021-04-13 17:36:14 -05:00
Artyom Skrobov
c6ee471b52 Merge branch 'main' of https://github.com/adafruit/circuitpython into patch-3 2021-04-13 00:32:19 -04:00
Mark
7ace53f22c
Remove comment for define being M4 only it can be M7 too
Co-authored-by: Scott Shawcroft <scott@tannewt.org>
2021-04-12 22:35:55 -05:00
Jeff Epler
280aefffb7 IncrementalEncoder: Re-add missing update of quarter_count
This lost line caused incremental encoders to stay stuck at 0 forever.

I seem to have lost it while trying to create tidy commits :frown:
2021-04-09 08:47:40 -05:00
Jeff Epler
3ce0b512f8 rasberrypi: IncrementalEncoder: factor out state machine 2021-04-08 16:25:47 -05:00
Jeff Epler
78089107bc displayio.Bitmap: Allow modification though the buffer protocol
It is required to call .dirty() with appropriate arguments after modifications through the buffer protocol, or the display might not be updated correctly.
2021-04-03 10:41:20 -05:00
gamblor21
9bf4b4d81e Fixes to math for level calculations 2021-04-02 16:47:25 -05:00
hathach
7c3975ecf2 update tinyusb to fix midi buffer overflow issue 2021-04-02 17:57:56 +07:00
Tsutomu IKEGAMI
171820e53f Fix format 2021-04-01 20:45:15 +09:00
Tsutomu IKEGAMI
5f77d07760 Fix format 2021-04-01 20:26:10 +09:00
Tsutomu IKEGAMI
3c4d763fef Fix format. 2021-04-01 18:04:33 +09:00
Tsutomu IKEGAMI
7810cb275c Add two escape sequences to terminalio.Termial:
- ESC[yy;xxH : move cursor to (xx, yy)
- ESC[2J     : clear screen
2021-04-01 17:33:57 +09:00
Dan Halbert
a13da2ad57
Merge pull request #4486 from kmatch98/displayio_area_expand
`displayio` and `vectorio`: move to displayio_area_union and away from _expand
2021-03-26 23:00:05 -04:00
Artyom Skrobov
8056af8648 [synthio] add a simple MidiTrack implementation 2021-03-26 16:38:10 -04:00
Jeff Epler
172715194f adafruit_bus_device: SPIDevice: Fix so it works with bitbangio.SPI
.. by calling methods, same as we did for I2C
2021-03-26 14:51:53 -05:00
Jeff Epler
a70b679ed5 bitbangio.SPI.read: Support write_value, fix some other nits 2021-03-26 12:24:09 -05:00
gamblor21
0b212e2243 Add non M4 audiomixer support 2021-03-25 17:30:40 -05:00
Kevin Matocha
56362a9806 remove duplicated code, replace with displayio_area_canon 2021-03-25 11:31:07 -05:00
Kevin Matocha
9485805b6a move to displayio_area_union and away from _expand 2021-03-25 11:21:39 -05:00
Kevin Matocha
3785eb7779 correct rectangle size dimensions 2021-03-25 09:36:40 -05:00
Scott Shawcroft
98425c9a9d
Merge pull request #4464 from kmatch98/transform_fix
update logic for displayio.TileGrid's transform_xy
2021-03-22 15:52:23 -07:00
Scott Shawcroft
d52662856b
Merge pull request #4462 from jepler/disable-usb-cdc
storage: Correct when we check for USB mounts
2021-03-22 15:52:10 -07:00
Kevin Matocha
24831a79d3 update logic for transform_xy 2021-03-22 16:38:56 -05:00
Jeff Epler
5a0e9945e6 storage: Correct when we check for USB mounts
Closes #4417
2021-03-22 11:45:54 -05:00
Jeff Epler
a05aab8304
Merge pull request #4454 from jepler/bitmaptools-readinto-4bit
Fix reading 4-bit data
2021-03-21 19:56:23 -05:00
Jeff Epler
c64fccbeee hex may be more obvious 2021-03-21 13:48:08 -05:00
Jeff Epler
7229fe631d Fix reading 4-bit data 2021-03-21 13:37:38 -05:00
Jeff Epler
e084a92671
Merge pull request #4432 from jepler/bitmap-dirty-improvements
Bitmap dirty improvements
2021-03-20 13:09:59 -05:00
Kevin Matocha
9b188934d1 off by one error in rotozoom dirty_area 2021-03-19 21:23:55 -05:00
Jeff Epler
39500cdeab Merge commit '40829d4cc85394513ca631cff23254344e29786c' of https://github.com/kmatch98/circuitpython into bitmap-dirty-improvements 2021-03-19 20:40:30 -05:00
Jeff Epler
95ac6c716b rotozoom: switch to using set_dirty_area + write_pixel 2021-03-19 20:40:23 -05:00
Kevin Matocha
40829d4cc8 switch to > in displayio_area_canon 2021-03-19 20:30:37 -05:00
Dan Halbert
1512ca520b Fix PWMOut non-error handling and never reset 2021-03-19 09:57:21 -04:00
Jeff Epler
d0125617fd
Merge pull request #4428 from kmatch98/bitmap-read-2
Add `reverse_rows` to speedy bitmaptools.readinto function
2021-03-18 18:41:35 -05:00
Jeff Epler
623ece2c73
Merge pull request #4429 from jepler/displayio-bitmap-memoryview
displayio.Bitmap: Make memoryview()able
2021-03-18 18:38:25 -05:00
Jeff Epler
f5fd42c393 displayio: Move bitmap read-only checking to displayio_bitmap_set_dirty_area
This is a modest code savings, but more importantly it reduces
boilerplate in bitmap-modifying routines.

Callers need only ensure they call displayio_bitmap_set_dirty_area in
advance of the bitmap modifications they perform.

(note that this assumes that no bitmap operation can enter background
tasks. If an operation COULD enter background tasks, it MUST re-dirty
the area it touches when it exits, simply by a fresh call to
set_dirty_area with the same area as before)
2021-03-18 09:20:56 -05:00
Jeff Epler
36d608aa67 displayio_bitmap_set_dirty_area: rewrite in terms of displayio_area
.. simplifying code in the process.  For instance, now fill_region
uses area routines to order and constrain its coordinates.

Happily, this change also frees a modest amount of code space.
2021-03-18 09:20:56 -05:00
Jeff Epler
3b506f0fa5 displayio: area: add displayio_area_canon
This routine will be used to simplify code that deals with ranges
of bitmap coordinates.
2021-03-18 09:06:00 -05:00
Jeff Epler
f40c0c13ad displayio: area: add displayo_area_copy_coords, displayio_area_empty
.. and simplify the implmentation of displayio_area_union

This _slightly_ changes the behavior of displayio_area_union:

Formerly, if one of the areas was empty, its coordinates were still
used in the min/max calculations.

Now, if one of the areas is empty, the result gets the other area's coords

In particular, taking the union of the empty area with coords (0,0,0,0)
with the non-empty area (x1,y1,x2,y2) would give the area (0,0,x2,y2)
before, and (x1,y1,x2,y2) after the change.
2021-03-18 09:05:07 -05:00
Jeff Epler
47ca792765 arrayblit: mark bitmap area as dirty 2021-03-17 20:25:22 -05:00
Scott Shawcroft
670375dc0d
Merge pull request #4426 from kmatch98/main
Add getter for displayio.Palette item transparency/opacity.
2021-03-17 18:13:39 -07:00
Jeff Epler
c157ada90c displayio.Bitmap: Make memoryview()able 2021-03-17 16:26:45 -05:00
Kevin Matocha
c37a1f45f3 ran pre-commit for formatting fixes 2021-03-17 11:00:32 -05:00
Kevin Matocha
580121d46e minor formatting 2021-03-17 09:38:53 -05:00
Kevin Matocha
ef91e1752c merge upstream/main 2021-03-17 09:30:51 -05:00
Kevin Matocha
5c3cce6f5d add is_transparent getter to displayio.Palette 2021-03-16 20:43:23 -05:00
Jeff Epler
58679dc038 Merge remote-tracking branch 'origin/main' into bitmap-read-2 2021-03-16 12:21:50 -05:00
Jeff Epler
97b6664201 re-format with uncrustify 2021-03-16 12:20:09 -05:00
Kevin Matocha
227ac67463 Add reverse_rows option to bitmaptools.readinto 2021-03-16 10:01:12 -05:00
Jeff Epler
542fb58673 add arrayblit 2021-03-15 20:36:44 -05:00
microDev
a52eb88031
run code formatting script 2021-03-15 19:27:36 +05:30
Jeff Epler
094265cb86 bitmaptools.readinto: Fix diagnostics on atmel-samd builds 2021-03-14 15:36:20 -05:00
Jeff Epler
9133b23a37 bitmaptools: Add readinto
When reading uncompressed bitmap data directly, readinto can work
much more quickly than a Python-coded loop.

On a Raspberry Pi Pico, I benchmarked a modified version of
adafruit_bitmap_font's pcf reader which uses readinto instead of
the existing code. My test font was a 72-point file created from Arial.

This decreased the time to load all the ASCII glyphs from 4.9 seconds to
just 0.44 seconds.

While this attempts to support many pixel configurations (1/2/4/8/16/24/32
bpp; swapped words and pixels) only the single combination used by
PCF fonts was tested.
2021-03-14 13:57:46 -05:00
Scott Shawcroft
b413535ee1
Merge pull request #4376 from kmatch98/displayio_bitmap
add fill_region and draw_line to bitmap_tools
2021-03-12 16:50:39 -08:00
Dan Halbert
fa34b8a404 correct clock stretch timeout for board.I2C() 2021-03-11 21:02:07 -05:00
Kevin Matocha
a9afa0d9d4 Move input checks to shared-module, update docstrings 2021-03-11 16:18:17 -06:00
Kevin Matocha
85f0f07d51 add fill_region and draw_line to bitmaptools 2021-03-10 11:37:27 -06:00
Kevin Matocha
0c012da080 refactor displayio set_pixel for use in bitmap_tools 2021-03-07 11:22:30 -06:00
Artyom Skrobov
915a5eddeb [audiocore] buffer_read was never used 2021-03-05 10:25:09 -05:00
Dan Halbert
d1184e7e94 Be cognizant of null transform for .transpose_xy 2021-03-04 14:40:50 -05:00
Dan Halbert
29575ee439 use self->members in displayio_group_set() 2021-03-03 17:36:48 -05:00
Dan Halbert
cd48c5ee83
Merge pull request #4315 from dhalbert/rp2040-i2c-short-writes
RP2040: Implement short I2C writes (2 bytes or less) using bitbangio
2021-03-03 12:42:47 -05:00
Jeff Epler
efc2667b5f
Merge pull request #4186 from jepler/update-protomatter-rp2
Enable protomatter on RP2040 builds
2021-03-02 19:01:37 -06:00
Dan Halbert
f31b472309 Merge remote-tracking branch 'adafruit/main' into rp2040-i2c-short-writes 2021-03-02 15:17:12 -05:00
Dan Halbert
9939c59caa wip 2021-03-02 15:16:55 -05:00
Scott Shawcroft
e4f0e47d9f
Merge pull request #4233 from pewpew-game/displayio-group-list
displayio: make Group use a python list internally
2021-03-02 09:59:58 -08:00
Scott Shawcroft
d0eab5c561
Merge pull request #4256 from kmatch98/bt_cleanup
Add `bitmaptools` module
2021-03-01 18:24:12 -08:00
Jeff Epler
238484ec26 Merge remote-tracking branch 'origin/main' into update-protomatter-rp2 2021-03-01 15:18:32 -06:00
Radomir Dopieralski
24473b7983 Separate out mp_obj_list_insert for use in display.Group
Note that for some reason this makes the binary 500 bytes larger!
2021-02-27 21:13:55 +01:00
Radomir Dopieralski
38fb7b511b Remove max_size from displayio.Group
Still accept it as an argument. Add deprecation note.
2021-02-27 20:52:38 +01:00
Radomir Dopieralski
9c41753e44 Remove unused typedef for group children 2021-02-27 20:52:38 +01:00
Radomir Dopieralski
e505c59ed8 Separate mp_obj_list_pop so it can be used outside of objlist.c 2021-02-27 20:52:38 +01:00
Radomir Dopieralski
121c6bcc9b Replace displaio.Group.children with a python list
This is a first go at it, done by naive replacing of all array
operations with corresponding operations on the list. Note that
there is a lot of unnecessary type conversions, here. Also, list_pop
has been copied, because it's decalerd STATIC in py/objlist.h
2021-02-27 20:52:38 +01:00
Radomir Dopieralski
6e0ce23f3e displaio: don't store group children native object
Since we want to expose the list of group's children to the user,
we should only have the original objects in it, without any other
additional data, and compute the native object as needed.
2021-02-27 20:52:38 +01:00
Kevin Matocha
3afc269b18 fix two off by one errors 2021-02-26 17:22:11 -06:00
Jeff Epler
1d1ff5f308 Merge remote-tracking branch 'origin/main' into update-protomatter-rp2 2021-02-26 09:56:35 -06:00
Kevin Matocha
4097c949a3 Update for clean blitting into itself 2021-02-25 14:16:40 -06:00
Scott Shawcroft
d4bf0d5e2d
Merge pull request #4258 from jepler/pixelbuf-brightness-performance
_pixelbuf: Increase performance of brightness-scaling
2021-02-25 10:51:32 -08:00
Jeff Epler
dac4ac5d2a _pixelbuf: Respond to review comments
* Comment on the reason for scaling by 256
 * Divide by 256 instead of shifting
 * fix a cast; eliminate an unneeded roundf() to get a few bytes code back
2021-02-24 16:27:09 -06:00
Kamil Tomaszewski
ef3a61432b Add the missing argument to the HID functions 2021-02-24 19:09:17 +01:00
Jeff Epler
b7f5c277ad _pixelbuf: Increase performance of brightness-scaling
On the Pico, this increases the "fill rate" of
    pixels[:] = newvalues
considerably.  On a strip of 240 RGB LEDs, auto_write=False, the timings
are:

|| Brightness || Before || After || Improvement ||
|| 1.0        || 117 kpix/s || 307 kpix/s || 2.62x ||
|| 0.07       || 117 kpix/s || 273 kpix/s || 2.33x ||

It's worth noting that even the "before" rate is fast compared to the
time to transmit a single neopixel, but any time we can gain back
in the whole pipeline will let marginal animations work a little better.
To set all the pixels in this way and then show() gives a pleasant bump
to the framerate, from about 108Hz to 124Hz (1.15x)

The main source of speed-up is using integer math instead of floating
point math for the calculation of the post-scaled pixel values.  A slight
secondary gain is achieved by avoiding the scaling altogether when
the scale factor is 1.0.

Because the math is not exactly the same, some scaled pixel values may
change by +- 1 RGBW "step".  In practice, this is unlikely to matter.

The gains are bigger on the Pico and other M0 microcontrollers than M4
microcontrollers with floating point math in the hardware.

Happily, flash size is also improved a bit on the Pico build I did,
going from
> 542552 bytes used, 506024 bytes free in flash firmware space out of 1048576 bytes (1024.0kB).

to
> 542376 bytes used, 506200 bytes free in flash firmware space out of 1048576 bytes (1024.0kB).
2021-02-24 09:51:27 -06:00
Kevin Matocha
b720028642 Add bitmaptools module 2021-02-23 23:23:14 -06:00
Dan Halbert
93bf269c0d Avoid pulling in extra float-uint64 routines 2021-02-21 12:05:03 -05:00
Dan Halbert
67406488d1 merge from upstream; re-alphabetize 2021-02-19 14:22:50 -05:00
Dan Halbert
9d4442e298 handle reads/writes larger than buffers; add .write_timeout 2021-02-19 14:15:31 -05:00
Jeff Epler
5c758523c0 requested changes 2021-02-18 17:19:34 -06:00
Jeff Epler
7fd4567893 bitops: rename from _bit_transpose, describe the algorithm 2021-02-18 15:41:23 -06:00
Jeff Epler
c284728621 bit_transpose: Support from 2 to 7 strands, not just 8 2021-02-18 11:33:13 -06:00
Jeff Epler
9cf7d73c6c core: add bit_transpose function
.. this version can only handle exactly 8 bits "across".  The restriction
may be relaxed in a future revision.
2021-02-18 11:32:47 -06:00
Dan Halbert
ed49c02feb add timeout; finish up for PR 2021-02-17 23:24:11 -05:00
Dan Halbert
c26de0136a works! no timeouts 2021-02-16 17:39:36 -05:00
Dan Halbert
0b8f1b9a90 wip: usb_cdc.serials 2021-02-15 20:06:18 -05:00
Dan Halbert
93d788543c Merge remote-tracking branch 'adafruit/main' into secondary-cdc 2021-02-15 20:03:53 -05:00
Dan Halbert
d54b5861a3 wip 2021-02-12 19:01:14 -05:00
Jeff Epler
ff1942cff6 Enable protomatter on RP2040 builds
Also found a race condition between timer_disable and redraw, which
would happen if I debugger-paused inside common_hal_rgbmatrix_timer_disable
or put a delay or print inside it.  That's what pausing inside reconstruct
fixes.

So that the "right timer" can be chosen, `timer_allocate` now gets the `self`
pointer.  It's guaranteed at this point that the pin information is accurate,
so you can e.g., find a PWM unit related to the pins themselves.
This required touching each port to add the parameter even though it's
unused everywhere but raspberrypi.
2021-02-12 08:25:15 -06:00
Dan Halbert
d7305182f0 Remove adafruit_bus_device.SPIDevice.spi 2021-02-11 10:33:57 -05:00
Scott Shawcroft
a861498404
Merge pull request #4114 from tannewt/spidevice_spi
Add .spi accessor to SPIDevice
2021-02-02 09:53:10 -08:00
Scott Shawcroft
8fd6bff727
Add .spi accessor to SPIDevice
Fixes #4108
2021-02-01 20:03:23 -08:00
gamblor21
0cf2df48c4 Fixed for boards without longint 2021-02-01 17:58:34 -06:00
Jeff Epler
20c9f25a65 rgbmatrix: Eliminate some duplicated height-calculating code
This was hard to write, so let's have it written in 2 places instead
of 4.
2021-01-26 14:35:26 -06:00
Jeff Epler
368977fb90 RGBMatrix: Additional tile tweaks
* Introduce explicit serpentine: bool argument instead of using negative
   numbers (thanks, ghost of @tannewt sitting on one shoulder)
 * Fix several calculations of height

Testing performed (matrixportal):
 * set up a serpentine 64x64 virtual display with 2 64x32 tiles
 * tried all 4 rotations
 * looked at output of REPL
2021-01-26 14:33:48 -06:00
Jeff Epler
51f0544405 protmatter: Update to version that supports tiling 2021-01-26 09:19:44 -06:00
Scott Shawcroft
4241fd4b18
Merge pull request #4051 from jamesbowman/main
EVE: change fixed-point integer arguments to floating point
2021-01-25 14:44:48 -08:00
Scott Shawcroft
a2ac2da7cc
Merge pull request #3936 from gamblor21/busdevice_fixes
Changing adafruit_bus_device to duck typing
2021-01-25 14:41:53 -08:00
James Bowman
dff3423c23 Change from fixed-point integer arguments to floating point in EVE API functions
Changed calls: PointSize(), LineWidth(), VertexTranslateX() and VertexTranslateY()
Units for all the above are now pixels, not fixed-point integers. This matches OpenGL.
Docstrings updated accordingly
2021-01-22 15:52:46 -08:00
Scott Shawcroft
2b4ad1ed03
Fix warnings that come from -O3 (I think) 2021-01-20 19:16:56 -08:00
Scott Shawcroft
733094aead
Add initial RP2040 support
The RP2040 is new microcontroller from Raspberry Pi that features
two Cortex M0s and eight PIO state machines that are good for
crunching lots of data. It has 264k RAM and a built in UF2
bootloader too.

Datasheet: https://pico.raspberrypi.org/files/rp2040_datasheet.pdf
2021-01-20 19:16:56 -08:00
Bernhard Boser
41459d15d9 handle exttype & chunk long reads 2021-01-18 10:13:16 -08:00
gamblor21
d3995eaf97 Fixes from draft PR 2021-01-16 14:21:57 -06:00
gamblor21
ea0e2f80b7 Changing to duck-typing 2021-01-16 14:21:57 -06:00
Jeff Epler
1ca29ec47c Merge remote-tracking branch 'origin/main' into audioout-esp32 2021-01-12 09:23:07 -06:00
iot49
1a82555803
Merge branch 'main' into msgpack 2021-01-05 11:19:11 -08:00
Bernhard Boser
79e3c3d2fd Merge branch 'msgpack' of github.com:iot49/iotpython into msgpack 2021-01-05 11:02:00 -08:00
Jeff Epler
a7542598a0 esp32s2: add I2SOut 2020-12-29 14:46:38 -06:00
microDev
dc332baa87
update common_hal_reset_pin() 2020-12-28 20:04:00 +05:30
Scott Shawcroft
df8cba1068
Merge pull request #3834 from jepler/pr3723
displayio: Fix several bugs (transparency and palettes of OnDiskBitmaps)
2020-12-21 17:46:30 -08:00
Bernhard Boser
c875d7c22d speedup pack_bin, ext, str; catch short reads 2020-12-19 19:06:43 -08:00
Jeff Epler
6c4df5a8b4 adafruit_bus_device: Don't transmit STOP condition in write_then_readinto
Closes #3795
2020-12-18 11:13:54 -06:00
Jeff Epler
f224ed1848 OnDiskBitmap: Correct handling of "0 color palette" images
Microsoft documentation says:

> If biCompression equals BI_RGB and the bitmap uses 8 bpp or less, the bitmap has a color table immediatelly following the BITMAPINFOHEADER structure. The color table consists of an array of RGBQUAD values. The size of the array is given by the biClrUsed member. If biClrUsed is zero, the array contains the maximum number of colors for the given bitdepth; that is, 2^biBitCount colors.

Formerly, we treated 0 colors as "no image palette" during construction,
but then during common_hal_displayio_ondiskbitmap_get_pixel indexed into
the palette anyway.  This could have unpredictable results.  On a pygamer,
it gave an image that was blue and black.  On magtag, it gave a crash.
2020-12-17 10:54:37 -06:00
Jeff Epler
28bd29eb42 displayio: ColorConverter: fix logic errors about transparent pixels
The transparent_color field was never initialized.  I _think_ this means
its value was always set to 0, or the blackest of blacks.  Instead,
initialize it to the sentinel value, newly given the name
NO_TRANSPARENT_COLOR.

This exposed a second problem: The test for whether there was an existing
transparent color was wrong (backwards).  I am guessing that this was not
found due to the first bug; since the converter had a transparent color,
the correct test would have led to always getting the error "Only one
color can be transparent at a time".

Closes #3723
2020-12-16 13:48:27 -06:00
Scott Shawcroft
344d3c59cb
Merge branch 'main' into msgpack 2020-12-11 11:10:30 -08:00
Bernhard Boser
b5b6b6d0f2 add ExtType, update doc, add a test 2020-12-07 15:40:02 -08:00
Scott Shawcroft
1130b80e2a
Merge pull request #3612 from gamblor21/bus_device
Moving Adafruit_CircuitPython_BusDevice to core
2020-12-02 13:23:02 -08:00
Scott Shawcroft
608c98501b
Merge remote-tracking branch 'adafruit/main' into msgpack 2020-12-02 13:10:39 -08:00
Scott Shawcroft
d7ba641ff6
Merge pull request #3767 from dhalbert/sleep
Initial alarm and sleep PR: time alarms with light and deep sleep; PinAlarms not yet implemented
2020-12-02 12:51:43 -08:00
Bernhard Boser
582a47d71a
rename read, write to read_bytes, write_bytes 2020-12-01 18:41:11 -08:00
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
root
8d27533cd4 Make sure SPI lock is free initially 2020-09-06 18:03:25 -05:00
Kevin Matocha
297b7195b0 Delete unnecessary comment 2020-09-04 22:03:57 -05:00
Kevin Matocha
95db456a7e Add final newline 2020-09-04 14:23:53 -05:00
Kevin Matocha
9edad9ea85 Delete trailing blank lines from Shape.c 2020-09-04 14:21:49 -05:00
Kevin Matocha
f7714649ee Add dirty rectangle tracking to Shape display element 2020-09-04 14:15:15 -05:00
Scott Shawcroft
96cf60fbbd
Merge remote-tracking branch 'adafruit/main' into native_wifi 2020-09-03 16:34:56 -07:00
Scott Shawcroft
0b94638aeb
Changes based on Dan's feedback 2020-09-03 16:32:12 -07:00
Scott Shawcroft
5d17d6402d
Merge pull request #3366 from kmatch98/refresh_now
Update refresh to force immediate redraw with `display.refresh()`
2020-09-02 16:37:46 -07:00
Scott Shawcroft
786f4ed114
Merge pull request #3344 from jepler/issue-3184
Fix RGBMatrix, FrameBufferDisplay bugs
2020-09-02 15:32:30 -07:00
Jeff Epler
17a5a85528 rgbmatrix: Move struct definition to shared-module, rename 'core' member 2020-09-02 13:34:16 -05:00
Jeff Epler
3c083330f8 RGBMatrix: Remove unused, dead allocation
@tannewt noticed this in a pull request review.  The allocated
memory was never used, but the GC would have collected it eventually.
2020-09-01 11:00:22 -05:00
Jeff Epler
71c63c2812 FramebufferDisplay: Don't set rotation via core_construct
The expectations of displayio.Display and frambufferio.FramebufferDisplay
are different when it comes to rotation.

In displayio.Display, if you call core_construct with a WxH = 64x32
and rotation=90, you get something that is 32 pixels wide and 64 pixels
tall in the LCD's coordinate system.

This is fine, as the existing definitions were written to work like this.
With framebuffer displays, however, the underlying framebuffer (such as
RGBMatrix) says "I am WxH pixels wide in my coordinate system" and the
constructor is given a rotation; when the rotation indicates a transpose
that means "exchange rows and columns, so that to the Groups displayed
on it, there is an effectively HxW pixel region for use".

Happily, we already have a set_rotation method.  Thus (modulo the time
spent debugging things anyway:) the fix is simple: Always request no
rotation from core_construct, then immediately fix up the rotation
to match what was requested.

Testing performed: 32x16 RGBMatrix on Metro M4 Express (but using
the Airlift firmware, as this is the configuration the error was reported
on):
 * initially construct display at 0, 90, 180, 270 degrees
 * later change angle to 0, 90, 180, 270 degrees
 * no garbled display
 * no safe mode crashes
2020-09-01 11:00:22 -05:00
Jeff Epler
ce603dfebf rgbmatrix: Disable timer while reconstructing the display 2020-09-01 11:00:22 -05:00
Jeff Epler
dfa90cc11d allocator.h: add a missing license notice 2020-09-01 11:00:19 -05:00
Jeff Epler
e01ade3848 rgbmatrix: Don't inline the allocator functions 2020-09-01 11:00:07 -05:00
Jeff Epler
2f120c70ee rgbmatrix: recover gracefully from allocation errors
e.g., allocating a 192x32x6bpp matrix would be enough to trigger this
reliably on a Metro M4 Express using the "memory hogging" layout.
Allocating 64x32x6bpp could trigger it, but somewhat unreliably.

There are several things going on here:
 * we make the failing call with interrupts off
 * we were throwing an exception with interrupts off
 * protomatter failed badly in _PM_free when it was partially-initialized

Incorporate the fix from protomatter, switch to a non-throwing malloc
variant, and ensure that interrupts get turned back on.

This decreases the quality of the MemoryError (it cannot report the size
of the failed allocation) but allows CircuitPython to survive, rather
than faulting.
2020-09-01 10:55:45 -05:00
Kevin Matocha
fc513956be Update refresh to force immediate redraw with display.refresh() or display.refresh(target_frames_per_second=None), even with auto_refresh=False 2020-09-01 09:36:29 -05:00
Dan Halbert
6dbd369272 merge from upstream 2020-08-30 14:39:03 -04:00
Scott Shawcroft
8b71e26abd
Merge remote-tracking branch 'adafruit/main' into native_wifi 2020-08-25 16:39:23 -07:00
Scott Shawcroft
1527a3ce92
Merge remote-tracking branch 'adafruit/main' into add_pwmio 2020-08-24 18:25:18 -07:00
Kevin Matocha
983e1af33d remove other extraneous files 2020-08-21 19:10:13 -05:00
Kevin Matocha
dc502a5f26 remove extraneous files 2020-08-21 19:08:25 -05:00
Kevin Matocha
a9f6d147c4 Merge adafruit/main latest 2020-08-21 14:37:32 -05:00
Kevin Matocha
7e529ed4c5 Merge with latest adafruit/main 2020-08-21 14:28:24 -05:00
Kevin Matocha
3753ea3cd8 Merge remote-tracking branch 'source/main' into main 2020-08-21 14:19:58 -05:00
Kevin Matocha
24ca133396 Updating main to adafruit/main 2020-08-21 14:19:28 -05:00
Scott Shawcroft
5771be9510
Merge pull request #3292 from jepler/allocate_display_bus_bug
allocate_display_bus: fix bug where in-use bus would be returned
2020-08-21 11:19:50 -07:00
Dan Halbert
0e30dd8bcc merge from upstream; working; includes debug_out code for debugging via Saleae for posterity 2020-08-20 20:29:57 -04:00
Scott Shawcroft
7bdd243bf6
Ping works! 2020-08-19 14:22:13 -07:00
Scott Shawcroft
3860991111
Ping work and start to add socketpool 2020-08-19 14:22:13 -07:00
Scott Shawcroft
c62ab6e09a
Add ipaddress 2020-08-19 14:22:12 -07:00
Yihui Xiong
8bab7b664c support to get HID OUT report 2020-08-19 20:18:17 +08:00
Scott Shawcroft
6857f98426
Split pulseio.PWMOut into pwmio
This gives us better granularity when implementing new ports because
PWMOut is commonly implemented before PulseIn and PulseOut.

Fixes #3211
2020-08-18 13:08:33 -07:00
Scott Shawcroft
33c9bdb778
Merge pull request #3277 from jepler/sharpmemory-bugs
sharpdisplay: Prevent 'ValueError: <pin> in use' exception
2020-08-18 11:54:53 -07:00
Jeff Epler
f2f18da189 Fix build error for !SHARPDISPLAY 2020-08-18 10:59:55 -05:00
Jeff Epler
9e66f71a31 Fix build error for \!DISPLAY 2020-08-18 10:03:45 -05:00
Jeff Epler
0bec39118f displayio: Don't need to specialcase reset of sharpdisplay framebuffer
.. for the case where the bus was not in use
2020-08-18 09:32:28 -05:00
Jeff Epler
b542c1486f reset_board_buses: need to check if sharpdisplay uses SPI bus 2020-08-18 09:32:28 -05:00
Jeff Epler
6d2d36db3d Finish implementing scott's suggestion 2020-08-17 21:09:21 -05:00
Jeff Epler
6425a411ca
Update shared-module/displayio/__init__.c
Co-authored-by: Scott Shawcroft <scott@tannewt.org>
2020-08-17 21:07:24 -05:00
Jeff Epler
1ccd2e234f allocate_display_bus: fix bug where in-use bus would be returned 2020-08-17 10:48:23 -05:00
Kevin Matocha
fc1347ac2a deleted whitespace 2020-08-14 13:37:06 -05:00
Kevin Matocha
ba5dedc1df deleted whitespace 2020-08-14 13:37:06 -05:00
Kevin Matocha
b1fce9e933 Deleted trailing whitespace 2020-08-14 13:36:59 -05:00
Kevin Matocha
a66ef32da2 Added inclusive indexing for x2,y2, fixed default value handling for x1,y1, added bitmap palette comparison 2020-08-14 13:15:01 -05:00
Margaret Matocha
824f47d6e9 Added bitmap.blit function for bitmap slice copy 2020-08-14 12:59:57 -05:00
Margaret Matocha
4ba9ff892c Added bitmap.blit function for copying slices of bitmaps 2020-08-14 12:59:48 -05:00
Kevin Matocha
14f5d03b6d bringing up to date 2020-08-13 18:59:00 -05:00
Scott Shawcroft
ff5902f9f8
Merge branch 'main' into pixelbuf-iterable 2020-08-13 11:55:51 -07:00
Jeff Epler
195c0ea986 sharpdisplay: Make PARTIAL_UPDATES unconditional 2020-08-12 13:01:43 -05:00
Jeff Epler
d61f66d173
Update shared-module/framebufferio/FramebufferDisplay.h
Co-authored-by: Scott Shawcroft <scott@tannewt.org>
2020-08-12 12:50:08 -05:00
Jeff Epler
759ded9c38 Fix build errors when SHARPDISPLAY && !RGBMATRIX 2020-08-12 07:39:12 -05:00
Jeff Epler
c1400bae9b sharpmemory: Implement support for Sharp Memory Displays in framebufferio 2020-08-12 07:32:18 -05:00
Jeff Epler
9c4f644641 framebufferio: add dirty row tracking 2020-08-12 07:32:18 -05:00
Jeff Epler
5e4ed93415 framebufferio: Add getters for remaining displayio_display_core_construct arguments
.. and introduce a convenience macro that helps many of them be required
(if their values match defaults or are inapplicable)
2020-08-12 07:32:18 -05:00
Jeff Epler
1ee2062c1b framebufferio: Check early if framebuffer is big enough 2020-08-12 07:32:18 -05:00
Jeff Epler
a33e48c065 framebufferio: add "first pixel offset" and "row stride" 2020-08-12 07:32:18 -05:00
Jeff Epler
8021f3b4cb framebufferio: handle sharp memory displays
A bit of cheating; we need to add a protocol getter for
reverse_bytes_in_word
2020-08-12 07:32:18 -05:00
Jeff Epler
a84cc19499 framebufferio: Handle 1 (tested), 2, and 4 bpp displays 2020-08-12 07:32:18 -05:00
Jeff Epler
6d19a09888 framebufferio: Set type to none when releasing
This avoids the message "Too many displays in use" when they are released
directly, rather than via release_displays().
2020-08-12 07:32:18 -05:00
Jeff Epler
5a7b2a2038 framebufferio: Don't call swapbuffers unnecessarily 2020-08-12 07:32:18 -05:00
Jeff Epler
ffc488e748 framebufferio: Fix crash calling unimplemented get_brightness
If set_brightness was implemented but get_brightness wasn't, this
would hard fault
2020-08-12 07:32:18 -05:00
Roy Hooper
1b7709f325 use the stack 2020-08-10 18:42:05 -04:00
Roy Hooper
ef1782f85e fix trailing whitespace 2020-08-10 12:04:44 -04:00
Dan Halbert
0f4b969d62 discovery of Nordic UART service working 2020-08-08 00:29:37 -04:00
Roy Hooper
e73dba21d2 make pixelbuf handle floats and iterables 2020-08-07 18:42:06 -04:00
Margaret Matocha
b6008d0032 Adding bitmap.insert to copy a slice of a source bitmap into another bitmap 2020-08-07 15:59:42 -05:00
Margaret Matocha
64c9baa6aa Added bitmap.insert function for slice copy into a bitmap from another bitmap 2020-08-07 15:46:00 -05:00
Scott Shawcroft
b76d37f24a
Merge pull request #3223 from dhalbert/unmount-before-reset
storage.erase_filesystem(): disconnect from USB and wait 1 second before resetting
2020-07-29 10:47:24 -07:00
Kenny
4c2d0c3dc5 use top-left heuristic for vectorio.Polygon
this flips the bottom-right style to top-left which is at least
kind of normal.  A 2x2 square at (0,0) would be defined like
(0,0), (3,0), (3,3), (0,3)
Which seems kind of surprising but at least less bonkers than
that square being defined at (1,1), which is the current behavior.
2020-07-28 23:10:59 -07:00
Dan Halbert
65c22aa434 storage.erase_filesystem(): unmount and wait 1 second before resetting 2020-07-28 17:52:56 -04:00
hierophect
c735dceed5
Merge pull request #3099 from hierophect/stm32-timer-allocator
STM32: Add timer allocator, PulseIO adjustments
2020-07-24 11:16:39 -04:00
Scott Shawcroft
1ec3580946
Merge branch 'main' into memmonitor 2020-07-22 12:24:19 -07:00
Lucian Copeland
c1f731d62e Claim USB pins at startup to prevent overwrites 2020-07-22 14:22:05 -04:00
Kenny
e977b427aa vectorio: fix VectorShape non-transposed pixel placement
Fixes https://github.com/adafruit/circuitpython/issues/3170

The absolute transform needs to be subtracted in all cases, not
only when the coordinate system is transposed.
2020-07-20 20:25:31 -07:00
Scott Shawcroft
e759769635
Merge pull request #3175 from jepler/background-callback-bugs
Background callback bugfixes
2020-07-20 16:17:31 -07:00
Kenny
e2d252a6d5 pre-allocate list of known size 2020-07-20 10:12:29 -07:00
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
Kenny
efeae0d84f fix 3169: Polygon.points property
The getter for vectorio.Polygon#points was not updated with the data type change of the stored points list.

This moves the implementation to shared_module and updates the data type to reflect the actual state.
2020-07-19 12:27:35 -07:00
Scott Shawcroft
07f031c708
Add ignore() and fix docs 2020-07-17 17:15:04 -07:00
Scott Shawcroft
a1e4814a27
Get AllocationAlarm working 2020-07-17 17:15:03 -07:00
Scott Shawcroft
518d909b2c
Add memorymonitor module 2020-07-17 17:15:03 -07: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
bdab6c12d4 MP3Decoder: take advantage of background callback
Before this, the mp3 file would be read into the in-memory buffer
only when new samples were actually needed.  This meant that the time
to read mp3 content always counted against the ~22ms audio buffer length.

Now, when there's at least 1 full disk block of free space in the input
buffer, we can request that the buffer be filled _after_ returning from
audiomp3_mp3file_get_buffer and actually filling the DMA pointers.  In
this way, the time taken for reading MP3 data from flash/SD is less
likely to cause an underrun of audio DMA.

The existing calls to fill the inbuf remain, but in most cases during
streaming these become no-ops because the buffer will be over half full.
2020-07-15 09:26:47 -05:00
Diego Elio Pettenò
34b4993d63 Add license to some obvious files. 2020-07-06 19:16:25 +01: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
Jeff Epler
57fde2e07b sdcardio: implement new library for SD card I/O
Testing performed: That a card is successfully mounted on Pygamer with
the built in SD card slot

This module is enabled for most FULL_BUILD boards, but is disabled for
samd21 ("M0"), litex, and pca10100 for various reasons.
2020-06-26 11:50:23 -05:00
Scott Shawcroft
ed6e81d688
Switch SPI to polling DMA and enable displayio 2020-06-24 13:10:08 -07:00
Scott Shawcroft
a26102607e
Add UART support 2020-06-24 12:47:58 -07:00
Jeff Epler
a580f0f1c4 _pew: move to common-hal
I noticed that this code was referring to samd-specific functionality,
and isn't enabled except in one samd board (pewpew10).  Move it.

There is incomplte support for _pew in mimxrt10xx which then caused build
errors; adding a #if guard to check for _pew being enabled fixes it.
The _pew module is not likely to be important on mimxrt but I'll leave the
choice to remove it to someone else.
2020-06-22 10:45:27 -05:00
Dan Halbert
c91435eff2 remove debugging prints 2020-06-15 18:10:34 -04:00
Dan Halbert
81896930c7 Fix ScanEntry prefix matching for all 2020-06-15 16:35:51 -04: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
Jeff Epler
0722dafc24 audiomixer: Fix garbled playback when voice 0 is stopped, audio pops
There were two main problems
 - word_buffer was being filled as though with unsigned samples,
   but during mixing all samples are kept in signed mode
 - If the first buffer was stopped, the voices_active flag got set
   anyway, even though the output buffer wasn't initialized yet,
   so the samples were mixed with indeterminate data

We also cover the case where no buffer was playing, and ensure
the output buffer is filled.

This now works much better.  Tested on neotrellis m4 playing back
4 mp3 streams at a time in signed-16, 22050Hz
2020-06-01 19:14:38 -05:00
Roy Hooper
dd980249c6 Allow setting RGBW pixels with RGB tuples 2020-05-24 20:35:13 -04:00
George Waters
c592a2b4db
Simplify pixelbuf set_pixels function 2020-05-22 21:19:17 -04:00