esp32s2: Add claim_pin_number

In ParallelImageCapture we need to grab a group of pins by number
This commit is contained in:
Jeff Epler 2021-06-01 20:16:30 -05:00
parent 1d03ec12b5
commit 3e83834621
2 changed files with 8 additions and 0 deletions

View File

@ -96,6 +96,13 @@ void reset_all_pins(void) {
in_use[1] = 0;
}
void claim_pin_number(gpio_num_t pin_number) {
if (pin_number == NO_PIN) {
return;
}
in_use[pin_number / 32] |= (1 << (pin_number % 32));
}
void claim_pin(const mcu_pin_obj_t *pin) {
in_use[pin->number / 32] |= (1 << (pin->number % 32));
}

View File

@ -37,6 +37,7 @@ void reset_all_pins(void);
void reset_pin_number(gpio_num_t pin_number);
void common_hal_reset_pin(const mcu_pin_obj_t *pin);
void claim_pin(const mcu_pin_obj_t *pin);
void claim_pin_number(gpio_num_t pin_number);
bool pin_number_is_free(gpio_num_t pin_number);
void never_reset_pin_number(gpio_num_t pin_number);