Add provisioning task, refactor provisioning

This commit is contained in:
Manuel Bleichenbacher
2018-07-23 09:46:45 +02:00
parent 2dd5b05891
commit b179ce6884
8 changed files with 595 additions and 239 deletions

71
Kconfig
View File

@ -68,4 +68,75 @@ config TTN_BG_TASK_PRIO
the LoRaWAN radio chip. It needs a high priority as the timing is crucial.
Higher numbers indicate higher priority.
choice TTN_PROVISION_UART
prompt "UART for provisioning"
default TTN_PROVISION_UART_DEFAULT
help
Select whether to use UART for listening for provisioning commands.
- Default is to use UART0 on pins GPIO1(TX) and GPIO3(RX).
- If "Custom" is selected, UART0 or UART1 can be chosen,
and any pins can be selected.
- If "None" is selected, the feature is not available.
config TTN_PROVISION_UART_DEFAULT
bool "Default: UART0, TX=GPIO1, RX=GPIO3, 115,200 baud"
config TTN_PROVISION_UART_CUSTOM
bool "Custom"
config TTN_PROVISION_UART_NONE
bool "None"
endchoice
choice TTN_PROVISION_UART_INIT
prompt "Initialize UART"
default TTN_PROVISION_UART_INIT_NO
depends on !TTN_PROVISION_UART_NONE
help
Select whether to initialize the UART, i.e. set the baud rate, the RX and TX
pins. If the UART is shared with other features (e.g. the console), it
should not be initialized.
config TTN_PROVISION_UART_INIT_NO
bool "No"
config TTN_PROVISION_UART_INIT_YES
bool "Yes"
endchoice
choice TTN_PROVISION_UART_NUM
prompt "UART peripheral for provisioning (0-1)"
depends on TTN_PROVISION_UART_CUSTOM
default TTN_PROVISION_UART_CUSTOM_NUM_0
config TTN_PROVISION_UART_CUSTOM_NUM_0
bool "UART0"
config TTN_PROVISION_UART_CUSTOM_NUM_1
bool "UART1"
endchoice
config TTN_PROVISION_UART_NUM
int
default 0 if TTN_PROVISION_UART_DEFAULT || TTN_PROVISION_UART_NONE
default 0 if TTN_PROVISION_UART_CUSTOM_NUM_0
default 1 if TTN_PROVISION_UART_CUSTOM_NUM_1
config TTN_PROVISION_UART_TX_GPIO
int "Provisioning UART TX on GPIO#"
depends on TTN_PROVISION_UART_CUSTOM && TTN_PROVISION_UART_INIT_YES
range 0 33
default 19
config TTN_PROVISION_UART_RX_GPIO
int "Provisioning UART RX on GPIO#"
depends on TTN_PROVISION_UART_CUSTOM && TTN_PROVISION_UART_INIT_YES
range 0 39
default 21
config TTN_PROVISION_UART_BAUDRATE
int "Provisioning UART baud rate"
depends on TTN_PROVISION_UART_CUSTOM && TTN_PROVISION_UART_INIT_YES
default 115200
range 1200 4000000
endmenu