rp2/machine_pin: Use 64-bit gpio functions to allow gpios >=32 to work.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Peter Harper 2024-07-10 12:44:59 +01:00 committed by Damien George
parent 4af09de19c
commit 733052f6b9
1 changed files with 4 additions and 4 deletions

View File

@ -297,7 +297,7 @@ static mp_obj_t machine_pin_obj_init_helper(const machine_pin_obj_t *self, size_
mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("invalid pin af: %d"), af); mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("invalid pin af: %d"), af);
} }
gpio_set_function(self->id, af); gpio_set_function(self->id, af);
machine_pin_open_drain_mask &= ~(1 << self->id); machine_pin_open_drain_mask &= ~(1ULL << self->id);
} }
} }
@ -379,7 +379,7 @@ static mp_obj_t machine_pin_low(mp_obj_t self_in) {
} else if (GPIO_IS_OPEN_DRAIN(self->id)) { } else if (GPIO_IS_OPEN_DRAIN(self->id)) {
gpio_set_dir(self->id, GPIO_OUT); gpio_set_dir(self->id, GPIO_OUT);
} else { } else {
gpio_clr_mask(1u << self->id); gpio_clr_mask64(1ULL << self->id);
} }
return mp_const_none; return mp_const_none;
} }
@ -395,7 +395,7 @@ static mp_obj_t machine_pin_high(mp_obj_t self_in) {
} else if (GPIO_IS_OPEN_DRAIN(self->id)) { } else if (GPIO_IS_OPEN_DRAIN(self->id)) {
gpio_set_dir(self->id, GPIO_IN); gpio_set_dir(self->id, GPIO_IN);
} else { } else {
gpio_set_mask(1u << self->id); gpio_set_mask64(1ULL << self->id);
} }
return mp_const_none; return mp_const_none;
} }
@ -416,7 +416,7 @@ static mp_obj_t machine_pin_toggle(mp_obj_t self_in) {
gpio_set_dir(self->id, GPIO_OUT); gpio_set_dir(self->id, GPIO_OUT);
} }
} else { } else {
gpio_xor_mask(1u << self->id); gpio_xor_mask64(1ULL << self->id);
} }
return mp_const_none; return mp_const_none;
} }