Commit Graph

617 Commits

Author SHA1 Message Date
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
George Waters
f078055f59
Use mp_int_t for setting pixelbuf slice indices
When handling negative steps, start and stop need to be mp_int_t so they
can be checked against a potential negative value during the for loop
used to set the slice values.
2020-05-22 16:28:09 -04:00
George Waters
16ffc731f3
Implement negative step for pixelbuf slices 2020-05-21 21:57:45 -04:00
Scott Shawcroft
2c2b53303d
Merge pull request #2837 from k0d/serial-debug
Add support for a debug console, such as ST-Link VCP.
2020-05-18 18:13:31 -07:00
Mark Olsson
007c92ee6a Enable showing the console on a debug uart 2020-05-19 02:02:52 +02:00