From 88ac20f673651500d2aae86b193524a0d17bb57b Mon Sep 17 00:00:00 2001 From: Bogdan Pilyugin Date: Fri, 7 Oct 2022 16:34:45 +0200 Subject: [PATCH] spi bus synchronization moved to user application because needed in case of shared bus only --- src/SystemConfiguration.c | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/src/SystemConfiguration.c b/src/SystemConfiguration.c index c9f2e1c..029e9be 100644 --- a/src/SystemConfiguration.c +++ b/src/SystemConfiguration.c @@ -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,