Rename reset options

This commit is contained in:
Manuel Bl 2020-07-31 21:54:09 +02:00
parent 45778d2186
commit 0853fe05ec
2 changed files with 18 additions and 9 deletions

18
Kconfig
View File

@ -55,12 +55,20 @@ config TTN_SPI_FREQ
help help
SPI frequency to communicate between ESP32 and SX127x radio chip SPI frequency to communicate between ESP32 and SX127x radio chip
config TTN_RADIO_RST_KEEP_ASSERTED choice TTN_RESET
bool "Keep RST pin asserted instead of floating" prompt "Reset states"
default n default TTN_RESET_STATES_FLOATING
help help
Some hardware needs RST pin to be always high for LoRa chip to function Reset pin can be floating for most boards and shields.
A few boards/shields require the pin to be held high for operation.
config TTN_RESET_STATES_FLOATING
bool "Toggle between low and floating"
config TTN_RESET_STATES_ASSERTED
bool "Toggle between low and high"
endchoice
config TTN_BG_TASK_PRIO config TTN_BG_TASK_PRIO
int "Background task priority" int "Background task priority"

View File

@ -123,18 +123,19 @@ void hal_pin_rst(u1_t val)
return; return;
if (val == 0 || val == 1) if (val == 0 || val == 1)
{ // drive pin {
// drive pin
gpio_set_level(ttn_hal.pinRst, val); gpio_set_level(ttn_hal.pinRst, val);
gpio_set_direction(ttn_hal.pinRst, GPIO_MODE_OUTPUT); gpio_set_direction(ttn_hal.pinRst, GPIO_MODE_OUTPUT);
} }
else else
{ {
#ifdef CONFIG_TTN_RADIO_RST_KEEP_ASSERTED #if defined(CONFIG_TTN_RESET_STATES_ASSERTED)
// drive up the pin because the hardware is nonstandard // drive up the pin because the hardware is nonstandard
gpio_set_level(ttn_hal.pinRst, 1); gpio_set_level(ttn_hal.pinRst, 1);
gpio_set_direction(ttn_hal.pinRst, GPIO_MODE_OUTPUT); gpio_set_direction(ttn_hal.pinRst, GPIO_MODE_OUTPUT);
#else #else
// keep pin floating // keep pin floating
gpio_set_level(ttn_hal.pinRst, val); gpio_set_level(ttn_hal.pinRst, val);
gpio_set_direction(ttn_hal.pinRst, GPIO_MODE_INPUT); gpio_set_direction(ttn_hal.pinRst, GPIO_MODE_INPUT);
#endif #endif