mirror of
https://github.com/apache/nuttx.git
synced 2025-01-13 13:18:50 +08:00
Improvements to gs2200m
gs2200m: Make CHECK_VERSION use Kconfig gs2200m: Add a config to set log level
This commit is contained in:
parent
a5bb9f7660
commit
d4e5736712
2 changed files with 35 additions and 2 deletions
|
@ -40,6 +40,17 @@ config WL_GS2200M_DISABLE_DHCPC
|
|||
bool "Disable the internal dhcp client"
|
||||
default n
|
||||
|
||||
config WL_GS2200M_CHECK_VERSION
|
||||
bool "Check the version of GS2200M"
|
||||
default n
|
||||
|
||||
config WL_GS2200M_LOGLEVEL
|
||||
int "Log level"
|
||||
default 0
|
||||
range 0 2
|
||||
---help---
|
||||
The debug level of GS2200M. (AT+LOGLVL)
|
||||
|
||||
endif
|
||||
|
||||
source drivers/wireless/spirit/Kconfig
|
||||
|
|
|
@ -1966,11 +1966,27 @@ static enum pkt_type_e gs2200m_set_gpio(FAR struct gs2200m_dev_s *dev,
|
|||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: gs2200m_set_loglevel
|
||||
* NOTE: See 11.3.1 Log Level
|
||||
****************************************************************************/
|
||||
|
||||
#if CONFIG_WL_GS2200M_LOGLEVEL > 0
|
||||
static enum pkt_type_e gs2200m_set_loglevel(FAR struct gs2200m_dev_s *dev,
|
||||
int level)
|
||||
{
|
||||
char cmd[16];
|
||||
|
||||
snprintf(cmd, sizeof(cmd), "AT+LOGLVL=%d\r\n", level);
|
||||
return gs2200m_send_cmd(dev, cmd, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: gs2200m_get_version
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CHECK_VERSION
|
||||
#ifdef CONFIG_WL_GS2200M_CHECK_VERSION
|
||||
static enum pkt_type_e gs2200m_get_version(FAR struct gs2200m_dev_s *dev)
|
||||
{
|
||||
char cmd[16];
|
||||
|
@ -2875,7 +2891,13 @@ static int gs2200m_start(FAR struct gs2200m_dev_s *dev)
|
|||
t = gs2200m_enable_echo(dev, 0);
|
||||
ASSERT(TYPE_OK == t);
|
||||
|
||||
#ifdef CHECK_VERSION
|
||||
#if CONFIG_WL_GS2200M_LOGLEVEL > 0
|
||||
/* Set log level */
|
||||
t = gs2200m_set_loglevel(dev, CONFIG_WL_GS2200M_LOGLEVEL);
|
||||
ASSERT(TYPE_OK == t);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_WL_GS2200M_CHECK_VERSION
|
||||
/* Version */
|
||||
|
||||
t = gs2200m_get_version(dev);
|
||||
|
|
Loading…
Reference in a new issue