summaryrefslogtreecommitdiff
path: root/shared-bindings
diff options
context:
space:
mode:
authorDavePutz <dwputz@gmail.com>2021-03-10 13:55:09 -0600
committerGitHub <noreply@github.com>2021-03-10 13:55:09 -0600
commitef0ce0df72882555bf6e65580dbab1f15f787f02 (patch)
treedcb31aa33239e68e1f530b529f0cf0be8642d9b9 /shared-bindings
parentafa508cb47a601f68f8c969400d349d60b80f6d5 (diff)
parentbe9e045ee3562e4fff0f982a4bf53654da8107b6 (diff)
Merge pull request #43 from adafruit/main
Update from adafruit main
Diffstat (limited to 'shared-bindings')
-rw-r--r--shared-bindings/bitbangio/I2C.h2
-rw-r--r--shared-bindings/bitbangio/OneWire.h2
-rw-r--r--shared-bindings/bitbangio/SPI.h2
-rw-r--r--shared-bindings/bitbangio/__init__.c1
-rw-r--r--shared-bindings/countio/Counter.c3
-rw-r--r--shared-bindings/nvm/ByteArray.c3
-rw-r--r--shared-bindings/usb_cdc/Serial.c35
7 files changed, 36 insertions, 12 deletions
diff --git a/shared-bindings/bitbangio/I2C.h b/shared-bindings/bitbangio/I2C.h
index 1ce4d21e9..97dd4580d 100644
--- a/shared-bindings/bitbangio/I2C.h
+++ b/shared-bindings/bitbangio/I2C.h
@@ -30,7 +30,7 @@
#include "py/obj.h"
#include "common-hal/microcontroller/Pin.h"
-#include "shared-module/bitbangio/types.h"
+#include "shared-module/bitbangio/I2C.h"
// Type object used in Python. Should be shared between ports.
extern const mp_obj_type_t bitbangio_i2c_type;
diff --git a/shared-bindings/bitbangio/OneWire.h b/shared-bindings/bitbangio/OneWire.h
index ef50db737..da665b50d 100644
--- a/shared-bindings/bitbangio/OneWire.h
+++ b/shared-bindings/bitbangio/OneWire.h
@@ -28,7 +28,7 @@
#define MICROPY_INCLUDED_SHARED_BINDINGS_BITBANGIO_ONEWIRE_H
#include "common-hal/microcontroller/Pin.h"
-#include "shared-module/bitbangio/types.h"
+#include "shared-module/bitbangio/OneWire.h"
extern const mp_obj_type_t bitbangio_onewire_type;
diff --git a/shared-bindings/bitbangio/SPI.h b/shared-bindings/bitbangio/SPI.h
index c4b10b666..645f1a39c 100644
--- a/shared-bindings/bitbangio/SPI.h
+++ b/shared-bindings/bitbangio/SPI.h
@@ -30,7 +30,7 @@
#include "py/obj.h"
#include "common-hal/microcontroller/Pin.h"
-#include "shared-module/bitbangio/types.h"
+#include "shared-module/bitbangio/SPI.h"
// Type object used in Python. Should be shared between ports.
extern const mp_obj_type_t bitbangio_spi_type;
diff --git a/shared-bindings/bitbangio/__init__.c b/shared-bindings/bitbangio/__init__.c
index e04bdf701..3e4d2c08e 100644
--- a/shared-bindings/bitbangio/__init__.c
+++ b/shared-bindings/bitbangio/__init__.c
@@ -36,7 +36,6 @@
#include "shared-bindings/bitbangio/I2C.h"
#include "shared-bindings/bitbangio/OneWire.h"
#include "shared-bindings/bitbangio/SPI.h"
-#include "shared-module/bitbangio/types.h"
#include "py/runtime.h"
diff --git a/shared-bindings/countio/Counter.c b/shared-bindings/countio/Counter.c
index e51db2644..820db5ea9 100644
--- a/shared-bindings/countio/Counter.c
+++ b/shared-bindings/countio/Counter.c
@@ -22,9 +22,8 @@
//|
//| For example::
//|
+//| import board
//| import countio
-//| import time
-//| from board import *
//|
//| pin_counter = countio.Counter(board.D1)
//| #reset the count after 100 counts
diff --git a/shared-bindings/nvm/ByteArray.c b/shared-bindings/nvm/ByteArray.c
index bed15c9ed..1c8a45b20 100644
--- a/shared-bindings/nvm/ByteArray.c
+++ b/shared-bindings/nvm/ByteArray.c
@@ -41,7 +41,8 @@
//| Usage::
//|
//| import microcontroller
-//| microcontroller.nvm[0:3] = b\"\xcc\x10\x00\""""
+//| microcontroller.nvm[0:3] = b"\xcc\x10\x00"
+//| """
//|
//| def __init__(self) -> None:
diff --git a/shared-bindings/usb_cdc/Serial.c b/shared-bindings/usb_cdc/Serial.c
index c813dce5b..82355f897 100644
--- a/shared-bindings/usb_cdc/Serial.c
+++ b/shared-bindings/usb_cdc/Serial.c
@@ -40,12 +40,9 @@
//|
//| def __init__(self) -> None:
//| """You cannot create an instance of `usb_cdc.Serial`.
-//|
-//| Serial objects are pre-constructed for each CDC device in the USB
-//| descriptor and added to the ``usb_cdc.ports`` tuple."""
+//| The available instances are in the ``usb_cdc.serials`` tuple."""
//| ...
//|
-
//| def read(self, size: int = 1) -> bytes:
//| """Read at most ``size`` bytes. If ``size`` exceeds the internal buffer size
//| only the bytes in the buffer will be read. If `timeout` is > 0 or ``None``,
@@ -64,6 +61,29 @@
//| :rtype: bytes"""
//| ...
//|
+//| def readline(self, size: int = -1) -> Optional[bytes]:
+//| r"""Read a line ending in a newline character ("\\n"), including the newline.
+//| Return everything readable if no newline is found and ``timeout`` is 0.
+//| Return ``None`` in case of error.
+//|
+//| This is a binary stream: the newline character "\\n" cannot be changed.
+//| If the host computer transmits "\\r" it will also be included as part of the line.
+//|
+//| :param int size: maximum number of characters to read. ``-1`` means as many as possible.
+//| :return: the line read
+//| :rtype: bytes or None"""
+//| ...
+//|
+//| def readlines(self) -> List[Optional[bytes]]:
+//| """Read multiple lines as a list, using `readline()`.
+//|
+//| .. warning:: If ``timeout`` is ``None``,
+//| `readlines()` will never return, because there is no way to indicate end of stream.
+//|
+//| :return: a list of the line read
+//| :rtype: list"""
+//| ...
+//|
//| def write(self, buf: ReadableBuffer) -> int:
//| """Write as many bytes as possible from the buffer of bytes.
//|
@@ -124,7 +144,12 @@ STATIC mp_uint_t usb_cdc_serial_ioctl_stream(mp_obj_t self_in, mp_uint_t request
}
//| connected: bool
-//| """True if this Serial is connected to a host. (read-only)"""
+//| """True if this Serial is connected to a host. (read-only)
+//|
+//| .. note:: The host is considered to be connected if it is asserting DTR (Data Terminal Ready).
+//| Most terminal programs and ``pyserial`` assert DTR when opening a serial connection.
+//| However, the C# ``SerialPort`` API does not. You must set ``SerialPort.DtrEnable``.
+//| """
//|
STATIC mp_obj_t usb_cdc_serial_get_connected(mp_obj_t self_in) {
usb_cdc_serial_obj_t *self = MP_OBJ_TO_PTR(self_in);