Commit Graph

27 Commits

Author SHA1 Message Date
Jeff Epler
52540a9830 Rename EXTENDED_FIELDS -> MP_TYPE_EXTENDED_FIELDS 2021-07-12 06:57:59 -05:00
Jeff Epler
7302bc09a7 rename the type flag to EXTENDED for consistency 2021-07-09 14:59:37 -05:00
Jeff Epler
d37f8a1a5a milestone: a selection of builds succeed 2021-07-06 10:57:44 -05:00
Jeff Epler
df56ba207f WIP 2021-07-06 09:25:56 -05:00
Dan Halbert
fa6c06fb38 count in/out endpoints; allow more usb modules on low-endpoint boards 2021-05-13 21:59:02 -04:00
Dan Halbert
adc3d7d55e update Python API according to review comments 2021-05-03 22:29:02 -04:00
Dan Halbert
cc95b71d64 fix type annotations 2021-04-30 09:40:40 -04:00
Dan Halbert
f98a54628b wip: compiles 2021-04-27 14:37:36 -04:00
Dan Halbert
6cb751ab06 wip: revamp API names 2021-04-14 22:10:09 -04:00
Dan Halbert
4a7e129287 wip: latent usb device enabling/disabling 2021-04-13 23:33:44 -04:00
microDev
a52eb88031
run code formatting script 2021-03-15 19:27:36 +05:30
Dan Halbert
b27d511251 address review; use constructor for HCI Adapter 2020-08-30 14:06:48 -04:00
Taku Fukada
56c898da80 Modify some Python stubs 2020-08-07 01:01:28 +09:00
Taku Fukada
d356581651 Fix several type hints 2020-07-27 18:05:13 +09:00
dherrada
d0d949cd24 Made every init return None 2020-07-03 14:23:34 -04:00
dherrada
d358c915c3 Fixed init formatting 2020-07-03 14:00:06 -04:00
dherrada
3df03a5650 Made most of the requested changes 2020-07-03 13:49:00 -04:00
dherrada
9c842c5a67 Added type hints to usb_midi 2020-07-03 11:40:20 -04:00
dherrada
54cb1feea0 Removed all 'self, )' 2020-07-02 13:28:36 -04:00
Scott Shawcroft
4e8de3c554
Swap sphinx to autoapi and the inline stubs 2020-05-12 17:28:24 -07:00
dherrada
6490137812
Did usb_hid, usb_midi, ustack, wiznet 2020-05-12 12:08:46 -04: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
Craig Forbes
de43911a68 Remove usb_midi.PortIn and PortOut constructors. 2019-02-06 22:22:15 -06:00
Scott Shawcroft
747f2cfe26
Add subclass support to displayio.
Also, swap make_news to accept a kwarg map and refine param checking.

Fixes #1237
2019-01-14 17:29:19 -08:00
Dan Halbert
50ee5ef24c merge translations; add bleio comments; fix minor sphinx issues in midi 2019-01-10 21:12:17 -05:00
Scott Shawcroft
3dd59c3d5f
Polish thanks to Dan's feedback 2019-01-10 11:00:40 -08:00
Scott Shawcroft
b5e40f52c2
Add USB MIDI support for SAMD and nRF.
The API should be identical to using a UART for MIDI.

Fixes #672
2019-01-09 14:02:11 -08:00