spislave.cpp: compiler directives fixed

This commit is contained in:
Klaus K Wilting 2019-02-27 00:52:45 +01:00
parent 7e4a360bb7
commit b2a563c84e

View File

@ -22,6 +22,8 @@ licenses. Refer to LICENSE.txt file in repository for more details.
*/ */
#ifdef HAS_SPI
#include "spislave.h" #include "spislave.h"
#include <driver/spi_slave.h> #include <driver/spi_slave.h>
@ -102,9 +104,6 @@ void spi_slave_task(void *param) {
} }
esp_err_t spi_init() { esp_err_t spi_init() {
#ifndef HAS_SPI
return ESP_OK;
#else
assert(SEND_QUEUE_SIZE); assert(SEND_QUEUE_SIZE);
SPISendQueue = xQueueCreate(SEND_QUEUE_SIZE, sizeof(MessageBuffer_t)); SPISendQueue = xQueueCreate(SEND_QUEUE_SIZE, sizeof(MessageBuffer_t));
if (SPISendQueue == 0) { if (SPISendQueue == 0) {
@ -146,13 +145,10 @@ esp_err_t spi_init() {
} }
return ret; return ret;
#endif
} }
void spi_enqueuedata(MessageBuffer_t *message, sendprio_t prio) { void spi_enqueuedata(MessageBuffer_t *message, sendprio_t prio) {
// enqueue message in SPI send queue // enqueue message in SPI send queue
#ifdef HAS_SPI
BaseType_t ret; BaseType_t ret;
switch (prio) { switch (prio) {
case prio_high: case prio_high:
@ -170,17 +166,12 @@ void spi_enqueuedata(MessageBuffer_t *message, sendprio_t prio) {
} else { } else {
ESP_LOGW(TAG, "SPI sendqueue is full"); ESP_LOGW(TAG, "SPI sendqueue is full");
} }
#endif
} }
void spi_queuereset(void) { void spi_queuereset(void) { xQueueReset(SPISendQueue); }
#ifdef HAS_SPI
xQueueReset(SPISendQueue);
#endif
}
void spi_housekeeping(void) { void spi_housekeeping(void) {
#ifdef HAS_SPI
ESP_LOGD(TAG, "spiloop %d bytes left", uxTaskGetStackHighWaterMark(spiTask)); ESP_LOGD(TAG, "spiloop %d bytes left", uxTaskGetStackHighWaterMark(spiTask));
#endif
} }
#endif // HAS_SPI