Commit Graph

14600 Commits

Author SHA1 Message Date
Jeff Epler
e188ae8b23 time: struct_time: allow construction like a namedtuple, too
Whenever there is more than one argument, delegate the operation to
namedtuple_make_new.  This allows other circuitpython-compatible
idioms, like with keywords
    time.struct_time(tm_year=2000, tm_mon=1, tm_mday=1, tm_hour=0,
        tm_min=0, tm_sec=14, tm_wday=5, tm_yday=5, tm_isdst=-1)
with 9 positional arguments, etc.

The only vaguely plausible CPython behavior still not permitted in
CircuitPython that I found is constructing a timetuple from a length-9
list, a la
    time.struct_time(list(time.localtime())

Even better, by getting rid of an error message, the build shrinks a
tiny bit.
2019-11-26 08:45:44 -06:00
Jeff Epler
8f24ea48fb time: struct_time: allow construction from another struct_time
This doesn't cover ALL the cases that CPython permits for construction
of a struct_time, but it at least makes constructing from any namedtuple
work.

Closes: #2326
2019-11-26 08:45:40 -06:00
Scott Shawcroft
e5dd78d393
Merge pull request #2324 from jepler/nrf-i2s-channels-widths
nrf: assign channel width and count correctly
2019-11-25 16:59:08 -08:00
Scott Shawcroft
2653455ded
Merge pull request #2321 from jepler/nrf-i2s-buglets
Nrf i2s buglets
2019-11-25 16:11:43 -08:00
Thomas Sarlandie
11dc572bce feature: our own PID - thanks @ladyada 2019-11-25 21:56:42 +01:00
Ayan Pahwa
718a28c886 update filesystem.c 2019-11-26 01:13:46 +05:30
Ayan Pahwa
5e1740d11f Not creating code.py file for non-express boards 2019-11-26 00:06:03 +05:30
Jeff Epler
1ee35fd6fd nrf: i2sout: move register settings closer together
.. just for consistency's sake
2019-11-25 11:43:51 -06:00
Jeff Epler
47a6eaa297 nrf: i2sout: Assign SWIDTH
The sample width register was never set, so all samples were played
as though they were 16 bit.

After this change, 8-bit samples no longer produce audio on the MAX 98357A
BOB, because only 16-, 24-, and 32-bit samples are supported by the
hardware.  This will be addressed by a future change to pad samples to
16 bits; see #2323 and the 98357A datasheet page 6.
2019-11-25 11:43:29 -06:00
Ayan Pahwa
9c6466cffb Fix build failure for boards with less memory 2019-11-25 22:31:01 +05:30
Jeff Epler
8f4bab2d24 i2sout: Correctly retrieve channel_count
The meaning of the "single channel" parameter is not well-documented,
but in fact it seems that "true" must be passed or else the returned
channel_count is always 1.  This caused stereo samples to be played
incorrectly.
2019-11-25 10:59:59 -06:00
Thomas Sarlandie
3091952c90 ci: add shirtty to build matrix per instructions 2019-11-25 17:58:00 +01:00
Thomas Sarlandie
fc71ed9789 add shirtty board - hackaday supercon 2019 addon 2019-11-25 17:44:41 +01:00
Dan Halbert
d154d11911
Merge pull request #2320 from jepler/nrf-unsigned-audio-crash
nrf: i2sout: Fix double-increment when copying samples
2019-11-25 11:42:16 -05:00
Jeff Epler
5115fdaa6f shared-bindings: I2SOut: Ensure object is deinitialised
(or deinitialized, for those of us on this side of the pond)

Otherwise, a sequence like
```
audio = audiobusio.I2SOut(bit_clock=board.D6, word_select=board.D9, data=board.D10)
sine_wave_sample = audiocore.RawSample(sine_wave)
audio.play(sine_wave_sample, loop=True)
del audio
```
could free the memory associated with audio without stopping the
related background task.  Later, when fresh objects are allocated within
a now-freed memory region, they can get overwritten in the background
task, leading to a hard crash.

This presumably can affect multiple I2S implementations, but it was
reported against the nRF one.
2019-11-25 09:53:55 -06:00
Jeff Epler
c9946dfd63 nrf: i2sout: Use <, not !=, for loop condition
This is good C style, h/t @danh
2019-11-25 09:35:57 -06:00
Jeff Epler
19d122e546 nrf: i2sout: Fix double-increment when copying samples
This caused two problems when playing unsigned samples:
 * When an even number of samples were present, it "worked" but only
   every other sample was copied into the output, changing the waveform
 * When an odd number of samples were present, the copy continued beyond
   the end of the buffers and caused a hard fault
2019-11-25 09:07:20 -06:00
Scott Shawcroft
6e3b363f50
Merge pull request #2317 from babygrimes/frozen-mpy-bytes-gc_long_lived-crash
Only make objects long lived if they are on the GC heap
2019-11-24 23:12:56 -08:00
Scott Shawcroft
f047f3ce93
Merge pull request #2316 from dhalbert/m4-network-ps2io
Enable network and ps2io for all SAMD51 boards by default.
2019-11-24 23:11:11 -08:00
Ayan Pahwa
180b485f8b Enable creation of code.py only for full builds 2019-11-23 20:58:33 +05:30
Ayan Pahwa
262cfd4ea3 Passing address of char_written at f_write 2019-11-23 20:47:30 +05:30
Ayan Pahwa
5823f5ed04 Add \n to file end 2019-11-23 20:43:24 +05:30
Dan Halbert
1ccb7b4c5e cosmetic commit, mostly to re-run 2019-11-22 16:30:10 -05:00
Dan Halbert
13375d16f1 change mpconfigport.mk files so they can be overriden by mpconfigboard.mk 2019-11-22 15:44:51 -05:00
Jeff Epler
bfdfe0e681 stm32: fix uses of ticks_ms global 2019-11-22 14:30:08 -06:00
Jeff Epler
77b78d7fb9 Merge remote-tracking branch 'origin/master' into tick-refactor 2019-11-22 14:28:51 -06:00
Jeff Epler
eb44b2bb26 build.yml: Use a newer build toolchain
.. the new version is not offered in .deb form, so the installation
process also changes
2019-11-22 14:17:11 -06:00
Jeff Epler
1c6c9a3e1f nrf: i2sout: Ensure hardware I2S is stopped at deinit
.. otherwise, it may be possible under some scenario, for the background
task to continue and overwrite unrelated memory.
2019-11-22 14:15:07 -06:00
Dan Halbert
e18d3e0f76 Merge branch 'master' into m4-network-ps2io 2019-11-22 15:02:52 -05:00
Jeff Epler
aabb56c840 nrf: i2sout: Only update hold_value when appropriate
If we put no samples into the buffer, then there is no last
sample to fill out hold_value with.  (and, in fact, the expression such
as *(uint32_t*)(buffer-4) is outside an allocated region)

Detect this condition, and leave the prior value in place.

This improves clicks heard when pausing and resuming a waveform.
2019-11-22 13:54:37 -06:00
Dan Halbert
1a62a9cb17 remove network from kicksat_sprite 2019-11-22 14:02:44 -05:00
Dan Halbert
2e9aa38700 turn off network in pewpew_m4 2019-11-22 13:49:33 -05:00
David Grimes
f13ba7e8d9 * only make objects long lived if they are on the GC heap 2019-11-22 13:47:13 -05:00
Dan Halbert
1d411d2874 Merge remote-tracking branch 'adafruit/master' into testing-fixes 2019-11-22 11:55:34 -05:00
Hierophect
352bd95f5a remove blackpill 2019-11-22 11:19:39 -05:00
Dan Halbert
228a619af5 enable network, wiznet5k, and ps2io by default on M4 2019-11-22 10:59:27 -05:00
Hierophect
0d8eb3cfb4 add correct VID/PID pairs 2019-11-22 10:54:35 -05:00
Dan Halbert
c000567d88
Merge pull request #2313 from tannewt/fix_pairing
Re-add pairing support
2019-11-21 21:21:51 -05:00
Hierophect
6a7c8d6341 minor fix 2019-11-21 20:56:05 -05:00
Scott Shawcroft
46cc9b934b
Update translations 2019-11-21 16:50:34 -08:00
Scott Shawcroft
743bc829ab
Clean up debug changes 2019-11-21 16:39:57 -08:00
Scott Shawcroft
e63796c7bc
Special exception message for when pairing prompt is ignored. 2019-11-21 16:32:42 -08:00
Scott Shawcroft
39f4046f70
Fix pairing when peripheral. Central untested. 2019-11-21 16:32:42 -08:00
Hierophect
5b907aa076 change order 2019-11-21 18:24:10 -05:00
Hierophect
b3ad823b4c yaml additions 2019-11-21 17:39:14 -05:00
Hierophect
b5ff9684bb remove misplaced status LED definitions 2019-11-21 17:09:28 -05:00
Hierophect
4e4ecafd97 Add definitions for PYB Nano and blackpill 2019-11-21 16:53:06 -05:00
Dan Halbert
2adecda5eb
Merge pull request #2311 from tannewt/redo_bleio_errors
Use BluetoothError in _bleio
2019-11-21 16:44:26 -05:00
Dan Halbert
e06dc72359
Merge pull request #2307 from hierophect/stm32-spi-cleanup
STM32: SPI clock rate fix and cleanup
2019-11-21 16:12:06 -05:00
Scott Shawcroft
98e55eb577
Only add module when printing exception. 2019-11-21 12:26:25 -08:00