Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
5c00757a
Commit
5c00757a
authored
Sep 07, 2014
by
Damien George
Browse files
stmhal: uart ioctl uses EINVAL, and checks TXE bit for write-ability.
parent
013d53c0
Changes
1
Hide whitespace changes
Inline
Side-by-side
stmhal/uart.c
View file @
5c00757a
...
...
@@ -27,6 +27,7 @@
#include
<stdio.h>
#include
<string.h>
#include
<stdarg.h>
#include
<errno.h>
#include
"stm32f4xx_hal.h"
...
...
@@ -488,12 +489,11 @@ mp_uint_t uart_ioctl(mp_obj_t self_in, mp_uint_t request, int *errcode, ...) {
if
((
flags
&
MP_IOCTL_POLL_RD
)
&&
uart_rx_any
(
self
))
{
ret
|=
MP_IOCTL_POLL_RD
;
}
if
(
flags
&
MP_IOCTL_POLL_WR
)
{
// TODO can we always write?
if
((
flags
&
MP_IOCTL_POLL_WR
)
&&
__HAL_UART_GET_FLAG
(
&
self
->
uart
,
UART_FLAG_TXE
))
{
ret
|=
MP_IOCTL_POLL_WR
;
}
}
else
{
*
errcode
=
1
;
// EPERM, operation not permitted
*
errcode
=
EINVAL
;
ret
=
-
1
;
}
va_end
(
vargs
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment