Browse Source

Use Kconfig for SX127X

ugv_io
Alex Mikhalev 6 years ago
parent
commit
33bb813a02
  1. 41
      components/sx127x_driver/Kconfig.projbuild
  2. 17
      components/sx127x_driver/sx127x_internal.h

41
components/sx127x_driver/Kconfig.projbuild

@ -0,0 +1,41 @@ @@ -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

17
components/sx127x_driver/sx127x_internal.h

@ -5,14 +5,15 @@ @@ -5,14 +5,15 @@
#include <freertos/task.h>
#include <stdatomic.h>
// 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))

Loading…
Cancel
Save