fix signed/unsigned compilation problem
This commit is contained in:
parent
d3d9e0a487
commit
01a8a95b2c
|
@ -117,7 +117,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(keypad_keys_scan_obj, keypad_keys_scan);
|
|||
STATIC mp_obj_t keypad_keys_state(mp_obj_t self_in, mp_obj_t key_num_obj) {
|
||||
keypad_keys_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
mp_int_t key_num = mp_obj_int_get_checked(key_num_obj);
|
||||
if (key_num < 0 || key_num >= common_hal_keypad_keys_length(self)) {
|
||||
if (key_num < 0 || (mp_uint_t)key_num >= common_hal_keypad_keys_length(self)) {
|
||||
mp_raise_ValueError_varg(translate("%q out of range"), MP_QSTR_key_num);
|
||||
}
|
||||
|
||||
|
|
|
@ -106,13 +106,13 @@ size_t common_hal_keypad_keys_length(keypad_keys_obj_t *self) {
|
|||
|
||||
bool common_hal_keypad_keys_scan(keypad_keys_obj_t *self) {
|
||||
uint64_t now = port_get_raw_ticks(NULL);
|
||||
uint64_t last_scan_ticks = self->last_scan_ticks;
|
||||
self->last_scan_ticks = now;
|
||||
if (now - last_scan_ticks < DEBOUNCE_TICKS) {
|
||||
if (now - self->last_scan_ticks < DEBOUNCE_TICKS) {
|
||||
// Too soon.
|
||||
return false;
|
||||
}
|
||||
|
||||
self->last_scan_ticks = now;
|
||||
|
||||
for (mp_uint_t key_num = 0; key_num < common_hal_keypad_keys_length(self); key_num++) {
|
||||
self->previously_pressed[key_num] = self->currently_pressed[key_num];
|
||||
self->currently_pressed[key_num] =
|
||||
|
|
Loading…
Reference in New Issue