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
aca898ee
Commit
aca898ee
authored
May 17, 2017
by
Damien George
Browse files
esp8266/machine_uart: Add uart.any() method.
Returns 0 or 1, corresponding to no or at least 1 char waiting.
parent
218a876f
Changes
1
Hide whitespace changes
Inline
Side-by-side
esp8266/machine_uart.c
View file @
aca898ee
...
...
@@ -193,9 +193,16 @@ STATIC mp_obj_t pyb_uart_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_
}
MP_DEFINE_CONST_FUN_OBJ_KW
(
pyb_uart_init_obj
,
1
,
pyb_uart_init
);
STATIC
mp_obj_t
pyb_uart_any
(
mp_obj_t
self_in
)
{
pyb_uart_obj_t
*
self
=
MP_OBJ_TO_PTR
(
self_in
);
return
MP_OBJ_NEW_SMALL_INT
(
uart_rx_any
(
self
->
uart_id
));
}
STATIC
MP_DEFINE_CONST_FUN_OBJ_1
(
pyb_uart_any_obj
,
pyb_uart_any
);
STATIC
const
mp_rom_map_elem_t
pyb_uart_locals_dict_table
[]
=
{
{
MP_ROM_QSTR
(
MP_QSTR_init
),
MP_ROM_PTR
(
&
pyb_uart_init_obj
)
},
{
MP_ROM_QSTR
(
MP_QSTR_any
),
MP_ROM_PTR
(
&
pyb_uart_any_obj
)
},
{
MP_ROM_QSTR
(
MP_QSTR_read
),
MP_ROM_PTR
(
&
mp_stream_read_obj
)
},
{
MP_ROM_QSTR
(
MP_QSTR_readline
),
MP_ROM_PTR
(
&
mp_stream_unbuffered_readline_obj
)
},
{
MP_ROM_QSTR
(
MP_QSTR_readinto
),
MP_ROM_PTR
(
&
mp_stream_readinto_obj
)
},
...
...
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