Commit Graph

100 Commits

Author SHA1 Message Date
adam_cummick:g9T51EHpC9gPQqG6sb9Q@gitlab.com
23c292a2a1 Add native_uart calls 2021-01-06 08:54:26 -05:00
Adam Cummick
4809c92354 WIP - Add native helper based on displayio 2020-12-30 16:02:07 -05:00
Scott Shawcroft
b9d68bc5a6
Change I2C default to 100khz
Greater that 100khz is technically out of the original spec.

Background here: https://github.com/adafruit/Adafruit_CircuitPython_CLUE/issues/36
2020-09-25 11:07:22 -07:00
Lucian Copeland
00517b2600 Move missing pin warning to shared-bindings 2020-09-23 11:39:39 -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
Taku Fukada
54a342a7f5 Add and correct some type hints 2020-07-24 18:20:03 +09:00
Scott Shawcroft
4b6e02949d
Remove stop kwarg from I2C writeto.
Fixes #2082
2020-07-23 11:06:14 -07:00
dherrada
612c6bb86b
Merge branch 'main' into type_hints 2020-07-17 14:55:30 -04:00
dherrada
d0d949cd24 Made every init return None 2020-07-03 14:23:34 -04:00
dherrada
3df03a5650 Made most of the requested changes 2020-07-03 13:49:00 -04:00
Scott Shawcroft
70fdde4aaa
Remove trailing space 2020-07-02 15:11:40 -07:00
dherrada
9b4ffc0571 Changed unions to ReadableBuffer and WriteableBuffer 2020-07-02 17:47:52 -04:00
Scott Shawcroft
c33542f978
Merge branch 'main' into patch-1 2020-07-02 13:56:09 -07:00
dherrada
54cb1feea0 Removed all 'self, )' 2020-07-02 13:28:36 -04:00
dherrada
522b17ca93 Made suggested changes 2020-07-02 13:25:07 -04:00
dherrada
ac113fdc81 Changed bytearray to a union 2020-07-02 12:39:17 -04:00
dherrada
cb259de5ef Did busio, fixed up analogio 2020-07-02 10:23:17 -04:00
Jeff Epler
fcddfd0f39
Merge pull request #3083 from tannewt/esp32s2_busio
Add busio support for the ESP32-S2
2020-07-01 21:02:08 -05:00
Jeff Epler
57fde2e07b sdcardio: implement new library for SD card I/O
Testing performed: That a card is successfully mounted on Pygamer with
the built in SD card slot

This module is enabled for most FULL_BUILD boards, but is disabled for
samd21 ("M0"), litex, and pca10100 for various reasons.
2020-06-26 11:50:23 -05:00
Jeff Epler
9110e36636 Use main/selected terminology in docstrings
Also copy some notes from busio docstrings to bitbangio docstrings
2020-06-25 11:42:23 -05:00
Scott Shawcroft
c5fa9730a8
Compiles! 2020-06-24 12:47:59 -07:00
Scott Shawcroft
a26102607e
Add UART support 2020-06-24 12:47:58 -07:00
Scott Shawcroft
2c2b53303d
Merge pull request #2837 from k0d/serial-debug
Add support for a debug console, such as ST-Link VCP.
2020-05-18 18:13:31 -07:00
Mark Olsson
007c92ee6a Enable showing the console on a debug uart 2020-05-19 02:02:52 +02:00
Scott Shawcroft
3ffa5604fc
Update countio to python stub docs 2020-05-13 08:36:16 -07:00
Scott Shawcroft
4e8de3c554
Swap sphinx to autoapi and the inline stubs 2020-05-12 17:28:24 -07:00
dherrada
c534a872a2
Merge branch 'master' into master 2020-05-12 12:26:02 -04:00
warriorofwire
eb3d5fa453 ujson: do not eat trailing whitespace
Ujson should only worry about whitespace before JSON.  This becomes apparent when you are using MP stream protocol to read directly from input buffers.

When you attempt to read(1) on a UART (and possibly other protocols) you have to wait for either the byte or the timeout.

Fixes:
- Waiting for a timeout after you have completed reading a correct and complete JSON off the input.
- Raising an OSError after reading a correct and complete JSON off the input.
- Eating more data than semantically owned off the input buffer.
- Blocking to start parsing JSON until the entire JSON body has been loaded into a potentially large, contiguous Python object.

Code you would write before:
```
line = board_busio_uart_port.read_line()
json_dict = json.loads(line)
```
or reaching for fixed buffers and swapping them around in Python.

Code that did not work before that does now:
```
json_dict = json.load(board_busio_uart_port)
```

- This removes the need for intermediate copies of data when reading JSON from micropython stream protocol inputs.
- It also increases total application speed by parsing JSON concurrently with receiving on boards that read from UART via DMA.
- It simplifies code that users write while improving their apps.
2020-05-10 20:45:42 -07:00
dherrada
a2a32fea1a
Added newlines after every ellipsis 2020-04-29 15:55:06 -04:00
dherrada
093461e816
Fixed indentation 2020-04-29 15:45:19 -04:00
dherrada
deccdcc1d6
Did the same for the rest of busio 2020-04-29 15:20:05 -04:00
dherrada
93d1e53c66
Hopefully fixed whitespace issues 2020-04-29 14:19:04 -04:00
dherrada
724dcda3ec
Fixed whitespace in busio 2020-04-28 18:39:58 -04:00
dherrada
27e085ec36
Added pyi to OneWire.c 2020-04-25 15:36:16 -04:00
dherrada
e7874277ab
Fixed empty lines 2020-04-25 15:35:24 -04:00
dherrada
7070fe1995
Added inline pyi to UART.c 2020-04-25 15:25:31 -04:00
dherrada
28430a9919
Added inline pyi to I2C.c 2020-04-25 15:07:58 -04:00
dherrada
55bdee688f
Reorganized pyi again 2020-04-23 16:14:17 -04:00
dherrada
855c2033b5
Reogranized pyi in spi.c 2020-04-23 15:35:20 -04:00
dherrada
a18b991ca9
Added pyi to SPI.c 2020-04-22 15:22:34 -04:00
AndrewR-L
f572b72306
busio/UART: Correct and clarify readline() return.
Surely readline() "rtype" is string not int as stated (and not bytes as some might expect).

Also it is not totally unambiguous what happens on a timeout so it would help to clarify in docs that on a timeout 
it does NOT return with what it has read so far, rather it leaves all that in the buffer ready for a future read and returns nothing.

Likewise clarify that if timeout=0 but there is no newline it DOES return what it has read so far (NOT None). 

At least this is what I think it does and/or is supposed to do!

Python docs are generally not too explicit about what is the proper treatment, so perhaps all the more reason to
clarify the interpretation adopted?
2020-04-17 15:10:36 +01:00
Dan Halbert
817b5be320 rename routines to be clearer; fix wiznet arg types 2020-03-05 16:35:31 -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
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
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
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