Commit Graph

412 Commits

Author SHA1 Message Date
Dave Marples d41cf2e926 Fix incorrect initialisation of default UART 2020-02-23 11:16:24 +00:00
Dave Marples d388899985 Addition of RS485 support 2020-02-18 23:16:40 +00:00
Dave Marples 84ad3d8393 Addition of RTS/CTS/RS485 UART functionality 2020-02-18 23:16:40 +00:00
Scott Shawcroft e97b0cfc61
Merge pull request #2581 from jamesbowman/master
First draft of eveL, the low-level module of the Gameduino bindings
2020-02-13 11:21:32 -08:00
Gadi Rotenberg 07708f1518 Added fix to allow remount when usb enabled but msc is ejected 2020-02-12 09:57:58 +02:00
James Bowman a87dee2f66 Correct the BitmapTransform operations.
Correct argument order
better argument naming
fix copypaste bug on C and F arguments
2020-02-10 19:34:38 -08:00
James Bowman f101ff60c5 Move _eve module declarations into shared-bindings header 2020-02-07 17:10:19 -08:00
James Bowman 5c6d94d3e5 Split into shared-module and shared-bindings 2020-02-07 10:30:49 -08:00
Scott Shawcroft 55eb1730b8
Merge remote-tracking branch 'adafruit/master' into tweak_pixelbuf 2020-01-30 10:59:21 -08:00
Radomir Dopieralski 27c36eea2b circuitpython-stage: allow choosing background color 2020-01-30 15:24:04 +01:00
Scott Shawcroft d655c785b6
Merge commit 'b36b24' into tweak_pixelbuf 2020-01-29 13:35:22 -08:00
hierophect 898f4e1f72
Merge branch 'master' into stm32-meowbit 2020-01-29 16:32:08 -05:00
Lucian Copeland 3c86005546 Implement requested changes 2020-01-28 17:11:25 -05:00
Scott Shawcroft 5e789b3850
Don't allocate the pre brightness buffer if brightness is 1.0 still 2020-01-27 15:10:32 -08:00
Scott Shawcroft 39971794dd
Encapsulate buffers inside PixelBuf and refactor it. 2020-01-24 18:23:07 -08:00
Lucian Copeland 70932cab42 Simplify the flash-display conflict fix 2020-01-24 14:33:28 -05:00
Lucian Copeland 2afca4e942 Fix flash-display conflict error 2020-01-24 14:25:36 -05:00
Jeff Epler b4ddee2bb6 Mixer: rename function based on review comment 2020-01-20 14:08:56 -06:00
Jeff Epler 982c63a717 Mixer: use MP_LIKELY macro instead of locally brewed one 2020-01-20 14:08:32 -06:00
Jeff Epler 449dbea456 Mixer: Rework for performance, particularly of the S16 case
This removes downscaling (halving-add) when multiple voices are
being mixed.  To avoid clipping, and get similar behavior to before,
set the "level" of each voice to (1/voice_count).

Slow paths that were applicable to only M0 chips were removed.

As a side effect, the internal volume representation is now 0 ..
0x8000 (inclusive), which additionally makes a level of exactly 0.5
representable.

Testing performed, on PyGamer: For all 4 data cases, for stereo and
mono, for 1 and 2 voices, play pure sign waves represented as
RawSamples and view the result on a scope and through headphones.
Also, scope the amount of time spent in background tasks.

Code size: growth of +272 bytes

Performance (time in background task when mixing 2 stereo 16-bit voices):
76us per down from 135us (once per ~2.9ms long term average)
(Decrease from 4.7% to 2.4% of all CPU time)
2020-01-16 10:48:38 -06:00
Jeff Epler e6869c8983 mixer: factor out mix_one_voice 2020-01-16 10:31:26 -06:00
Scott Shawcroft a10cd8580c
Merge pull request #2445 from jepler/mp3-jeplayer-fixes
Fixes for JEplayer
2020-01-08 12:50:13 -08:00
Jeff Epler dd6010a17e Fix more build problems 2020-01-06 13:35:43 -06:00
Jeff Epler dc729718eb audiomp3: rename to MP3Decoder 2020-01-06 07:51:41 -06:00
Jeff Epler ec22520992 MP3File: Add rms_level property
This lets a music player show it vu-meter style
2020-01-02 15:23:42 -06:00
Roy Hooper f1a9039632 Merge branch 'master' into pixelbuf-subscr-change 2019-12-29 13:56:31 -05:00
Jeff Epler 97bb46c047 MP3File: tweak buffer handling
After adding the ability to change files in an existing MP3File object,
it became apparent that at the beginning of a track some part of an
existing buffer was playing first.

I noticed that in get_buffer, the just-populated buffer wasn't being
returned, but the other one was.  But still after fixing this, I heard
wrong audio at the beginning of a track, so I took the heavy duty approach
and zeroed the buffers out.  That means there's a remaining bug to chase,
which is merely hidden by the memset()s.
2019-12-24 09:43:15 -06:00
Jeff Epler 00628a7ddd MP3File: whitespace 2019-12-23 09:36:50 -06:00
Jeff Epler 02154caf24 MP3File: Add a settable ".file" property
This enables jeplayer to allocate just one MP3File at startup, rather
than have to make repeated large allocations while the application is
running.

The buffers have to be allocated their theoretical maximum, but that
doesn't matter much as all the real-life MP3 files I checked needed
that much allocation anyway.
2019-12-23 09:36:46 -06:00
Jeff Epler a63da7a6c0 displayio: make 'rotation' property settable 2019-12-16 15:23:41 -06:00
Jeff Epler 91a1706160 MP3: look harder for frame info
Apparently sometimes, a proper "frame info" block is not found after
a "sync word".  Keep looking for one as needed, instead of giving up
after one try.

This was one reason that the "bartlebeats" mp3s would not play.
2019-12-13 18:31:12 -06:00
Jeff Epler bf9b7e7ece MP3: skip ID3V2 metadata
This was one reason that the "bartlebeats" mp3s would not play.
2019-12-13 18:31:12 -06:00
Jeff Epler a854a76819 audiocore: The arguments to reset_buffer went missing
In conversion I missed these arguments were being passed, but noticed
it when an implausible value for audio_channel was sent to mp3's
reset_buffer method.

It's not clear whether there was any negative impact to this, but it
should be fixed!
2019-12-13 18:31:12 -06:00
Roy Hooper dc8dd6df20 Revert subscr signature change 2019-12-13 14:29:15 -05:00
Roy Hooper 72ad2e9259 Merge branch 'master' into new-pixelbuf-api 2019-12-13 13:45:16 -05:00
Jeff Epler 1cdac3f16a MP3File: Fix stereo playback on samd AudioOut
There were several problems with the way this worked -- the read_count
approach was too complicated and I made a mistake "simplifying" it from
WaveFile.  And when the right channel was returned, it was off by 1 byte,
making it into static.

Instead, directly track which is the "other" channel that has data
available, and by using the right data type make the "+ channel"
arithmetic give the right result.

This requires a double cast (int16_t*)(void*) due to an alignment warning;
the alignment is now ensured manually, but the compiler doesn't make the
necessary inference that the low address bit must be clear.
2019-12-12 08:44:15 -06:00
Jeff Epler 8c841af946 MP3File: Avoid crash in get_buffer when deinitted
When a playing mp3 is deinitted, it's possible to reach get_buffer,
but all the internal pointers are NULL.  This would lead to a hard fault.
Avoid it by returning GET_BUFFER_ERROR instead.
2019-12-11 22:04:10 -06:00
Roy Hooper 0326c98fd5 Merge branch 'master' into new-pixelbuf-api 2019-12-10 20:44:43 -05:00
Roy Hooper 222dd29a14 Fix slice step. 2019-12-10 20:43:00 -05:00
Jeff Epler a08d9e6d8e audiocore: Add MP3File using Adafruit_MP3 library 2019-12-10 14:03:06 -06:00
Scott Shawcroft 19ac8aea8c
Merge pull request #2353 from jepler/audiosample-protocol
Convert audiosamples to use micropython "protocols" (safely)
2019-12-09 14:50:16 -08:00
Jeff Epler d5eca87ca2 audiocore: use mp_obj_t in prototypes 2019-12-06 13:25:40 -06:00
Jeff Epler 60f489d36a audiocore: restore the prototypes of audiosample_xxx functions 2019-12-05 13:08:32 -06:00
Hierophect ab74f45bfb Define polarity and phase in Fourwire 2019-12-05 11:44:21 -05:00
Jeff Epler feb8eb935b audiosample: convert to use a protocol
This eases addition of new sample sources, since the manual virtual
function dispatch functions are just calls via a protocol
2019-12-04 09:31:52 -06:00
Roy Hooper a4bbf35092 Merge branch 'master' into new-pixelbuf-api 2019-12-02 14:06:33 -05:00
Jeff Epler 95d9c49e43 Merge remote-tracking branch 'origin/master' into tick-refactor 2019-11-29 11:27:09 -06:00
Dan Halbert b32a9192df make UART.write be blocking on SAMD; add timeout property 2019-11-27 13:05:29 -05:00
Roy Hooper 56720eae0a remove unnecessary intermediate mp_obj_subscr wrapper 2019-11-26 18:39:08 -05:00
Scott Shawcroft d32dc814d3
Fix ePaper so it works after a GC.
We weren't correctly collecting the start and stop sequences. As
a result, the GC would free the space and allocate other info
there.

Thanks to JacobT on Discord for the bug report!
2019-11-26 12:48:36 -08:00