GPIO descriptor fixes (#578)

This commit is contained in:
Ken Van Hoeylandt
2026-07-22 22:43:34 +02:00
committed by GitHub
parent a3fda9ad8f
commit 8b92aa8e5a
116 changed files with 376 additions and 541 deletions
+9 -5
View File
@@ -1,13 +1,14 @@
// SPDX-License-Identifier: Apache-2.0
#include <drivers/cst66xx.h>
#include <cst66xx_module.h>
#include <tactility/check.h>
#include <tactility/delay.h>
#include <tactility/device.h>
#include <tactility/driver.h>
#include <tactility/drivers/gpio.h>
#include <tactility/drivers/gpio_controller.h>
#include <tactility/drivers/gpio_descriptor.h>
#include <tactility/drivers/i2c_controller.h>
#include <tactility/drivers/pointer.h>
#include <tactility/error.h>
@@ -61,15 +62,18 @@ static void perform_hardware_reset(const Cst66xxConfig* config) {
return;
}
auto* rst = gpio_descriptor_acquire(config->pin_reset.gpio_controller, config->pin_reset.pin, GPIO_OWNER_GPIO);
// Not requesting GPIO_FLAG_ACTIVE_LOW here: some GPIO expanders (e.g. xl9555/tca95xx/
// tca9534) can only invert what's read back from an input, not what's driven on an
// output, so they reject ACTIVE_LOW combined with OUTPUT. Drive the raw physical level
// instead: this pin's reset line is active-low, so low asserts and high releases.
auto* rst = gpio_descriptor_acquire(config->pin_reset.gpio_controller, config->pin_reset.pin, GPIO_FLAG_DIRECTION_OUTPUT, GPIO_OWNER_GPIO);
if (rst == nullptr) {
return;
}
gpio_descriptor_set_flags(rst, GPIO_FLAG_DIRECTION_OUTPUT);
gpio_descriptor_set_level(rst, config->reset_active_high);
gpio_descriptor_set_level(rst, false);
delay_millis(10);
gpio_descriptor_set_level(rst, !config->reset_active_high);
gpio_descriptor_set_level(rst, true);
gpio_descriptor_release(rst);
// The reset pulse exits boot mode; give the controller time to re-init.
delay_millis(80);