Commit Graph

928 Commits

Author SHA1 Message Date
Jeff Epler 1b478bbae6 RGBMatrix: remove unneeded properties 2020-04-17 18:43:57 -05:00
Jeff Epler 57ce2d1f41 framebufferio: get width, etc., from protocol, not object property 2020-04-17 18:43:57 -05:00
Jeff Epler 3d6258f63d Rename Protomatter -> RGBMatrix
This is a quick rename, it changes the user-facing names but not the
internal names of things.
2020-04-17 18:43:57 -05:00
Jeff Epler 64c3968a2e protomatter: move get_width/height to common_hal 2020-04-17 18:43:57 -05:00
Jeff Epler 545b6e560a fix doc build 2020-04-17 18:43:57 -05:00
Jeff Epler 1a91a75b9c framebufferio: get more properties direct from underlying framebuffer 2020-04-17 18:43:57 -05:00
Jeff Epler a32337718d Rename _protomatter -> protomatter
I originally believed that there would be a wrapper library around it,
like with _pixelbuf; but this proves not to be the case, as there's
too little for the library to do.
2020-04-17 18:43:57 -05:00
Jeff Epler d1ff23e004 framebufferio: get width, height from framebuffer properties 2020-04-17 18:43:57 -05:00
Jeff Epler d2aac7a754 Protomatter: add width, height properties 2020-04-17 18:43:57 -05:00
Scott Shawcroft b580b34cbf
Merge remote-tracking branch 'adafruit/master' into lower_power 2020-04-14 17:14:44 -07:00
Jeff Epler 0ce9c008c5 Protomatter: Make all arguments kw-only, add rgb count and optional height checking
They're not readily distinguishable by type.

I also added the requested height optional parameter; this is checked
against the computed one.  It's not feasible to use this parameter to
artificailly reduce the number of used rows, because changes in the
underlying C protomatter library would be required.

Finally, I added a better error message when the number of RGB pins was
not what was expected.
2020-04-14 18:24:59 -05:00
Jeff Epler 880fff80e9 protomatter: Respond to review comments
- rename oe_pin -> output_enable_pin
 - improve and reorganize docstrings
 - rename swapbuffers->refresh
 - rename "paused" -> "brightness", change semantics slightly
 - common_hal several functions
 - clarify why the common_hal routines can't be used directly in the
   protocol's function pointers
 - whitespace cleanups
 - remove prototypes for nonexistent functions
2020-04-14 18:24:59 -05:00
Jeff Epler 5d328c3b44 protomatter: clarify by comment why these functions exist 2020-04-14 18:24:58 -05:00
Jeff Epler ba20bc8b43 framebufferio: move backlight down to the underlying framebuffer 2020-04-14 18:24:58 -05:00
Jeff Epler 129c6369cf protomatter: code style 2020-04-14 18:24:58 -05:00
Jeff Epler 4a05e938ed protomatter: validate pins to give better error message
The numbered error from the underlying library is not helpful for
beginning users
2020-04-14 18:24:58 -05:00
Jeff Epler 9019710a1e protomatter: improve an error message 2020-04-14 18:24:58 -05:00
Jeff Epler baf04b7738 FramebufferDisplay: remove probably not needed constructor arguments 2020-04-14 18:24:58 -05:00
Jeff Epler 50219862e1 protomatter: make docstring match implementation 2020-04-14 18:24:58 -05:00
Jeff Epler a663a7dd30 _protomatter: move get/set paused into shared-module 2020-04-14 18:24:58 -05:00
Jeff Epler 5fcba97a51 Make function name more descriptive 2020-04-14 18:24:58 -05:00
Jeff Epler 89eb45a13c use floor division in docstring
Co-Authored-By: Scott Shawcroft <scott@tannewt.org>
2020-04-14 18:24:58 -05:00
Jeff Epler 09dc46a984 Add Protomatter and FramebufferDisplay 2020-04-14 18:24:54 -05:00
Jeff Epler 8cba145c90 displayio: implement, use allocate_new_display_bus_or_raise 2020-04-14 18:24:54 -05:00
Jeff Epler 6378d600c4 displayio: implement, use allocate_display_or_raise 2020-04-14 18:24:54 -05:00
Scott Shawcroft ada102dd98
Merge pull request #2767 from jepler/update-ulab
ulab: Get updates from upstream
2020-04-14 15:59:33 -07:00
Scott Shawcroft e063b066f0
Merge pull request #2756 from caternuson/bitmap_fill
Add fill method to displayio.Bitmap
2020-04-14 12:54:44 -07:00
Jeff Epler 693928d201 doc updates 2020-04-13 20:10:02 -05:00
caternuson dc75746842 add docstring, clean up 2020-04-09 08:59:26 -07:00
caternuson 49fff2d9b4 initial working fill 2020-04-09 08:43:50 -07:00
sommersoft 61bab8e62e ulab/__init__.rst: fix attribute name; uint8 -> uint16 2020-04-09 08:45:26 -05:00
Scott Shawcroft 317b96e93a
Fix iMX builds 2020-03-31 17:00:30 -07:00
Scott Shawcroft cbe9512691
Merge pull request #2741 from tannewt/fix_packetbuffer_server
Fix PacketBuffer server support
2020-03-31 13:39:34 -07:00
Jeff Epler 54e8c63b4f
Merge pull request #2730 from tannewt/fix_fourwire_phase_polarity
Add polarity and phase to FourWire.
2020-03-28 07:28:37 -05:00
Scott Shawcroft a870908718
Don't break the function signature 2020-03-26 14:11:20 -07:00
siddacious 9e0c00dfd4 adding a backlight polarity flag to Display 2020-03-25 22:51:20 -07:00
Scott Shawcroft 8a5d3cd6c4
Add exception on small buffer and fix Connecion WRITE handling 2020-03-25 17:41:47 -07:00
Scott Shawcroft 6b7acc65b6
Add polarity and phase to FourWire.
It was fixed as 0/0 even though it used to get it from the current
SPI state. This makes it more explicit with kwargs.

Thanks to magpie_lark and kmatocha on the Adafruit Support forum
for finding the issue: https://forums.adafruit.com/viewtopic.php?f=60&t=162515
2020-03-25 11:22:46 -07:00
Jeff Epler aaf07ce72f
Update shared-bindings/ulab/__init__.rst
Co-Authored-By: Scott Shawcroft <scott@tannewt.org>
2020-03-17 16:37:16 -05:00
Jeff Epler aa54a7e76e ulab: update documentation 2020-03-17 09:25:33 -05:00
Dan Halbert fdcdc1320b Make ParallelBus reset ping arg required 2020-03-06 14:30:30 -05:00
Dan Halbert 210c3274e5 Merge remote-tracking branch 'adafruit/master' into assert_pin-and-mp_const_none-cleanup 2020-03-05 17:47:01 -05:00
Dan Halbert 817b5be320 rename routines to be clearer; fix wiznet arg types 2020-03-05 16:35:31 -05:00
Dan Halbert e30b1d3121 missing semicolon 2020-02-29 22:48:11 -05:00
Dan Halbert 8435935429 update uses of assert_pin_free; remove redundant checks 2020-02-29 15:37:32 -05:00
Dan Halbert b6206406de new pin validation routines; don't use mp_const_none if NULL will do 2020-02-28 23:43:04 -05:00
Jeff Epler 39cfe32c34 Update ulab from upstream again 2020-02-27 14:14:05 -06:00
Jeff Epler 645df931ae typos 2020-02-27 11:07:37 -06:00
Jeff Epler fa3b9eba92 ulab: Incorporate it 2020-02-27 11:03:03 -06:00
Dan Halbert e31ac710be Enable _bleio adapter when _bleio is imported 2020-02-20 21:55:04 -05: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 52d96ca151
Merge pull request #2626 from dhalbert/stat-for-shortint
avoid os.stat() int overflow on smallint-only builds
2020-02-18 13:40:52 -08:00
Dan Halbert e0753c4ad2 avoid os.stat() int overflow on smallint-only builds 2020-02-14 18:33:37 -05:00
Melissa LeBlanc-Williams 33774e790c Updated OnDiskBitmap RTD example for 5.x 2020-02-14 10:23:23 -08: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
James Bowman b02937d1a7 Split ROMDECLS for readability 2020-02-13 07:28:21 -08:00
Dan Halbert c57ccd5eb4 doc typo 2020-02-11 20:03:47 -05:00
Dan Halbert f73b58a2c6 fix doc indentation 2020-02-11 19:57:48 -05:00
Dan Halbert 2e029d55fc nrf: add SPIM3 support 2020-02-11 19:22:14 -05: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 1f44029c56 Remove unused code 2020-02-10 18:57:04 -08:00
James Bowman f101ff60c5 Move _eve module declarations into shared-bindings header 2020-02-07 17:10:19 -08:00
James Bowman c631b4d60e Add doc strings, inline mod_eve-gen.h and remove it 2020-02-07 16:44:48 -08:00
James Bowman 5c6d94d3e5 Split into shared-module and shared-bindings 2020-02-07 10:30:49 -08:00
Dan Halbert cbd519bfa6 time.sleep() rounds to nearest msec 2020-02-07 10:24:11 -05:00
Dan Halbert 857d8ab40a improve time.monotonic_ns() accuracy from ms to us 2020-02-07 10:02:50 -05:00
James Bowman a20490c0b3 Add method VertexFormat() and variable fixed-point scaling in Vertex2f() 2020-02-06 08:49:07 -08:00
James Bowman acef93a253 Rename eveL to _eve, EVEL to _EVE 2020-02-05 18:17:58 -08:00
James Bowman a9b34f45dc My name 2020-02-05 18:01:25 -08:00
James Bowman 53f7e2be4f Use mp_instance_cast_to_native_base() throughout 2020-02-05 17:58:59 -08:00
Dan Halbert a4ebd2f7c1 allow tuple or list for Palette color 2020-02-03 22:09:53 -05:00
James Bowman 0bcfabbc87 Add header for module eveL explaining what it is.
Exclude modeveL-gen.h from Sphinx build
2020-02-03 18:41:32 -08:00
James Bowman 7fd30e7d20 First draft of eveL, the low-level module of the Gameduino (and BridgeTek EVE) bindings.
[adafruit/circuitpython#2578]
2020-02-03 16:46:14 -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 5d24ade5c9
Tweak error messages to reduce code size. 2020-01-29 17:32:07 -08:00
Dan Halbert e21580b67f PacketBuffer.packet_size was returning bool instead of int 2020-01-27 17:10:56 -05:00
Scott Shawcroft 39971794dd
Encapsulate buffers inside PixelBuf and refactor it. 2020-01-24 18:23:07 -08:00
Dan Halbert 2a75196aa3 merge from adafruit/circuitpython 2020-01-13 18:15:32 -05:00
Dan Halbert 9e7f8743c2 fix CCCD bonding store; avoid excessive bonding writes 2020-01-12 23:32:51 -05:00
Dan Halbert 346ce3b73b wip: HID bonding works! 2020-01-10 23:55:45 -05:00
Scott Shawcroft 8708d3dc45
Merge pull request #2461 from jepler/urandom-hardfaults
Urandom hardfaults
2020-01-10 11:37:59 -08:00
Dan Halbert 9c167af17a wip; redid flash writing to be compatible with SD 2020-01-09 17:40:02 -05: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 6735283d8f os: Don't require an on-stack buffer
This allows urandom requests of even 100k bytes to succeed on a fresh
VM session on a Metro M4 express.
2020-01-08 09:43:13 -06:00
Jeff Epler b1b4a9e842 fix doc build error 2020-01-06 09:26:32 -06:00
Jeff Epler dc729718eb audiomp3: rename to MP3Decoder 2020-01-06 07:51:41 -06:00
Scott Shawcroft 82fb761c0f
Add PacketBuffer and MTU negotiation support.
PacketBuffer facilitates packet oriented BLE protocols such as BLE
MIDI and the Apple Media Service.

This also adds PHY, MTU and connection event extension negotiation
to speed up data transfer when possible.
2020-01-03 17:29:54 -08:00
Dan Halbert fc5f776429
Merge pull request #2034 from rhooper/new-pixelbuf-api
Updates to pixelbuf API - Addresses #884
2020-01-03 17:19:02 -05:00
Roy Hooper 767ce1cdf8 remove unnecessary GCC pragmas 2020-01-02 18:03:18 -05:00
Roy Hooper ccf158b030 raise mp_raise_NotImplementedError 2020-01-02 18:00:36 -05:00
Roy Hooper fdddb54db4 rename call_show to pixelbuf_call_show 2020-01-02 17:56:04 -05: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 4e1996856f Fix docstring for byteorder 2020-01-01 19:25:44 -05:00
Roy Hooper 12193913a8 move native fill to a helper to work around being unable to call a subclass show method from the native superclass 2020-01-01 17:30:17 -05:00
Roy Hooper 8129a8503a Revert "try a property with a callable static class"
This reverts commit ca5b2770cf.
2020-01-01 16:10:22 -05:00
Roy Hooper ca5b2770cf try a property with a callable static class 2020-01-01 16:10:01 -05:00
David Glaude 01d49eb0a7
Update Shape.c
Make no sense to say this is experimental and will change in 4.0.0 when we are already above 4.0.0.
This should be removed, or updated to say it will not be in x.0.0
2019-12-30 16:54:16 +01:00
Roy Hooper 023d64fe4a Merge branch 'pixelbuf-subscr-change' into new-pixelbuf-api 2019-12-29 13:56:47 -05:00
Roy Hooper f1a9039632 Merge branch 'master' into pixelbuf-subscr-change 2019-12-29 13:56:31 -05: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
Roy Hooper 09d4fe0324 Merge branch 'master' into new-pixelbuf-api 2019-12-20 19:22:27 -05:00
Scott Shawcroft 5fc20145d1
Merge pull request #2390 from jepler/displayio-set-rotation
displayio: make 'rotation' property settable
2019-12-20 09:34:25 -08:00
albang 00c226738d
Typo in doc 2019-12-19 23:16:51 +01:00
Jeff Epler a63da7a6c0 displayio: make 'rotation' property settable 2019-12-16 15:23:41 -06:00
Roy Hooper ef2a8906dd move call to show outside loop 2019-12-16 15:05:09 -05: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
Scott Shawcroft 9a3d45e7d0
Add extended, connectable and scannable error.
Related to https://github.com/adafruit/Adafruit_CircuitPython_BLE/issues/44
2019-12-12 13:46:59 -08: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
Roy Hooper dd7ac68fb0 fix slice anf fill bugs 2019-12-08 16:53:08 -05:00
Dan Halbert f5e913101c
Merge pull request #2301 from tannewt/support_extended_advertising
Add support for extended (>31 byte) BLE advertisements.
2019-12-06 23:51:05 -05:00
Scott Shawcroft da0ea979ff
Check connection validity after service discovery.
Fixes #2347
2019-12-06 16:03:14 -08:00
Dan Halbert 559ce6a949
Merge pull request #2356 from tannewt/central_pairing
Add connection interval and debugging
2019-12-06 15:19:40 -05:00
Dan Halbert e30dde0afc Make _bleio.Connection.disconnect() idempotent 2019-12-05 08:40:53 -05:00
Scott Shawcroft 17c8356b8c
Add connection interval and debugging
This also sets TinyUSB to master and to not include its submodules.

It also fixes an old displayio example comment and retries gattc
reads.
2019-12-04 14:39:02 -08: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
Jeff Epler 238e121236 protocols: Allow them to be (optionally) type-safe
Protocols are nice, but there is no way for C code to verify whether
a type's "protocol" structure actually implements some particular
protocol.  As a result, you can pass an object that implements the
"vfs" protocol to one that expects the "stream" protocol, and the
opposite of awesomeness ensues.

This patch adds an OPTIONAL (but enabled by default) protocol identifier
as the first member of any protocol structure.  This identifier is
simply a unique QSTR chosen by the protocol designer and used by each
protocol implementer.  When checking for protocol support, instead of
just checking whether the object's type has a non-NULL protocol field,
use `mp_proto_get` which implements the protocol check when possible.

The existing protocols are now named:
    protocol_framebuf
    protocol_i2c
    protocol_pin
    protocol_stream
    protocol_spi
    protocol_vfs
(most of these are unused in CP and are just inherited from MP; vfs and
stream are definitely used though)

I did not find any crashing examples, but here's one to give a flavor of what
is improved, using `micropython_coverage`.  Before the change,
the vfs "ioctl" protocol is invoked, and the result is not intelligible
as json (but it could have resulted in a hard fault, potentially):

    >>> import uos, ujson
    >>> u = uos.VfsPosix('/tmp')
    >>> ujson.load(u)
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    ValueError: syntax error in JSON

After the change, the vfs object is correctly detected as not supporting
the stream protocol:
    >>> ujson.load(p)
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    OSError: stream operation not supported
2019-12-04 09:29:57 -06:00
Roy Hooper 0d267eaee1 fix compile fails 2019-12-02 14:25:57 -05:00
Roy Hooper a4bbf35092 Merge branch 'master' into new-pixelbuf-api 2019-12-02 14:06:33 -05:00
Dan Halbert d089f16656 'seconds' 2019-11-27 14:49:39 -05:00
Dan Halbert dd6dfeb30a Squeeze pyruler zh_Latn_pinyin 2019-11-27 14:47:35 -05:00
Dan Halbert b32a9192df make UART.write be blocking on SAMD; add timeout property 2019-11-27 13:05:29 -05:00
Roy Hooper a9624fff25 add show 2019-11-26 21:28:41 -05:00
Roy Hooper 56720eae0a remove unnecessary intermediate mp_obj_subscr wrapper 2019-11-26 18:39:08 -05:00
Scott Shawcroft 3fc58cee38
Merge remote-tracking branch 'adafruit/master' into support_extended_advertising 2019-11-26 13:12:43 -08:00
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
Roy Hooper 0ef9344c17 make pixelbuf iterable 2019-11-25 20:21:00 -05:00
Roy Hooper d4ed258b74 remove unnecessary qstrs 2019-11-25 20:20:51 -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
Roy Hooper a9baa441c9 disable -Wunused-parameter on subscr functions 2019-11-23 13:52:14 -05:00
Roy Hooper 6108fa3766 Merge branch 'master' into new-pixelbuf-api 2019-11-23 12:22:04 -05:00
Roy Hooper c770ccd939 make ->subscr take an instance to pass when instance_subscr is called from subscr. 2019-11-23 12:09:26 -05:00
Scott Shawcroft 743bc829ab
Clean up debug changes 2019-11-21 16:39:57 -08:00
Scott Shawcroft 39f4046f70
Fix pairing when peripheral. Central untested. 2019-11-21 16:32:42 -08:00
Scott Shawcroft 98e55eb577
Only add module when printing exception. 2019-11-21 12:26:25 -08:00
Scott Shawcroft 521c7531bc
Improve printing to include _bleio. prefix for type. 2019-11-21 11:04:17 -08:00
Scott Shawcroft 5e857fdb67
Use BluetoothError in _bleio
This better differentiates errors than using OSError everywhere.
2019-11-20 14:02:15 -08:00
Scott Shawcroft 11c2c3443f
Add support for extended (>31 byte) BLE advertisements. 2019-11-19 13:55:58 -08:00
Hierophect 81223c76bd revert error 2019-11-15 13:04:25 -05:00
Hierophect 2c6781f74d move neopixel_in_use flag to shared-bindings 2019-11-15 12:59:52 -05:00
Hierophect de5691acf5 Add never_reset and reset to pin common hal, adjust files 2019-11-15 12:47:00 -05:00
Dan Halbert 8584c1e824 Fix start_scan timeout default value 2019-11-13 21:34:20 -05:00
Dan Halbert 8cd2f87e99
Merge pull request #2236 from tannewt/bleio_tweaks
Refine _bleio
2019-11-04 22:27:54 -05:00
Scott Shawcroft 47e50e5659
Merge remote-tracking branch 'adafruit/master' into bleio_tweaks 2019-11-01 13:20:58 -07:00