Commit Graph

844 Commits

Author SHA1 Message Date
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