Skip to content

Commit

Permalink
[Telink]: Use separate OpenThread configs for apps (#18891)
Browse files Browse the repository at this point in the history
  • Loading branch information
s07641069 authored and pull[bot] committed Oct 28, 2023
1 parent cf4341b commit 1001004
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 2 deletions.
2 changes: 0 additions & 2 deletions config/telink/app/zephyr.conf
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ CONFIG_NET_CONFIG_MY_IPV6_ADDR="fdde:ad00:beef::1"
CONFIG_NET_CONFIG_PEER_IPV6_ADDR="fdde:ad00:beef::2"

# OpenThread configs
CONFIG_OPENTHREAD_MTD=y
CONFIG_OPENTHREAD_FTD=n
CONFIG_OPENTHREAD_SLAAC=y
CONFIG_OPENTHREAD_DHCP6_CLIENT=y
CONFIG_OPENTHREAD_SNTP_CLIENT=y
Expand Down
4 changes: 4 additions & 0 deletions examples/light-switch-app/telink/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ CONFIG_GPIO=y
# enable PWM
CONFIG_PWM=y

# OpenThread configs
CONFIG_OPENTHREAD_MTD=y
CONFIG_OPENTHREAD_FTD=n

# Default OpenThread network settings
CONFIG_OPENTHREAD_PANID=4660
CONFIG_OPENTHREAD_CHANNEL=15
Expand Down
6 changes: 6 additions & 0 deletions examples/light-switch-app/telink/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,13 @@ int main(void)
goto exit;
}

#ifdef CONFIG_OPENTHREAD_MTD_SED
err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SleepyEndDevice);
#elif CONFIG_OPENTHREAD_MTD
err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice);
#else
err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_Router);
#endif
if (err != CHIP_NO_ERROR)
{
LOG_ERR("ConnectivityMgr().SetThreadDeviceType() failed");
Expand Down
4 changes: 4 additions & 0 deletions examples/lighting-app/telink/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ CONFIG_GPIO=y
# enable PWM
CONFIG_PWM=y

# OpenThread configs
CONFIG_OPENTHREAD_MTD=y
CONFIG_OPENTHREAD_FTD=n

# Default OpenThread network settings
CONFIG_OPENTHREAD_PANID=4660
CONFIG_OPENTHREAD_CHANNEL=15
Expand Down
4 changes: 4 additions & 0 deletions examples/lighting-app/telink/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ int main(void)
goto exit;
}

#ifdef CONFIG_OPENTHREAD_MTD
err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice);
#else
err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_Router);
#endif
if (err != CHIP_NO_ERROR)
{
LOG_ERR("ConnectivityMgr().SetThreadDeviceType() failed");
Expand Down

0 comments on commit 1001004

Please sign in to comment.