From 33bb813a02eba83f07674427ca33d430856f96d0 Mon Sep 17 00:00:00 2001 From: Alex Mikhalev Date: Mon, 31 Dec 2018 14:02:11 -0700 Subject: [PATCH] Use Kconfig for SX127X --- components/sx127x_driver/Kconfig.projbuild | 41 ++++++++++++++++++++++ components/sx127x_driver/sx127x_internal.h | 17 ++++----- 2 files changed, 50 insertions(+), 8 deletions(-) create mode 100644 components/sx127x_driver/Kconfig.projbuild diff --git a/components/sx127x_driver/Kconfig.projbuild b/components/sx127x_driver/Kconfig.projbuild new file mode 100644 index 0000000..255827b --- /dev/null +++ b/components/sx127x_driver/Kconfig.projbuild @@ -0,0 +1,41 @@ +menu "SX127X Driver Configuration" + +config SX127X_TASK_STACK_SIZE + int "Task stack size" + range 1024 32768 + default 2048 + +config SX127X_TASK_PRIORITY + int "Task priority" + range 1 25 + default 3 + +config SX127X_RX_QUEUE_LEN + int "Receive queue length" + range 1 255 + default 8 + +config SX127X_TX_QUEUE_LEN + int "Transmit queue length" + range 1 255 + default 8 + +config SX127X_SPI_CLOCK_HZ + int "SPI clock rate in hz" + range 8000000 80000000 + default 8000000 + +config SX127X_SPI_QUEUE_SIZE + int "SPI transmit queue length" + range 2 20 + default 8 + +config SX127X_SPI_DMA_CHAN + int "SPI DMA chanel" + range 0 2 + default 1 + help + There are two DMA channels that can be used by the ESP32 SPI driver. One + which is not in use must be picked (1 or 2). Set to 0 to disable SPI DMA. + +endmenu diff --git a/components/sx127x_driver/sx127x_internal.h b/components/sx127x_driver/sx127x_internal.h index 43c5d64..93ffcc9 100644 --- a/components/sx127x_driver/sx127x_internal.h +++ b/components/sx127x_driver/sx127x_internal.h @@ -5,14 +5,15 @@ #include #include -// TODO: these should be in Kconfig -#define SX127X_TASK_STACK_SIZE (2 * 1024) -#define SX127X_TASK_PRIORITY 3 -#define SX127X_RX_QUEUE_LEN 8 -#define SX127X_TX_QUEUE_LEN 8 -#define SX127X_SPI_QUEUE_SIZE 8 -#define SX127X_SPI_DMA_CHAN 1 -#define SX127X_SPI_CLOCK_HZ (8 * 1000 * 1000) +#include "sdkconfig.h" + +#define SX127X_TASK_STACK_SIZE CONFIG_SX127X_TASK_STACK_SIZE +#define SX127X_TASK_PRIORITY CONFIG_SX127X_TASK_PRIORITY +#define SX127X_RX_QUEUE_LEN CONFIG_SX127X_RX_QUEUE_LEN +#define SX127X_TX_QUEUE_LEN CONFIG_SX127X_TX_QUEUE_LEN +#define SX127X_SPI_QUEUE_SIZE CONFIG_SX127X_SPI_QUEUE_SIZE +#define SX127X_SPI_DMA_CHAN CONFIG_SX127X_SPI_DMA_CHAN +#define SX127X_SPI_CLOCK_HZ CONFIG_SX127X_SPI_CLOCK_HZ #define SX127X_MAX_TRANSFER (256) #define SX127X_RESET_DELAY (pdMS_TO_TICKS(15))