Skip to content

Expose the any() method to python #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: esp8266-softuart
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions ports/esp8266/machine_softuart.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,12 @@ STATIC mp_obj_t pyb_softuart_flush(mp_obj_t self_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(pyb_softuart_flush_obj, pyb_softuart_flush);

STATIC mp_obj_t pyb_softuart_any(mp_obj_t self_in) {
pyb_softuart_obj_t *self = MP_OBJ_TO_PTR(self_in);
return MP_OBJ_NEW_SMALL_INT(Softuart_rx_any(self->softuart_ptr));
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_softuart_any_obj, pyb_softuart_any);

STATIC const mp_rom_map_elem_t pyb_softuart_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&pyb_softuart_init_obj) },
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&pyb_softuart_deinit_obj) },
Expand All @@ -241,6 +247,7 @@ STATIC const mp_rom_map_elem_t pyb_softuart_locals_dict_table[] = {
{ 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) },
{ MP_ROM_QSTR(MP_QSTR_write), MP_ROM_PTR(&mp_stream_write_obj) },
{ MP_ROM_QSTR(MP_QSTR_any), MP_ROM_PTR(&pyb_softuart_any_obj) },

};
STATIC MP_DEFINE_CONST_DICT(pyb_softuart_locals_dict, pyb_softuart_locals_dict_table);
Expand Down