From 1ae49f8263877ca12c241453c5d813f9b1fca9db Mon Sep 17 00:00:00 2001 From: cyberman54 Date: Wed, 23 Dec 2020 16:30:25 +0100 Subject: [PATCH] add spi deinit for sleep --- include/spislave.h | 4 ++-- src/spislave.cpp | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/spislave.h b/include/spislave.h index e4b71f02..78b7a737 100644 --- a/include/spislave.h +++ b/include/spislave.h @@ -27,10 +27,10 @@ licenses. Refer to LICENSE.txt file in repository for more details. #include "globals.h" #include "rcommand.h" -esp_err_t spi_init(); - extern TaskHandle_t spiTask; +esp_err_t spi_init(); +void spi_deinit(void); void spi_enqueuedata(MessageBuffer_t *message); uint32_t spi_queuewaiting(void); void spi_queuereset(void); diff --git a/src/spislave.cpp b/src/spislave.cpp index 57b36614..d0778384 100644 --- a/src/spislave.cpp +++ b/src/spislave.cpp @@ -106,7 +106,9 @@ void spi_slave_task(void *param) { } } -esp_err_t spi_init() { +void spi_deinit(void) { vTaskDelete(spiTask); } + +esp_err_t spi_init(void) { _ASSERT(SEND_QUEUE_SIZE > 0); SPISendQueue = xQueueCreate(SEND_QUEUE_SIZE, sizeof(MessageBuffer_t)); if (SPISendQueue == 0) {