Driver improvements (#535)

- New drivers:
  - SD SPI
  - spi_peripheral
  - touch_placeholder
  - display_placeholder
- Devicetree compiler:
  - Implement phandle-arrays
  - Implement device addresses
- Add placeholder drivers to all devices with a SPI display
- SPI driver: add `cs-pins` and set them to high on driver start
- FileSystem: add `file_system_set_owner()` and `file_system_get_owner()`
- File locking is now checking if the related `FileSystem` is part of a shared SPI bus
- Add `device_get_child_count()`
- SDMMC driver: Remove default of `slot` value
- Fix for Crowpanel Basic 3.5" display (add delay to booting)
- Fix for LilyGO T-HMI SD card mounting (delayed mounting by disabling it initially in the dts)
This commit is contained in:
Ken Van Hoeylandt
2026-06-27 17:32:05 +02:00
committed by GitHub
parent e50659a3fb
commit 599fa46766
222 changed files with 1713 additions and 2257 deletions
@@ -0,0 +1,15 @@
// SPDX-License-Identifier: Apache-2.0
#pragma once
#include <tactility/bindings/bindings.h>
#include <tactility/drivers/esp32_sdspi.h>
#ifdef __cplusplus
extern "C" {
#endif
DEFINE_DEVICETREE(esp32_sdspi, struct Esp32SdspiConfig)
#ifdef __cplusplus
}
#endif
@@ -0,0 +1,21 @@
// SPDX-License-Identifier: Apache-2.0
#pragma once
#include <sd_protocol_types.h>
#ifdef __cplusplus
extern "C" {
#endif
struct Device;
/**
* Try to get the sdmmc_card_t* for the given device.
* @param device any device.
* @return the sdmmc_card_t* if it is available for this device, otherwise return null
*/
sdmmc_card_t* esp32_sdcard_get_card(struct Device* device);
#ifdef __cplusplus
}
#endif
@@ -0,0 +1,22 @@
// SPDX-License-Identifier: Apache-2.0
#pragma once
#include <sd_protocol_types.h>
#include <tactility/drivers/gpio.h>
#ifdef __cplusplus
extern "C" {
#endif
struct Esp32SdspiConfig {
struct GpioPinSpec pin_cd;
struct GpioPinSpec pin_wp;
struct GpioPinSpec pin_int;
uint32_t frequency_khz;
};
sdmmc_card_t* esp32_sdspi_get_card(struct Device* device);
#ifdef __cplusplus
}
#endif
@@ -23,8 +23,29 @@ struct Esp32SpiConfig {
struct GpioPinSpec pin_hd;
/** Data transfer size limit in bytes. 0 means the platform decides the limit. */
int max_transfer_size;
/** Array of chip select GPIO pin specs */
struct GpioPinSpec* cs_gpios;
/** The item count of cs_gpios */
uint8_t cs_gpios_count;
};
/**
* @brief Get the CS pin spec for a child device on this SPI bus.
* Uses the child device's address as index into the parent's cs_gpios array.
* @param[in] child_device a child device of an SPI controller
* @param[out] out_pin the GPIO pin spec for the CS pin
* @retval ERROR_NONE on success
* @retval ERROR_INVALID_STATE if the parent is not an SPI controller
* @retval ERROR_OUT_OF_RANGE if the device address exceeds the cs_gpios array
*/
error_t esp32_spi_get_cs_pin(struct Device* child_device, struct GpioPinSpec* out_pin);
/**
* @brief Drive all CS pins on this SPI bus high (deselected).
* @param[in] device the SPI controller device
*/
void esp32_spi_deselect_all_cs(struct Device* device);
#ifdef __cplusplus
}
#endif