add spi deinit for sleep

This commit is contained in:
cyberman54 2020-12-23 16:30:25 +01:00
parent f93594e964
commit 1ae49f8263
2 changed files with 5 additions and 3 deletions

View File

@ -27,10 +27,10 @@ licenses. Refer to LICENSE.txt file in repository for more details.
#include "globals.h" #include "globals.h"
#include "rcommand.h" #include "rcommand.h"
esp_err_t spi_init();
extern TaskHandle_t spiTask; extern TaskHandle_t spiTask;
esp_err_t spi_init();
void spi_deinit(void);
void spi_enqueuedata(MessageBuffer_t *message); void spi_enqueuedata(MessageBuffer_t *message);
uint32_t spi_queuewaiting(void); uint32_t spi_queuewaiting(void);
void spi_queuereset(void); void spi_queuereset(void);

View File

@ -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); _ASSERT(SEND_QUEUE_SIZE > 0);
SPISendQueue = xQueueCreate(SEND_QUEUE_SIZE, sizeof(MessageBuffer_t)); SPISendQueue = xQueueCreate(SEND_QUEUE_SIZE, sizeof(MessageBuffer_t));
if (SPISendQueue == 0) { if (SPISendQueue == 0) {