esp32s2: Introduce, use NO_PIN

GPIO_NUM_NC is -1 so it's equivalent to the existing code.
This commit is contained in:
Jeff Epler 2021-05-13 11:12:23 -05:00
parent f26528dfa6
commit 6750d3feab
2 changed files with 4 additions and 2 deletions

View File

@ -51,7 +51,7 @@ STATIC void floating_gpio_reset(gpio_num_t pin_number) {
}
void never_reset_pin_number(gpio_num_t pin_number) {
if (pin_number == -1) {
if (pin_number == NO_PIN) {
return;
}
never_reset_pins[pin_number / 32] |= 1 << pin_number % 32;
@ -63,7 +63,7 @@ void common_hal_never_reset_pin(const mcu_pin_obj_t *pin) {
// Mark pin as free and return it to a quiescent state.
void reset_pin_number(gpio_num_t pin_number) {
if (pin_number == -1) {
if (pin_number == NO_PIN) {
return;
}
never_reset_pins[pin_number / 32] &= ~(1 << pin_number % 32);

View File

@ -91,4 +91,6 @@ extern const mcu_pin_obj_t pin_GPIO44;
extern const mcu_pin_obj_t pin_GPIO45;
extern const mcu_pin_obj_t pin_GPIO46;
#define NO_PIN (GPIO_NUM_NC)
#endif // MICROPY_INCLUDED_ESP32S2_PERIPHERALS_PINS_H