summaryrefslogtreecommitdiff
path: root/shared-bindings/canio
diff options
context:
space:
mode:
authormicroDev <70126934+microDev1@users.noreply.github.com>2020-11-08 00:00:01 +0530
committermicroDev <70126934+microDev1@users.noreply.github.com>2020-11-08 00:00:01 +0530
commit479567059e2bb60e2fd5a2d58be26df2a9e6deae (patch)
treecf218ca135a99ea99a4bc27fabe81d494153f1d9 /shared-bindings/canio
parent80029f6929ebbf6c0a02c5320e59220b0501bd55 (diff)
parent18079c5bbe403a25556e19469a349742dca49633 (diff)
Merge branch 'main' into rotaryio-S2
Diffstat (limited to 'shared-bindings/canio')
-rw-r--r--shared-bindings/canio/CAN.c27
-rw-r--r--shared-bindings/canio/Listener.c2
-rw-r--r--shared-bindings/canio/Match.c2
-rw-r--r--shared-bindings/canio/Message.c2
-rw-r--r--shared-bindings/canio/RemoteTransmissionRequest.c2
5 files changed, 26 insertions, 9 deletions
diff --git a/shared-bindings/canio/CAN.c b/shared-bindings/canio/CAN.c
index 6dae36943..13066764e 100644
--- a/shared-bindings/canio/CAN.c
+++ b/shared-bindings/canio/CAN.c
@@ -49,7 +49,7 @@
//| loopback: bool = False,
//| silent: bool = False,
//| auto_restart: bool = False,
-//| ):
+//| ) -> None:
//| """A common shared-bus protocol. The rx and tx pins are generally
//| connected to a transceiver which controls the H and L pins on a
//| shared bus.
@@ -171,7 +171,7 @@ STATIC const mp_obj_property_t canio_can_receive_error_count_obj = {
(mp_obj_t)mp_const_none},
};
-//| state: State
+//| state: BusState
//| """The current state of the bus. (read-only)"""
STATIC mp_obj_t canio_can_state_get(mp_obj_t self_in) {
canio_can_obj_t *self = MP_OBJ_TO_PTR(self_in);
@@ -214,7 +214,24 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(canio_can_restart_obj, canio_can_restart);
//|
//| An empty filter list causes all messages to be accepted.
//|
-//| Timeout dictates how long receive() and next() will block."""
+//| Timeout dictates how long receive() and next() will block.
+//|
+//| Platform specific notes:
+//|
+//| SAM E5x supports two Listeners. Filter blocks are shared between the two
+//| listeners. There are 4 standard filter blocks and 4 extended filter blocks.
+//| Each block can either match 2 single addresses or a mask of addresses.
+//| The number of filter blocks can be increased, up to a hardware maximum, by
+//| rebuilding CircuitPython, but this decreases the CircuitPython free
+//| memory even if canio is not used.
+//|
+//| STM32F405 supports two Listeners. Filter blocks are shared between the two listeners.
+//| There are 14 filter blocks. Each block can match 2 standard addresses with
+//| mask or 1 extended address with mask.
+//|
+//| ESP32S2 supports one Listener. There is a single filter block, which can either match a
+//| standard address with mask or an extended address with mask.
+//| """
//| ...
//|
STATIC mp_obj_t canio_can_listen(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
@@ -274,7 +291,7 @@ STATIC const mp_obj_property_t canio_can_loopback_obj = {
};
-//| def send(message: Union[RemoteTransmissionRequest, Message]) -> None:
+//| def send(self, message: Union[RemoteTransmissionRequest, Message]) -> None:
//| """Send a message on the bus with the given data and id.
//| If the message could not be sent due to a full fifo or a bus error condition, RuntimeError is raised.
//| """
@@ -335,7 +352,7 @@ STATIC mp_obj_t canio_can_enter(mp_obj_t self_in) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(canio_can_enter_obj, canio_can_enter);
-//| def __exit__(self, unused1, unused2, unused3) -> None:
+//| def __exit__(self, unused1: Optional[Type[BaseException]], unused2: Optional[BaseException], unused3: Optional[TracebackType]) -> None:
//| """Calls deinit()"""
//| ...
STATIC mp_obj_t canio_can_exit(size_t num_args, const mp_obj_t args[]) {
diff --git a/shared-bindings/canio/Listener.c b/shared-bindings/canio/Listener.c
index 93552af81..8a39f0f2a 100644
--- a/shared-bindings/canio/Listener.c
+++ b/shared-bindings/canio/Listener.c
@@ -123,7 +123,7 @@ STATIC mp_obj_t canio_listener_enter(mp_obj_t self_in) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(canio_listener_enter_obj, canio_listener_enter);
-//| def __exit__(self, unused1, unused2, unused3) -> None:
+//| def __exit__(self, unused1: Optional[Type[BaseException]], unused2: Optional[BaseException], unused3: Optional[TracebackType]) -> None:
//| """Calls deinit()"""
//| ...
STATIC mp_obj_t canio_listener_exit(size_t num_args, const mp_obj_t args[]) {
diff --git a/shared-bindings/canio/Match.c b/shared-bindings/canio/Match.c
index 3fbc1773e..6039631fa 100644
--- a/shared-bindings/canio/Match.c
+++ b/shared-bindings/canio/Match.c
@@ -33,7 +33,7 @@
//| """Describe CAN bus messages to match"""
//|
//|
-//| def __init__(self, id: int, *, mask: Optional[int] = None, extended: bool = False):
+//| def __init__(self, id: int, *, mask: Optional[int] = None, extended: bool = False) -> None:
//| """Construct a Match with the given properties.
//|
//| If mask is not None, then the filter is for any id which matches all
diff --git a/shared-bindings/canio/Message.c b/shared-bindings/canio/Message.c
index e47e997c7..04fa8fc6c 100644
--- a/shared-bindings/canio/Message.c
+++ b/shared-bindings/canio/Message.c
@@ -31,7 +31,7 @@
#include "py/runtime.h"
//| class Message:
-//| def __init__(self, id: int, data: bytes, *, extended: bool = False):
+//| def __init__(self, id: int, data: bytes, *, extended: bool = False) -> None:
//| """Construct a Message to send on a CAN bus.
//|
//| :param int id: The numeric ID of the message
diff --git a/shared-bindings/canio/RemoteTransmissionRequest.c b/shared-bindings/canio/RemoteTransmissionRequest.c
index d762787b1..fcd259034 100644
--- a/shared-bindings/canio/RemoteTransmissionRequest.c
+++ b/shared-bindings/canio/RemoteTransmissionRequest.c
@@ -31,7 +31,7 @@
#include "py/runtime.h"
//| class RemoteTransmissionRequest:
-//| def __init__(self, id: int, length: int, *, extended: bool = False):
+//| def __init__(self, id: int, length: int, *, extended: bool = False) -> None:
//| """Construct a RemoteTransmissionRequest to send on a CAN bus.
//|
//| :param int id: The numeric ID of the requested message