diff options
author | Damien George <damien.p.george@gmail.com> | 2016-12-02 16:37:29 +1100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2016-12-02 16:37:29 +1100 |
commit | 304cfda8c466920b1d29903bfca8bca5ed110f3b (patch) | |
tree | 1a6e2aec1e3da97d6e50512c4923a404087bd932 /stmhal/can.c | |
parent | 6194336d81e73e74eb7e0f26501966082ce4d411 (diff) | |
download | micropython-304cfda8c466920b1d29903bfca8bca5ed110f3b.tar.gz micropython-304cfda8c466920b1d29903bfca8bca5ed110f3b.zip |
py/stream: Move ad-hoc ioctl constants to stream.h and rename them.
The constants MP_IOCTL_POLL_xxx, which were stmhal-specific, are moved
from stmhal/pybioctl.h (now deleted) to py/stream.h. And they are renamed
to MP_STREAM_POLL_xxx to be consistent with other such constants.
All uses of these constants have been updated.
Diffstat (limited to 'stmhal/can.c')
-rw-r--r-- | stmhal/can.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/stmhal/can.c b/stmhal/can.c index a8ec7930ef..3157bfadcf 100644 --- a/stmhal/can.c +++ b/stmhal/can.c @@ -32,11 +32,11 @@ #include "py/objtuple.h" #include "py/runtime.h" #include "py/gc.h" +#include "py/stream.h" #include "py/mperrno.h" #include "py/mphal.h" #include "bufhelper.h" #include "can.h" -#include "pybioctl.h" #include "irq.h" #if MICROPY_HW_ENABLE_CAN @@ -807,16 +807,16 @@ STATIC MP_DEFINE_CONST_DICT(pyb_can_locals_dict, pyb_can_locals_dict_table); mp_uint_t can_ioctl(mp_obj_t self_in, mp_uint_t request, mp_uint_t arg, int *errcode) { pyb_can_obj_t *self = self_in; mp_uint_t ret; - if (request == MP_IOCTL_POLL) { + if (request == MP_STREAM_POLL) { mp_uint_t flags = arg; ret = 0; - if ((flags & MP_IOCTL_POLL_RD) + if ((flags & MP_STREAM_POLL_RD) && ((__HAL_CAN_MSG_PENDING(&self->can, CAN_FIFO0) != 0) || (__HAL_CAN_MSG_PENDING(&self->can, CAN_FIFO1) != 0))) { - ret |= MP_IOCTL_POLL_RD; + ret |= MP_STREAM_POLL_RD; } - if ((flags & MP_IOCTL_POLL_WR) && (self->can.Instance->TSR & CAN_TSR_TME)) { - ret |= MP_IOCTL_POLL_WR; + if ((flags & MP_STREAM_POLL_WR) && (self->can.Instance->TSR & CAN_TSR_TME)) { + ret |= MP_STREAM_POLL_WR; } } else { *errcode = MP_EINVAL; |