From 45778d2186b49ff86446419963d28244c5083635 Mon Sep 17 00:00:00 2001 From: cc32d9 Date: Mon, 25 May 2020 23:00:00 +0200 Subject: [PATCH] New config option: TTN_RADIO_RST_KEEP_ASSERTED --- Kconfig | 7 +++++++ src/hal/hal_esp32.cpp | 9 ++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Kconfig b/Kconfig index 06ce10b..c42cca2 100644 --- a/Kconfig +++ b/Kconfig @@ -55,6 +55,13 @@ config TTN_SPI_FREQ help SPI frequency to communicate between ESP32 and SX127x radio chip +config TTN_RADIO_RST_KEEP_ASSERTED + bool "Keep RST pin asserted instead of floating" + default n + help + Some hardware needs RST pin to be always high for LoRa chip to function + + config TTN_BG_TASK_PRIO int "Background task priority" default 10 diff --git a/src/hal/hal_esp32.cpp b/src/hal/hal_esp32.cpp index 14f674c..ebf0496 100755 --- a/src/hal/hal_esp32.cpp +++ b/src/hal/hal_esp32.cpp @@ -128,9 +128,16 @@ void hal_pin_rst(u1_t val) gpio_set_direction(ttn_hal.pinRst, GPIO_MODE_OUTPUT); } else - { // keep pin floating + { +#ifdef CONFIG_TTN_RADIO_RST_KEEP_ASSERTED + // drive up the pin because the hardware is nonstandard + gpio_set_level(ttn_hal.pinRst, 1); + gpio_set_direction(ttn_hal.pinRst, GPIO_MODE_OUTPUT); +#else + // keep pin floating gpio_set_level(ttn_hal.pinRst, val); gpio_set_direction(ttn_hal.pinRst, GPIO_MODE_INPUT); +#endif } }