1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

drivers/at : Expose to Kconfig

Expose configurations to Kconfig:
Model choice for CONFIG_AT_SEND_EOL
Allow value to be configured as exponent for AT_BUF_SIZE
This commit is contained in:
Akshai M 2020-05-04 22:56:01 +05:30
parent f9741b3ed5
commit e672ca2010
3 changed files with 95 additions and 7 deletions

View File

@ -10,8 +10,11 @@ menu "Actuator Device Drivers"
rsource "motor_driver/Kconfig"
endmenu # Actuator Device Drivers
rsource "Kconfig.net"
menu "Miscellaneous Device Drivers"
rsource "at/Kconfig"
endmenu # Miscellaneous Device Drivers
rsource "Kconfig.net"
rsource "periph_common/Kconfig"
menu "Sensor Device Drivers"

63
drivers/at/Kconfig Normal file
View File

@ -0,0 +1,63 @@
# Copyright (c) 2020 Freie Universitaet Berlin
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
#
menuconfig KCONFIG_MODULE_AT
bool "Configure AT driver"
depends on MODULE_AT
help
Configure the AT driver using Kconfig.
if KCONFIG_MODULE_AT
choice
bool "End of line character"
default AT_SEND_EOL_MAC
help
Select the EOL character to send after the AT command.
The character sequence depends on target device.
By default "\r", aka carriage return, is used.
config AT_SEND_EOL_WINDOWS
bool "\\r\\n"
config AT_SEND_EOL_UNIX
bool "\\n"
config AT_SEND_EOL_MAC
bool "\\r"
endchoice
config AT_SEND_SKIP_ECHO
bool "Disable check for echo"
help
Enable this to disable check for echo after an AT
command is sent.
config AT_RECV_OK
string "OK reply string"
default "OK"
help
Change okay response of the AT device.
config AT_RECV_ERROR
string "Error reply string"
default "ERROR"
help
Change error response of the AT device.
config AT_BUF_SIZE_EXP
int "Exponent for the buffer size (resulting in the queue size 2^n)"
range 0 31
default 7
depends on MODULE_AT_URC
help
Size of buffer used to process unsolicited result code data. (as
exponent of 2^n). As the buffer size ALWAYS needs to be power of two,
this option represents the exponent of 2^n, which will be used as the
size of the buffer.
endif # KCONFIG_MODULE_AT

View File

@ -54,12 +54,21 @@ extern "C" {
/**
* @brief End of line character to send after the AT command.
*/
#if IS_ACTIVE(CONFIG_AT_SEND_EOL_WINDOWS)
#define CONFIG_AT_SEND_EOL "\r\n"
#elif IS_ACTIVE(CONFIG_AT_SEND_EOL_UNIX)
#define CONFIG_AT_SEND_EOL "\n"
#elif IS_ACTIVE(CONFIG_AT_SEND_EOL_MAC)
#define CONFIG_AT_SEND_EOL "\r"
#endif
#ifndef CONFIG_AT_SEND_EOL
#define CONFIG_AT_SEND_EOL "\r"
#endif
/**
* @brief Disable echo after an AT command is sent.
* @brief Enable this to disable check for echo after an AT
* command is sent.
*/
#ifdef DOXYGEN
#define CONFIG_AT_SEND_SKIP_ECHO
@ -107,15 +116,28 @@ extern "C" {
#define CONFIG_AT_RECV_ERROR "ERROR"
#endif
/**
* @brief Internal buffer size used to process unsolicited result code data.
*/
#if defined(MODULE_AT_URC) || DOXYGEN
#ifndef AT_BUF_SIZE
#define AT_BUF_SIZE (128)
/**
* @brief Default buffer size used to process unsolicited result code data.
* (as exponent of 2^n).
*
* As the buffer size ALWAYS needs to be power of two, this option
* represents the exponent of 2^n, which will be used as the size of
* the buffer.
*/
#ifndef CONFIG_AT_BUF_SIZE_EXP
#define CONFIG_AT_BUF_SIZE_EXP (7U)
#endif
/** @} */
/**
* @brief Size of buffer used to process unsolicited result code data.
*/
#ifndef AT_BUF_SIZE
#define AT_BUF_SIZE (1 << CONFIG_AT_BUF_SIZE_EXP)
#endif
/**
* @brief Unsolicited result code callback
*