mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-08-18 07:55:06 +00:00
- 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)
52 lines
1.5 KiB
C
52 lines
1.5 KiB
C
// SPDX-License-Identifier: Apache-2.0
|
|
#pragma once
|
|
|
|
#include <driver/spi_common.h>
|
|
#include <tactility/drivers/spi_controller.h>
|
|
#include <tactility/drivers/gpio.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
struct Esp32SpiConfig {
|
|
spi_host_device_t host;
|
|
/** Clock pin */
|
|
struct GpioPinSpec pin_sclk;
|
|
/** Data 0 pin */
|
|
struct GpioPinSpec pin_mosi;
|
|
/** Data 1 pin */
|
|
struct GpioPinSpec pin_miso;
|
|
/** Data 2 pin */
|
|
struct GpioPinSpec pin_wp;
|
|
/** Data 3 pin */
|
|
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
|