File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed
Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -117,7 +117,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(keypad_keys_scan_obj, keypad_keys_scan);
117117STATIC mp_obj_t keypad_keys_state (mp_obj_t self_in , mp_obj_t key_num_obj ) {
118118 keypad_keys_obj_t * self = MP_OBJ_TO_PTR (self_in );
119119 mp_int_t key_num = mp_obj_int_get_checked (key_num_obj );
120- if (key_num < 0 || key_num >= common_hal_keypad_keys_length (self )) {
120+ if (key_num < 0 || ( mp_uint_t ) key_num >= common_hal_keypad_keys_length (self )) {
121121 mp_raise_ValueError_varg (translate ("%q out of range" ), MP_QSTR_key_num );
122122 }
123123
Original file line number Diff line number Diff line change @@ -106,13 +106,13 @@ size_t common_hal_keypad_keys_length(keypad_keys_obj_t *self) {
106106
107107bool common_hal_keypad_keys_scan (keypad_keys_obj_t * self ) {
108108 uint64_t now = port_get_raw_ticks (NULL );
109- uint64_t last_scan_ticks = self -> last_scan_ticks ;
110- self -> last_scan_ticks = now ;
111- if (now - last_scan_ticks < DEBOUNCE_TICKS ) {
109+ if (now - self -> last_scan_ticks < DEBOUNCE_TICKS ) {
112110 // Too soon.
113111 return false;
114112 }
115113
114+ self -> last_scan_ticks = now ;
115+
116116 for (mp_uint_t key_num = 0 ; key_num < common_hal_keypad_keys_length (self ); key_num ++ ) {
117117 self -> previously_pressed [key_num ] = self -> currently_pressed [key_num ];
118118 self -> currently_pressed [key_num ] =
You can’t perform that action at this time.
0 commit comments