Commit Graph

1951 Commits

Author SHA1 Message Date
Dan Halbert 44b28d1187 update tinyusb to 00c440cb 2019-08-19 19:42:45 -04:00
Dan Halbert e3dc5e3a66 Merge remote-tracking branch 'adafruit/master' into run-background-tasks
Restore dependencies indicated by indentation in circuitpy_mpconfig.h.
2019-08-19 12:41:20 -04:00
Jeff Epler 26a05d01dc Merge remote-tracking branch 'origin/master' into nrf-pdm-audioin 2019-08-18 21:30:14 -05:00
Jeff Epler 912fd7759d nrf: PDMIn: Implement
So far, this supports only 16kHz and 16-bit samples with a fixed gain.
This is enough to support the basic functionality of e.g., sensing
ambient audio levels.
2019-08-18 15:58:04 -05:00
Jeff Epler 79f8a85786 nrf: stub out audiobusio.PDMIn, audiobusio.I2SOut 2019-08-18 15:55:57 -05:00
Dan Halbert 3f7321af00
Merge pull request #2031 from jepler/nrf-lto
Enable link-time optimization for nrf targets
2019-08-18 12:35:26 -04:00
Scott Shawcroft 85d7398476
Merge pull request #2066 from dhalbert/ble-pairing
BLE: more features
2019-08-16 14:50:00 -07:00
Dan Halbert 630c92392a address review comments; avoid calling common_hal_bleio_device... routines from shared-bindings 2019-08-16 15:18:53 -04:00
Dan Halbert 5877bd6036 CPblue initial definition 2019-08-13 22:12:36 -04:00
Scott Shawcroft 583392a5c6
Merge pull request #2046 from brentru/add-pyportal-titano
Add PyPortal Titano
2019-08-12 16:01:10 -07:00
Jeff Epler 11dd3a260e nrf: Use RUN_BACKGROUND_TASKS 2019-08-11 08:53:02 -05:00
Jeff Epler d9ee2d28a0 atmel-samd: Use RUN_BACKGROUND_TASKS 2019-08-11 08:53:02 -05:00
brentru 5a8846d33c remove cruft from prv board 2019-08-08 15:12:01 -04:00
brentru f87f48ab88 adding pyportal titano board definition 2019-08-08 14:56:28 -04:00
Dan Halbert 1570ef2dd4 specifying attribute length; fix up value setting 2019-08-07 23:49:09 -04:00
Jeff Epler 33b949abfa samd: audio_dma, audio_background: Gate with CIRCUITPY_ defines
Some ports which actually don't have audioio or audiobusio were still
calling into audio_dma_background().  This wasn't an error until
the assignment to audio_dma_state in audio_dma_stop was added, though
it's not clear why.
2019-08-07 21:29:24 -05:00
Jeff Epler 500d1bb168 samd: audio_dma.c: Remove exceptions, just return early
These were most useful debugging, but because this code can be reached
"outside of the VM", it's not actually permitted to throw exceptions here.
2019-08-07 20:20:36 -05:00
brentru 1d4700cb6c add pindefs for tft and tft control 2019-08-07 18:29:20 -04:00
brentru 8f6eac98f3 add defs for pyportal titano 2019-08-07 17:10:31 -04:00
Dan Halbert d047b73a9c fix newly-introduced bugs; UART client/server working again 2019-08-07 11:10:21 -04:00
Jeff Epler 39c64bf83c samd: audio_dma_stop: don't free invalid channel
audio_dma_stop can be reached twice in normal usage of AudioOut.

This may bear further investigation, but stop it here, by making the
function check for a previously freed channel number.  This also prevents
the event channel from being disabled twice.

The first stop location is from audio_dma_get_playing, when the buffers
are exhausted; the second is from common_hal_audioio_audioout_stop when
checking the 'playing' flag.
2019-08-06 22:00:31 -05:00
Jeff Epler 8b717955ba samd: audio_dma: wrap dma_{en,dis}able_channel and add error checking
It turns out the "disable" error will fire in practice, we'll fix that
next.
2019-08-06 22:00:31 -05:00
Dan Halbert d74c8b9425 WIP: more Descriptor work; refactor gattc/gatts read/write 2019-08-06 22:55:25 -04:00
Jeff Epler 6253f11503 samd: audio_dma_stop: Clear out audio_dma_state[]
As identified in #1908, when both AudioOut and PDMIn are used, hard
locks can occur.  Because audio_dma_stop didn't clear audio_dma_state[],
a future call to audio_dma_load_next_block could occur using a DMA
object which belongs to PDMIn.

I believe that this Closes: #1908 though perhaps it is still not the full
story.

Testing performed: Loaded a sketch similar to the one on #1908 that
tends to reproduce the bug within ~30s.  Ran for >300s without hard
lock.  HOWEVER, while my cpx is no longer hard locking, it occasionally
(<1 / 200s) announces
    Code done running. Waiting for reload.
(and does so), even though my main loop is surrounded by a 'while True:'
condition, so there are still gremlins nearby.
2019-08-06 21:34:21 -05:00
Dan Halbert 243334da75 Merge remote-tracking branch 'adafruit/master' into ble-pairing 2019-08-05 23:06:24 -04:00
Scott Shawcroft 59efce3035
Merge pull request #2039 from dhalbert/metro-52840
Metro nRF52840 rev A defn; remove '#define FEATHER52840' from mpconfigboard.h
2019-08-05 18:48:36 -07:00
Scott Shawcroft b675a27e16
Merge pull request #2000 from jepler/nrf-pwm-audio
Implement PWM audio out for the nrf port
2019-08-05 17:26:27 -07:00
Dan Halbert c56566179a Metro nRF52840 rev A defn; also remove '#define FEATHER52840' from mpconfigboard.h files 2019-08-05 18:10:27 -04:00
Dan Halbert b67d04a5b1 Merge remote-tracking branch 'adafruit/master' into ble-pairing 2019-08-05 16:35:44 -04:00
Jeff Epler 77bc1ba03e nrf: PWMAudioOut: Remove the need to wait in "pause"
The original formulation was because I saw the need to avoid a transition
from playing to stopped exactly when a resume was taking place.  However,
@tannewt was concerned about this pause causing trouble, because it could
be relatively lengthy (several ms even in a typical case).

After reflection, I've convinced myself that updating the registers
in this order in resume avoids a window where a "stopped" event can
be missed as long as the shortcut is updated first.

Testing re-performed: pause/resume testing of looped RawSample and
WaveFile audio sources.
2019-08-03 08:19:25 -05:00
Jeff Epler 4bae29b925 nrf: enable link-time optimization
Testing performed: installed freshly built .uf2 on a Particle Xenon.
Checked that circuitpython still starts.
Checked that the size of all .uf2 files for nrf builds are plausible.

Aside from memory savings, the performance of Python code (pystone)
increased by about +14%.

However, this adds about 12-16 seconds to each nrf build.

Timings & Sizes (build system: i5-3320M, -j5 parallelism on 4 threads):

Before:
$ make -j5 BOARD=particle_xenon
765004 bytes free in flash out of 1048576 bytes ( 1024.0 kb ).
232076 bytes free in ram for stack out of 245760 bytes ( 240.0 kb ).
68.54user 11.83system 0:34.34elapsed 234%CPU
pystones before: 570

After:
$ make -j5 BOARD=particle_xenon
804284 bytes free in flash out of 1048576 bytes ( 1024.0 kb ).
232072 bytes free in ram for stack out of 245760 bytes ( 240.0 kb ).
71.06user 11.77system 0:46.91elapsed 176%CPU
pystones after: 650

Timings on travis:

Before:
Build feather_nrf52840_express for pl took 55.79s and succeeded
Build feather_nrf52840_express for zh_Latn_pinyin took 3.18s and succeeded

After:
Build feather_nrf52840_express for pl took 62.72s and succeeded
Build feather_nrf52840_express for zh_Latn_pinyin took 19.10s

Closes: #1396
2019-08-02 20:59:47 -05:00
Dan Halbert 7ce3776b80 WIP: rework of Characteristic properties; enhance Descriptor; not tested 2019-08-02 17:57:31 -04:00
Jeff Epler 28b7cbfca6 nrf: Mark interrupt vectors as used 2019-08-02 07:53:35 -05:00
jepler 34e2bab96a nrf: Implement RUNMODE_BOOTLOADER and RUNMODE_SAFE_MODE 2019-08-01 18:53:07 -05:00
Jeff Epler 76f65ac694 Implement play/pause
.. and also incidentally fix a problem where a RawSample could only
be looped 131070 times.
2019-07-31 20:02:56 -05:00
Scott Shawcroft eee759455a
Merge pull request #2018 from keith-packard/snekboard
Add board support for keithp.com SnekBoard
2019-07-31 16:38:51 -07:00
Jeff Epler b0f7c7bc4c Merge remote-tracking branch 'origin/master' into nrf-pwm-audio 2019-07-31 16:32:54 -05:00
Dan Halbert ee518b9141 Merge remote-tracking branch 'adafruit/master' into ble-pairing 2019-07-31 11:22:48 -04:00
Dan Halbert 91d791afd0 cleanup adapter.address; add uniquish suffix to BLE device name 2019-07-31 00:30:24 -04:00
Scott Shawcroft 366fdcce18
Merge pull request #2011 from tannewt/ssd1322
Add knobs for SSD1322 and two displayio fixes.
2019-07-30 14:15:37 -07:00
Scott Shawcroft 9dd56b1566
Merge branch 'master' into snekboard 2019-07-30 14:12:08 -07:00
Dan Halbert 83129b8c63 BLE: peripheral client pairing (not yet bonding); fix time doc formatting 2019-07-30 14:26:26 -04:00
wallarug ecfffac3a8
Delete samd51x19-bootloader-external-flash-crystalless.ld 2019-07-30 19:48:35 +10:00
wallarug ff6ae1aefb
Update mpconfigboard.mk to use standard linker file 2019-07-30 19:13:33 +10:00
Jeff Epler b72352949b PWM audio: Rename AudioOut -> PWMAudioOut, _audioio_ -> _audiopwmio_ 2019-07-29 18:39:00 -04:00
Keith Packard c6e4ddc88a boards/snekboard: Delete SPI object reference
Snekboard does not expose any pins for SPI to the user, so delete
the SPI object reference as that won't work.

Signed-off-by: Keith Packard <keithp@keithp.com>
2019-07-29 13:45:52 -07:00
Keith Packard 9a37c8a4b3 boards/snekboard: Add pin aliases for UART and I2C
Allow users to use TX/RX and SDA/SCL names.

Signed-off-by: Keith Packard <keithp@keithp.com>
2019-07-29 13:45:06 -07:00
Keith Packard 4387ecfdfb Update snekboard PID to official value
Snekboard has been assigned the following PIDs:

	PID 0x004D  # bootloader
	PID 0x804D  # arduino
	PID 0x804E  # circuitpython

Signed-off-by: Keith Packard <keithp@keithp.com>
2019-07-29 13:15:18 -07:00
Keith Packard 326df70ac2 Fix snekboard names
Manufacturer -- keithp.com
Product -- snekboard

Signed-off-by: Keith Packard <keithp@keithp.com>
2019-07-29 13:15:18 -07:00
Keith Packard 56f710f64f Add board support for keithp.com SnekBoard
This is another SAMDG2118A design with built-in 9V motor controllers
that are designed to be used with Lego PowerFunctions devices.

Signed-off-by: Keith Packard <keithp@keithp.com>
2019-07-29 13:14:37 -07:00