GPIO refactored (#495)
* **Refactor** * GPIO subsystem moved to a descriptor-based model for per-pin ownership and runtime pin management; many platform drivers now acquire/release descriptors. * Device trees and drivers now use GPIO phandle-style pin specifications across all boards and all drivers. * **Behavior** * Device list now encodes per-device status (ok/disabled); boot will skip disabled devices accordingly. * **Deprecation** * Legacy GPIO HAL marked deprecated and replaced with descriptor-based interfaces. * **Chores** * Bindings and platform configs updated to the new GPIO pin-spec format.
This commit is contained in:
committed by
GitHub
parent
dff93cb655
commit
26c17986c6
@@ -9,6 +9,16 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define GPIO_ACTIVE_HIGH GPIO_FLAG_ACTIVE_HIGH
|
||||
#define GPIO_ACTIVE_LOW GPIO_FLAG_ACTIVE_LOW
|
||||
|
||||
#define GPIO_DIRECTION_INPUT GPIO_FLAG_DIRECTION_INPUT
|
||||
#define GPIO_DIRECTION_OUTPUT GPIO_FLAG_DIRECTION_OUTPUT
|
||||
#define GPIO_DIRECTION_INPUT_OUTPUT GPIO_FLAG_DIRECTION_INPUT_OUTPUT
|
||||
|
||||
#define GPIO_PULL_UP GPIO_FLAG_PULL_UP
|
||||
#define GPIO_PULL_DOWN GPIO_FLAG_PULL_DOWN
|
||||
|
||||
DEFINE_DEVICETREE(esp32_gpio, struct Esp32GpioConfig)
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <tactility/bindings/bindings.h>
|
||||
#include <tactility/drivers/esp32_i2s.h>
|
||||
#include <tactility/drivers/esp32_gpio.h>
|
||||
#include <driver/i2s_common.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -11,13 +11,10 @@ extern "C" {
|
||||
struct Esp32I2cConfig {
|
||||
i2c_port_t port;
|
||||
uint32_t clockFrequency;
|
||||
gpio_pin_t pinSda;
|
||||
gpio_pin_t pinScl;
|
||||
bool pinSdaPullUp;
|
||||
bool pinSclPullUp;
|
||||
struct GpioPinSpec pinSda;
|
||||
struct GpioPinSpec pinScl;
|
||||
};
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <tactility/drivers/i2s_controller.h>
|
||||
#include <tactility/drivers/gpio.h>
|
||||
#include <driver/i2s_common.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -10,11 +11,11 @@ extern "C" {
|
||||
|
||||
struct Esp32I2sConfig {
|
||||
i2s_port_t port;
|
||||
int pin_bclk;
|
||||
int pin_ws;
|
||||
int pin_data_out;
|
||||
int pin_data_in;
|
||||
int pin_mclk;
|
||||
struct GpioPinSpec pin_bclk;
|
||||
struct GpioPinSpec pin_ws;
|
||||
struct GpioPinSpec pin_data_out;
|
||||
struct GpioPinSpec pin_data_in;
|
||||
struct GpioPinSpec pin_mclk;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <driver/spi_common.h>
|
||||
#include <tactility/drivers/spi_controller.h>
|
||||
#include <tactility/drivers/gpio.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -10,16 +11,16 @@ extern "C" {
|
||||
|
||||
struct Esp32SpiConfig {
|
||||
spi_host_device_t host;
|
||||
/** Data 0 pin */
|
||||
int pin_mosi;
|
||||
/** Data 1 pin */
|
||||
int pin_miso;
|
||||
/** Clock pin */
|
||||
int pin_sclk;
|
||||
struct GpioPinSpec pin_sclk;
|
||||
/** Data 0 pin */
|
||||
struct GpioPinSpec pin_mosi;
|
||||
/** Data 1 pin */
|
||||
struct GpioPinSpec pin_miso;
|
||||
/** Data 2 pin */
|
||||
int pin_wp;
|
||||
struct GpioPinSpec pin_wp;
|
||||
/** Data 3 pin */
|
||||
int pin_hd;
|
||||
struct GpioPinSpec pin_hd;
|
||||
/** Data transfer size limit in bytes. 0 means the platform decides the limit. */
|
||||
int max_transfer_size;
|
||||
};
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <driver/uart.h>
|
||||
#include <tactility/drivers/uart_controller.h>
|
||||
#include <tactility/drivers/gpio.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -10,10 +11,10 @@ extern "C" {
|
||||
|
||||
struct Esp32UartConfig {
|
||||
uart_port_t port;
|
||||
int pinTx;
|
||||
int pinRx;
|
||||
int pinCts;
|
||||
int pinRts;
|
||||
struct GpioPinSpec pin_tx;
|
||||
struct GpioPinSpec pin_rx;
|
||||
struct GpioPinSpec pin_cts;
|
||||
struct GpioPinSpec pin_rts;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
Reference in New Issue
Block a user