spi bus synchronization moved to user application because needed in case
of shared bus only
This commit is contained in:
parent
0cb80bccd4
commit
88ac20f673
|
|
@ -57,11 +57,10 @@
|
|||
static SYS_CONFIG SysConfig;
|
||||
|
||||
|
||||
#define SPI_LOCK_TIMEOUT_MS (1000)
|
||||
|
||||
#define NETWORK_START_TIMEOUT (60)
|
||||
|
||||
SemaphoreHandle_t xSemaphoreSPIHandle = NULL;
|
||||
StaticSemaphore_t xSemaphoreSPIBuf;
|
||||
|
||||
|
||||
static int NetworkStartTimeout = 0;
|
||||
static bool isUserAppNeedReset = false;
|
||||
|
|
@ -181,33 +180,12 @@ static void InitSysIO(void)
|
|||
|
||||
}
|
||||
|
||||
void spi_device_init_custom(void)
|
||||
{
|
||||
xSemaphoreSPIHandle = xSemaphoreCreateBinaryStatic(&xSemaphoreSPIBuf);
|
||||
xSemaphoreGive(xSemaphoreSPIHandle);
|
||||
}
|
||||
|
||||
esp_err_t spi_device_polling_transmit_synchronized(spi_device_handle_t handle, spi_transaction_t *trans_desc)
|
||||
{
|
||||
esp_err_t res;
|
||||
if (xSemaphoreTake(xSemaphoreSPIHandle,pdMS_TO_TICKS(SPI_LOCK_TIMEOUT_MS)) == pdTRUE)
|
||||
{
|
||||
res = spi_device_polling_transmit(handle, trans_desc);
|
||||
xSemaphoreGive(xSemaphoreSPIHandle);
|
||||
}
|
||||
else
|
||||
{
|
||||
res = ESP_ERR_TIMEOUT;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
static void InitSysSPI(void)
|
||||
{
|
||||
#ifdef CONFIG_WEBGUIAPP_SPI_ENABLE
|
||||
|
||||
|
||||
spi_device_init_custom();
|
||||
//spi_device_init_custom();
|
||||
spi_bus_config_t buscfg = {
|
||||
.miso_io_num = CONFIG_SPI_MISO_GPIO,
|
||||
.mosi_io_num = CONFIG_SPI_MOSI_GPIO,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user