Skip to content

Commit 01a8a95

Browse files
committed
fix signed/unsigned compilation problem
1 parent d3d9e0a commit 01a8a95

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

shared-bindings/keypad/Keys.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(keypad_keys_scan_obj, keypad_keys_scan);
117117
STATIC 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

shared-module/keypad/Keys.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,13 @@ size_t common_hal_keypad_keys_length(keypad_keys_obj_t *self) {
106106

107107
bool 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] =

0 commit comments

Comments
 (0)