From 87dab53d6dd2e7bf351a1033bea3dddb83396a5c Mon Sep 17 00:00:00 2001 From: Serhii Salamakha Date: Tue, 31 Oct 2023 12:36:40 +0200 Subject: [PATCH] [Telink]Update the Mars board overlay --- .../telink/src/AppTask.cpp | 8 +-- src/platform/telink/tlsr9518adk80d_mars.conf | 10 ++++ .../telink/tlsr9518adk80d_mars.overlay | 53 ++++++++++++++++++- 3 files changed, 66 insertions(+), 5 deletions(-) diff --git a/examples/air-quality-sensor-app/telink/src/AppTask.cpp b/examples/air-quality-sensor-app/telink/src/AppTask.cpp index 5e841faa8d5623..16f738286926e6 100644 --- a/examples/air-quality-sensor-app/telink/src/AppTask.cpp +++ b/examples/air-quality-sensor-app/telink/src/AppTask.cpp @@ -38,18 +38,18 @@ AppTask AppTask::sAppTask; CHIP_ERROR AppTask::Init(void) { - CHIP_ERROR ret; + CHIP_ERROR err; #if APP_USE_EXAMPLE_START_BUTTON SetExampleButtonCallbacks(AirQualitySensorMeasurActionEventHandler); #endif InitCommonParts(); - ret = SensorMgr().Init(); - if (ret != CHIP_NO_ERROR) + err = SensorMgr().Init(); + if (err != CHIP_NO_ERROR) { LOG_ERR("Init of the Sensor Manager failed"); - return ret; + return err; } // Initialize sensor measurement timer diff --git a/src/platform/telink/tlsr9518adk80d_mars.conf b/src/platform/telink/tlsr9518adk80d_mars.conf index fe619104c86578..9917bb97cd2631 100644 --- a/src/platform/telink/tlsr9518adk80d_mars.conf +++ b/src/platform/telink/tlsr9518adk80d_mars.conf @@ -1,7 +1,17 @@ CONFIG_CHIP_USE_MARS_SENSOR=y CONFIG_CHIP_BUTTON_MANAGER_IRQ_MODE=y + +# SHT3XD CONFIG_I2C=y CONFIG_SENSOR=y + +# WS2812 +#CONFIG_LED_STRIP=y +#CONFIG_LED_STRIP_LOG_LEVEL_DBG=y +#CONFIG_WS2812_STRIP=y +#CONFIG_WS2812_STRIP_GPIO=y + +# DFU via USB CONFIG_USB_DEVICE_STACK=y CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=n CONFIG_USB_CDC_ACM_LOG_LEVEL_OFF=y \ No newline at end of file diff --git a/src/platform/telink/tlsr9518adk80d_mars.overlay b/src/platform/telink/tlsr9518adk80d_mars.overlay index 2b93d82d507626..303474ca04774d 100644 --- a/src/platform/telink/tlsr9518adk80d_mars.overlay +++ b/src/platform/telink/tlsr9518adk80d_mars.overlay @@ -1,4 +1,11 @@ +#include +#include + / { + aliases { + led-strip = &led_strip; + }; + leds { /delete-node/ led_3; @@ -8,6 +15,30 @@ }; }; + pwm_leds { + /delete-node/ pwm_led_0; + /delete-node/ pwm_led_1; + /delete-node/ pwm_led_2; + /delete-node/ pwm_led_3; + + pwm_led0: pwm_led_0 { + pwms = <&pwm0 0 PWM_MSEC(20) PWM_POLARITY_NORMAL>; + label = "PWM LED Blue"; + }; + pwm_led1: pwm_led_1 { + pwms = <&pwm0 3 PWM_MSEC(20) PWM_POLARITY_NORMAL>; + label = "PWM LED Green"; + }; + pwm_led2: pwm_led_2 { + pwms = <&pwm0 2 PWM_MSEC(20) PWM_POLARITY_NORMAL>; + label = "PWM LED Red"; + }; + pwm_led3: pwm_led_3 { + pwms = <&pwm0 1 PWM_MSEC(20) PWM_POLARITY_NORMAL>; + label = "PWM IDENTIFY LED Green"; + }; + }; + keys { /delete-node/ button_1; /delete-node/ button_4; @@ -19,6 +50,16 @@ gpios = <&gpiod 3 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; }; }; + + led_strip: ws2812 { + compatible = "worldsemi,ws2812-gpio"; + + chain-length = <1>; /* arbitrary; change at will */ + color-mapping = ; + in-gpios = <&gpiob 4 0>; + }; }; &gpioc { @@ -39,6 +80,16 @@ pinmux = ; }; + /* PWMs */ + pwm_ch0_pe3_default: pwm_ch0_pe3_default { + pinmux = ; + }; + pwm_ch1_pb5_default: pwm_ch1_pb5_default { + pinmux = ; + }; + pwm_ch2_pe2_default: pwm_ch2_pe2_default { + pinmux = ; + }; pwm_ch4_pe4_default: pwm_ch4_pe4_default { pinmux = ; }; @@ -54,5 +105,5 @@ }; &pwm0 { - pinctrl-0 = <&pwm_ch0_pb4_default &pwm_ch1_pb5_default &pwm_ch2_pe2_default &pwm_ch4_pe4_default>; + pinctrl-0 = <&pwm_ch0_pe3_default &pwm_ch1_pb5_default &pwm_ch2_pe2_default &pwm_ch4_pe4_default>; };