Skip to content

Commit 65244d2

Browse files
cajtdpgeorge
authored andcommitted
extmod/modlwip: Fix compile error for lwIP with SLIP support.
Fixes a compile error if STM32 port is compiled with: make BOARD=(..) MICROPY_PY_LWIP=1 MICROPY_PY_LWIP_SLIP=1 `sio_send()` and `sio_tryread()` now use `mp_get_stream`. Signed-off-by: Carl Treudler <[email protected]>
1 parent a831c78 commit 65244d2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

extmod/modlwip.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,15 +127,15 @@ sio_fd_t sio_open(u8_t dvnum) {
127127
}
128128

129129
void sio_send(u8_t c, sio_fd_t fd) {
130-
mp_obj_type_t *type = mp_obj_get_type(MP_STATE_VM(lwip_slip_stream));
130+
const mp_stream_p_t *stream_p = mp_get_stream(MP_STATE_VM(lwip_slip_stream));
131131
int error;
132-
type->stream_p->write(MP_STATE_VM(lwip_slip_stream), &c, 1, &error);
132+
stream_p->write(MP_STATE_VM(lwip_slip_stream), &c, 1, &error);
133133
}
134134

135135
u32_t sio_tryread(sio_fd_t fd, u8_t *data, u32_t len) {
136-
mp_obj_type_t *type = mp_obj_get_type(MP_STATE_VM(lwip_slip_stream));
136+
const mp_stream_p_t *stream_p = mp_get_stream(MP_STATE_VM(lwip_slip_stream));
137137
int error;
138-
mp_uint_t out_sz = type->stream_p->read(MP_STATE_VM(lwip_slip_stream), data, len, &error);
138+
mp_uint_t out_sz = stream_p->read(MP_STATE_VM(lwip_slip_stream), data, len, &error);
139139
if (out_sz == MP_STREAM_ERROR) {
140140
if (mp_is_nonblocking_error(error)) {
141141
return 0;

0 commit comments

Comments
 (0)