diff options
author | Damien George <damien.p.george@gmail.com> | 2016-05-10 23:22:54 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2016-05-10 23:30:39 +0100 |
commit | 5ab98d5c41bffa799a551a2731d904cab346898e (patch) | |
tree | 3e69611c73314b7e7c374172a9118e76e4b43dce /stmhal/uart.c | |
parent | 088127d91cb593990cf4f04e64ca452671041e6f (diff) | |
download | micropython-5ab98d5c41bffa799a551a2731d904cab346898e.tar.gz micropython-5ab98d5c41bffa799a551a2731d904cab346898e.zip |
stmhal: Convert to use internal errno symbols; enable uerrno module.
Diffstat (limited to 'stmhal/uart.c')
-rw-r--r-- | stmhal/uart.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/stmhal/uart.c b/stmhal/uart.c index 108236ca1a..2b6f1e40d8 100644 --- a/stmhal/uart.c +++ b/stmhal/uart.c @@ -27,11 +27,11 @@ #include <stdio.h> #include <string.h> #include <stdarg.h> -#include <errno.h> #include "py/nlr.h" #include "py/runtime.h" #include "py/stream.h" +#include "py/mperrno.h" #include "py/mphal.h" #include "uart.h" #include "pybioctl.h" @@ -829,7 +829,7 @@ STATIC mp_uint_t pyb_uart_read(mp_obj_t self_in, void *buf_in, mp_uint_t size, i // check that size is a multiple of character width if (size & self->char_width) { - *errcode = EIO; + *errcode = MP_EIO; return MP_STREAM_ERROR; } @@ -844,7 +844,7 @@ STATIC mp_uint_t pyb_uart_read(mp_obj_t self_in, void *buf_in, mp_uint_t size, i // wait for first char to become available if (!uart_rx_wait(self, self->timeout)) { // return EAGAIN error to indicate non-blocking (then read() method returns None) - *errcode = EAGAIN; + *errcode = MP_EAGAIN; return MP_STREAM_ERROR; } @@ -871,13 +871,13 @@ STATIC mp_uint_t pyb_uart_write(mp_obj_t self_in, const void *buf_in, mp_uint_t // check that size is a multiple of character width if (size & self->char_width) { - *errcode = EIO; + *errcode = MP_EIO; return MP_STREAM_ERROR; } // wait to be able to write the first character. EAGAIN causes write to return None if (!uart_tx_wait(self, self->timeout)) { - *errcode = EAGAIN; + *errcode = MP_EAGAIN; return MP_STREAM_ERROR; } @@ -917,7 +917,7 @@ STATIC mp_uint_t pyb_uart_ioctl(mp_obj_t self_in, mp_uint_t request, mp_uint_t a ret |= MP_IOCTL_POLL_WR; } } else { - *errcode = EINVAL; + *errcode = MP_EINVAL; ret = MP_STREAM_ERROR; } return ret; |