File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -100,20 +100,18 @@ STATIC mp_obj_t canio_listener_iter(mp_obj_t self_in) {
100100STATIC MP_DEFINE_CONST_FUN_OBJ_1 (canio_listener_iter_obj , canio_listener_iter );
101101
102102//| def __next__(self):
103- //| """Returns the next waiting message, if one is available
104- //|
105- //| If the object is deinitialized, raises ValueError.
103+ //| """Reads a message, after waiting up to self.timeout seconds
106104//|
107- //| If no message is waiting raises StopIteration"""
105+ //| If no message is received in time, raises StopIteration. Otherwise,
106+ //| a Message is returned."""
108107//| ...
109108//|
110109STATIC mp_obj_t canio_listener_next (mp_obj_t self_in ) {
111- canio_listener_obj_t * self = MP_OBJ_TO_PTR (self_in );
112- common_hal_canio_listener_check_for_deinit (self );
113- if (common_hal_canio_listener_in_waiting (self )) {
114- return canio_listener_read (self_in );
110+ mp_obj_t result = canio_listener_read (self_in );
111+ if (result == mp_const_none ) {
112+ return MP_OBJ_STOP_ITERATION ;
115113 }
116- return MP_OBJ_STOP_ITERATION ;
114+ return result ;
117115}
118116STATIC MP_DEFINE_CONST_FUN_OBJ_1 (canio_listener_next_obj , canio_listener_next );
119117
You can’t perform that action at this time.
0 commit comments