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) {