aboutsummaryrefslogtreecommitdiff
path: root/stmhal
diff options
context:
space:
mode:
authorPaul Sokolovsky2016-06-18 18:19:24 +0300
committerPaul Sokolovsky2016-06-18 18:44:57 +0300
commit07209f8592f15435d6abbccaad5347cea2c7722e (patch)
treea009978926973dc9bb1365872f4313435df57259 /stmhal
parent080137961daef9a1b0fe1f37f54a820842728442 (diff)
all: Rename mp_obj_type_t::stream_p to protocol.
It's now used for more than just stream protocol (e.g. pin protocol), so don't use false names.
Diffstat (limited to 'stmhal')
-rw-r--r--stmhal/can.c2
-rw-r--r--stmhal/moduselect.c5
-rw-r--r--stmhal/modusocket.c2
-rw-r--r--stmhal/pybstdio.c4
-rw-r--r--stmhal/uart.c2
-rw-r--r--stmhal/usb.c4
6 files changed, 10 insertions, 9 deletions
diff --git a/stmhal/can.c b/stmhal/can.c
index 262c487f6..88d66b653 100644
--- a/stmhal/can.c
+++ b/stmhal/can.c
@@ -888,7 +888,7 @@ const mp_obj_type_t pyb_can_type = {
.name = MP_QSTR_CAN,
.print = pyb_can_print,
.make_new = pyb_can_make_new,
- .stream_p = &can_stream_p,
+ .protocol = &can_stream_p,
.locals_dict = (mp_obj_t)&pyb_can_locals_dict,
};
diff --git a/stmhal/moduselect.c b/stmhal/moduselect.c
index e87478ae6..92e77e6ca 100644
--- a/stmhal/moduselect.c
+++ b/stmhal/moduselect.c
@@ -53,12 +53,13 @@ STATIC void poll_map_add(mp_map_t *poll_map, const mp_obj_t *obj, mp_uint_t obj_
if (elem->value == NULL) {
// object not found; get its ioctl and add it to the poll list
mp_obj_type_t *type = mp_obj_get_type(obj[i]);
- if (type->stream_p == NULL || type->stream_p->ioctl == NULL) {
+ const mp_stream_p_t *stream_p = type->protocol;
+ if (stream_p == NULL || stream_p->ioctl == NULL) {
nlr_raise(mp_obj_new_exception_msg(&mp_type_TypeError, "object with stream.ioctl required"));
}
poll_obj_t *poll_obj = m_new_obj(poll_obj_t);
poll_obj->obj = obj[i];
- poll_obj->ioctl = type->stream_p->ioctl;
+ poll_obj->ioctl = stream_p->ioctl;
poll_obj->flags = flags;
poll_obj->flags_ret = 0;
elem->value = poll_obj;
diff --git a/stmhal/modusocket.c b/stmhal/modusocket.c
index 9cc1f3314..fbd119644 100644
--- a/stmhal/modusocket.c
+++ b/stmhal/modusocket.c
@@ -376,7 +376,7 @@ STATIC const mp_obj_type_t socket_type = {
{ &mp_type_type },
.name = MP_QSTR_socket,
.make_new = socket_make_new,
- .stream_p = &socket_stream_p,
+ .protocol = &socket_stream_p,
.locals_dict = (mp_obj_t)&socket_locals_dict,
};
diff --git a/stmhal/pybstdio.c b/stmhal/pybstdio.c
index 352b7c10c..cf31f53ac 100644
--- a/stmhal/pybstdio.c
+++ b/stmhal/pybstdio.c
@@ -123,7 +123,7 @@ STATIC const mp_obj_type_t stdio_obj_type = {
.print = stdio_obj_print,
.getiter = mp_identity,
.iternext = mp_stream_unbuffered_iter,
- .stream_p = &stdio_obj_stream_p,
+ .protocol = &stdio_obj_stream_p,
.locals_dict = (mp_obj_t)&stdio_locals_dict,
};
@@ -156,7 +156,7 @@ STATIC const mp_obj_type_t stdio_buffer_obj_type = {
.print = stdio_obj_print,
.getiter = mp_identity,
.iternext = mp_stream_unbuffered_iter,
- .stream_p = &stdio_buffer_obj_stream_p,
+ .protocol = &stdio_buffer_obj_stream_p,
.locals_dict = (mp_obj_t)&stdio_locals_dict,
};
diff --git a/stmhal/uart.c b/stmhal/uart.c
index 210330e81..cbcb7c059 100644
--- a/stmhal/uart.c
+++ b/stmhal/uart.c
@@ -933,6 +933,6 @@ const mp_obj_type_t pyb_uart_type = {
.make_new = pyb_uart_make_new,
.getiter = mp_identity,
.iternext = mp_stream_unbuffered_iter,
- .stream_p = &uart_stream_p,
+ .protocol = &uart_stream_p,
.locals_dict = (mp_obj_t)&pyb_uart_locals_dict,
};
diff --git a/stmhal/usb.c b/stmhal/usb.c
index b786fb758..4ef6bfa50 100644
--- a/stmhal/usb.c
+++ b/stmhal/usb.c
@@ -530,7 +530,7 @@ const mp_obj_type_t pyb_usb_vcp_type = {
.make_new = pyb_usb_vcp_make_new,
.getiter = mp_identity,
.iternext = mp_stream_unbuffered_iter,
- .stream_p = &pyb_usb_vcp_stream_p,
+ .protocol = &pyb_usb_vcp_stream_p,
.locals_dict = (mp_obj_t)&pyb_usb_vcp_locals_dict,
};
@@ -614,7 +614,7 @@ const mp_obj_type_t pyb_usb_hid_type = {
{ &mp_type_type },
.name = MP_QSTR_USB_HID,
.make_new = pyb_usb_hid_make_new,
- .stream_p = &pyb_usb_hid_stream_p,
+ .protocol = &pyb_usb_hid_stream_p,
.locals_dict = (mp_obj_t)&pyb_usb_hid_locals_dict,
};