Skip to content

Commit

Permalink
[Telink] Fix build system warnings (#26140)
Browse files Browse the repository at this point in the history
  • Loading branch information
andriy-bilynskyy authored Apr 18, 2023
1 parent 053b33b commit 8deb4ff
Show file tree
Hide file tree
Showing 27 changed files with 65 additions and 171 deletions.
8 changes: 3 additions & 5 deletions config/telink/app/zephyr.conf
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@ CONFIG_SERIAL=y
CONFIG_LOG=y
CONFIG_LOG_MODE_MINIMAL=y
CONFIG_PRINTK=y
CONFIG_ASSERT=y
# CONFIG_ASSERT=y
CONFIG_CBPRINTF_LIBC_SUBSTS=y

# Set the maximum log level (DEBUG)
CONFIG_LOG_DEFAULT_LEVEL=4
CONFIG_MATTER_LOG_LEVEL_DBG=y
CONFIG_MCUBOOT_BOOTUTIL_LIB=y
CONFIG_MCUBOOT_UTIL_LOG_LEVEL_DBG=y
CONFIG_NET_LOG=y
CONFIG_IEEE802154_DRIVER_LOG_LEVEL_DBG=y
CONFIG_NVS_LOG_LEVEL_DBG=y
CONFIG_OPENTHREAD_LOG_LEVEL_DEBG=y
Expand Down Expand Up @@ -125,10 +127,6 @@ CONFIG_TELINK_B91_REBOOT_ON_FAULT=y

# Shell settings
CONFIG_SHELL=n
CONFIG_SHELL_BACKEND_SERIAL_RX_RING_BUFFER_SIZE=255

# Legacy
CONFIG_LEGACY_INCLUDE_PATH=y

# BLE MAC address
CONFIG_B91_BLE_CTRL_MAC_FLASH_ADDR=0x1FE000
10 changes: 7 additions & 3 deletions config/telink/chip-module/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -152,20 +152,20 @@ config CHIP_LOG_SIZE_OPTIMIZATION

config CHIP_BUTTON_MANAGER_IRQ_MODE
bool "Use GPIO in an IRQ mode instead of polling the GPIO"
default n
default PM
help
Use GPIO in an IRQ mode to avoid button polling loop and extend the battery lifetime by waking up by GPIO event.
GPIO events are working only with GPIO IRQ. This option changes button matrix configuration.

config CHIP_ENABLE_APPLICATION_STATUS_LED
bool "Enable application status LED"
default y
default !(PM)
help
Enable application status LED.

config CHIP_ENABLE_PM_DURING_BLE
bool "Enable PM during BLE operation"
default y
default PM
help
Enable PM during BLE operation.

Expand All @@ -175,3 +175,7 @@ config CHIP_OPENTHREAD_TX_POWER
default 0
help
OpenThread Transmission power in dBm.

config SHELL_BACKEND_SERIAL_RX_RING_BUFFER_SIZE
int
default 255 if SHELL_BACKEND_SERIAL
10 changes: 0 additions & 10 deletions examples/all-clusters-app/telink/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ CONFIG_PWM=y

# OpenThread configs
CONFIG_OPENTHREAD_MTD=y
CONFIG_OPENTHREAD_FTD=n
CONFIG_CHIP_ENABLE_SLEEPY_END_DEVICE_SUPPORT=n
CONFIG_CHIP_SED_IDLE_INTERVAL=200
CONFIG_CHIP_THREAD_SSED=n

# Default OpenThread network settings
Expand Down Expand Up @@ -63,13 +61,5 @@ CONFIG_CHIP_FACTORY_DATA=n
CONFIG_CHIP_FACTORY_DATA_BUILD=n
CONFIG_CHIP_FACTORY_DATA_MERGE_WITH_FIRMWARE=n

# Enable Button IRQ mode. The poling mode is used by default.
CONFIG_CHIP_BUTTON_MANAGER_IRQ_MODE=n

# Disable Status LED.
CONFIG_CHIP_ENABLE_APPLICATION_STATUS_LED=y

# Enable Power Management
CONFIG_PM=n
CONFIG_PM_DEVICE=n
CONFIG_CHIP_ENABLE_PM_DURING_BLE=n
11 changes: 3 additions & 8 deletions examples/all-clusters-minimal-app/telink/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ CONFIG_GPIO=y

# OpenThread configs
CONFIG_OPENTHREAD_MTD=y
CONFIG_OPENTHREAD_FTD=n
CONFIG_CHIP_ENABLE_SLEEPY_END_DEVICE_SUPPORT=n
CONFIG_CHIP_THREAD_SSED=n

# Default OpenThread network settings
CONFIG_OPENTHREAD_PANID=4660
Expand Down Expand Up @@ -52,14 +53,8 @@ CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y
# CHIP shell
CONFIG_CHIP_LIB_SHELL=n

# Disable factory data support.
# Disable factory data support.
CONFIG_CHIP_FACTORY_DATA=n
CONFIG_CHIP_FACTORY_DATA_BUILD=n
CONFIG_CHIP_FACTORY_DATA_MERGE_WITH_FIRMWARE=n
CONFIG_CHIP_CERTIFICATION_DECLARATION_STORAGE=n

# Enable Button IRQ mode. The poling mode is used by default.
CONFIG_CHIP_BUTTON_MANAGER_IRQ_MODE=n

# Disable Status LED.
CONFIG_CHIP_ENABLE_APPLICATION_STATUS_LED=y
9 changes: 0 additions & 9 deletions examples/bridge-app/telink/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ CONFIG_PWM=y

# OpenThread configs
CONFIG_OPENTHREAD_MTD=n
CONFIG_OPENTHREAD_FTD=y
CONFIG_CHIP_ENABLE_SLEEPY_END_DEVICE_SUPPORT=n
CONFIG_CHIP_SED_IDLE_INTERVAL=200
CONFIG_CHIP_THREAD_SSED=n

# Default OpenThread network settings
Expand Down Expand Up @@ -64,15 +62,8 @@ CONFIG_CHIP_FACTORY_DATA_BUILD=n
CONFIG_CHIP_FACTORY_DATA_MERGE_WITH_FIRMWARE=n
CONFIG_CHIP_CERTIFICATION_DECLARATION_STORAGE=n

# Enable Button IRQ mode. The poling mode is used by default.
CONFIG_CHIP_BUTTON_MANAGER_IRQ_MODE=n

# Disable Status LED.
CONFIG_CHIP_ENABLE_APPLICATION_STATUS_LED=y

# Enable Power Management
CONFIG_PM=n
CONFIG_PM_DEVICE=n

# Custom RF power values
CONFIG_B91_BLE_CTRL_RF_POWER_P9P11DBM=y
Expand Down
2 changes: 1 addition & 1 deletion examples/common/pigweed/telink/PigweedLoggerMutex.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#include "PigweedLogger.h"
#include "pigweed/RpcService.h"
#include <zephyr/zephyr.h>
#include <zephyr/kernel.h>

namespace chip {
namespace rpc {
Expand Down
16 changes: 3 additions & 13 deletions examples/contact-sensor-app/telink/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@ CONFIG_PWM=y

# OpenThread configs
CONFIG_OPENTHREAD_MTD=y
CONFIG_OPENTHREAD_FTD=n
CONFIG_CHIP_ENABLE_SLEEPY_END_DEVICE_SUPPORT=n
CONFIG_CHIP_SED_IDLE_INTERVAL=200
CONFIG_CHIP_THREAD_SSED=n
CONFIG_CHIP_ENABLE_SLEEPY_END_DEVICE_SUPPORT=y
CONFIG_CHIP_THREAD_SSED=n

# Default OpenThread network settings
CONFIG_OPENTHREAD_PANID=4660
Expand Down Expand Up @@ -63,13 +61,5 @@ CONFIG_CHIP_FACTORY_DATA=n
CONFIG_CHIP_FACTORY_DATA_BUILD=n
CONFIG_CHIP_FACTORY_DATA_MERGE_WITH_FIRMWARE=n

# Enable Button IRQ mode. The poling mode is used by default.
CONFIG_CHIP_BUTTON_MANAGER_IRQ_MODE=n

# Disable Status LED.
CONFIG_CHIP_ENABLE_APPLICATION_STATUS_LED=y

# Enable Power Management
CONFIG_PM=n
CONFIG_PM_DEVICE=n
CONFIG_CHIP_ENABLE_PM_DURING_BLE=n
CONFIG_PM=y
2 changes: 1 addition & 1 deletion examples/contact-sensor-app/telink/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

#include <app-common/zap-generated/attributes/Accessors.h>

#include <zephyr/kernel.h>
#include <zephyr/logging/log.h>
#include <zephyr/zephyr.h>

LOG_MODULE_DECLARE(app, CONFIG_CHIP_APP_LOG_LEVEL);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
#include <lib/support/CodeUtils.h>

#include <zephyr/drivers/pwm.h>
#include <zephyr/kernel.h>
#include <zephyr/logging/log.h>
#include <zephyr/zephyr.h>

LOG_MODULE_DECLARE(app, CONFIG_CHIP_APP_LOG_LEVEL);

Expand Down
14 changes: 2 additions & 12 deletions examples/light-switch-app/telink/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ CONFIG_PWM=y

# OpenThread configs
CONFIG_OPENTHREAD_MTD=y
CONFIG_OPENTHREAD_FTD=n
CONFIG_CHIP_ENABLE_SLEEPY_END_DEVICE_SUPPORT=n
CONFIG_CHIP_SED_IDLE_INTERVAL=200
CONFIG_CHIP_ENABLE_SLEEPY_END_DEVICE_SUPPORT=y
CONFIG_CHIP_THREAD_SSED=n

# Default OpenThread network settings
Expand Down Expand Up @@ -64,13 +62,5 @@ CONFIG_CHIP_FACTORY_DATA_BUILD=n
CONFIG_CHIP_FACTORY_DATA_MERGE_WITH_FIRMWARE=n
CONFIG_CHIP_CERTIFICATION_DECLARATION_STORAGE=n

# Enable Button IRQ mode. The poling mode is used by default.
CONFIG_CHIP_BUTTON_MANAGER_IRQ_MODE=n

# Disable Status LED.
CONFIG_CHIP_ENABLE_APPLICATION_STATUS_LED=y

# Enable Power Management
CONFIG_PM=n
CONFIG_PM_DEVICE=n
CONFIG_CHIP_ENABLE_PM_DURING_BLE=n
CONFIG_PM=y
10 changes: 0 additions & 10 deletions examples/lighting-app/telink/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ CONFIG_PWM=y

# OpenThread configs
CONFIG_OPENTHREAD_MTD=n
CONFIG_OPENTHREAD_FTD=y
CONFIG_CHIP_ENABLE_SLEEPY_END_DEVICE_SUPPORT=n
CONFIG_CHIP_SED_IDLE_INTERVAL=200
CONFIG_CHIP_THREAD_SSED=n

# Default OpenThread network settings
Expand Down Expand Up @@ -64,16 +62,8 @@ CONFIG_CHIP_FACTORY_DATA_BUILD=n
CONFIG_CHIP_FACTORY_DATA_MERGE_WITH_FIRMWARE=n
CONFIG_CHIP_CERTIFICATION_DECLARATION_STORAGE=n

# Enable Button IRQ mode. The poling mode is used by default.
CONFIG_CHIP_BUTTON_MANAGER_IRQ_MODE=n

# Disable Status LED.
CONFIG_CHIP_ENABLE_APPLICATION_STATUS_LED=y

# Enable Power Management
CONFIG_PM=n
CONFIG_PM_DEVICE=n
CONFIG_CHIP_ENABLE_PM_DURING_BLE=n

# Custom RF power values
CONFIG_B91_BLE_CTRL_RF_POWER_P9P11DBM=y
Expand Down
14 changes: 2 additions & 12 deletions examples/lock-app/telink/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ CONFIG_PWM=y

# OpenThread configs
CONFIG_OPENTHREAD_MTD=y
CONFIG_OPENTHREAD_FTD=n
CONFIG_CHIP_ENABLE_SLEEPY_END_DEVICE_SUPPORT=n
CONFIG_CHIP_SED_IDLE_INTERVAL=200
CONFIG_CHIP_ENABLE_SLEEPY_END_DEVICE_SUPPORT=y
CONFIG_CHIP_THREAD_SSED=n

# Default OpenThread network settings
Expand Down Expand Up @@ -63,13 +61,5 @@ CONFIG_CHIP_FACTORY_DATA=n
CONFIG_CHIP_FACTORY_DATA_BUILD=n
CONFIG_CHIP_FACTORY_DATA_MERGE_WITH_FIRMWARE=n

# Enable Button IRQ mode. The poling mode is used by default.
CONFIG_CHIP_BUTTON_MANAGER_IRQ_MODE=n

# Disable Status LED.
CONFIG_CHIP_ENABLE_APPLICATION_STATUS_LED=y

# Enable Power Management
CONFIG_PM=n
CONFIG_PM_DEVICE=n
CONFIG_CHIP_ENABLE_PM_DURING_BLE=n
CONFIG_PM=y
10 changes: 0 additions & 10 deletions examples/ota-requestor-app/telink/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ CONFIG_PWM=y

# OpenThread configs
CONFIG_OPENTHREAD_MTD=y
CONFIG_OPENTHREAD_FTD=n
CONFIG_CHIP_ENABLE_SLEEPY_END_DEVICE_SUPPORT=n
CONFIG_CHIP_SED_IDLE_INTERVAL=200
CONFIG_CHIP_THREAD_SSED=n

# Default OpenThread network settings
Expand Down Expand Up @@ -63,13 +61,5 @@ CONFIG_CHIP_CERTIFICATION_DECLARATION_STORAGE=n
# CHIP shell
CONFIG_CHIP_LIB_SHELL=n

# Enable Button IRQ mode. The poling mode is used by default.
CONFIG_CHIP_BUTTON_MANAGER_IRQ_MODE=n

# Disable Status LED.
CONFIG_CHIP_ENABLE_APPLICATION_STATUS_LED=y

# Enable Power Management
CONFIG_PM=n
CONFIG_PM_DEVICE=n
CONFIG_CHIP_ENABLE_PM_DURING_BLE=n
2 changes: 1 addition & 1 deletion examples/platform/telink/common/include/AppTaskCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
#endif

#include <zephyr/drivers/gpio.h>
#include <zephyr/kernel.h>
#include <zephyr/logging/log.h>
#include <zephyr/zephyr.h>

#include <platform/CHIPDeviceLayer.h>

Expand Down
2 changes: 1 addition & 1 deletion examples/platform/telink/pw_sys_io/sys_io_telink.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "pw_sys_io/sys_io.h"
#include "zephyr/console/console.h"
#include <cassert>
#include <zephyr/zephyr.h>
#include <zephyr/kernel.h>

#ifdef CONFIG_USB
#include <zephyr/usb/usb_device.h>
Expand Down
2 changes: 1 addition & 1 deletion examples/platform/telink/util/include/LEDWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#include <cstdint>
#include <zephyr/drivers/gpio.h>
#include <zephyr/zephyr.h>
#include <zephyr/kernel.h>

class LEDWidget
{
Expand Down
12 changes: 8 additions & 4 deletions examples/platform/telink/util/src/ButtonManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,11 @@
* limitations under the License.
*/

#include <assert.h>
#include <zephyr/device.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/irq.h>
#include <zephyr/kernel.h>
#include <zephyr/logging/log.h>
#include <zephyr/zephyr.h>

LOG_MODULE_REGISTER(ButtonManager);

Expand All @@ -37,7 +35,10 @@ void button_pressed(const struct device * dev, struct gpio_callback * cb, uint32

void Button::Configure(const struct device * port, gpio_pin_t outPin, gpio_pin_t inPin, void (*callback)(void))
{
__ASSERT(device_is_ready(port), "%s is not ready\n", port->name);
if (!device_is_ready(port))
{
LOG_ERR("%s is not ready\n", port->name);
}

mPort = port;
mOutPin = outPin;
Expand Down Expand Up @@ -207,7 +208,10 @@ void Button::PollIRQ()

void Button::Configure(const struct device * port, gpio_pin_t inPin, void (*callback)(void))
{
__ASSERT(device_is_ready(port), "%s is not ready\n", port->name);
if (!device_is_ready(port))
{
LOG_ERR("%s is not ready\n", port->name);
}

mPort = port;
mInPin = inPin;
Expand Down
Loading

0 comments on commit 8deb4ff

Please sign in to comment.