Skip to content

Commit

Permalink
[Telink]Update the Mars board overlay
Browse files Browse the repository at this point in the history
  • Loading branch information
serhiiSalamakha committed Oct 31, 2023
1 parent dd5e674 commit 87dab53
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 5 deletions.
8 changes: 4 additions & 4 deletions examples/air-quality-sensor-app/telink/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions src/platform/telink/tlsr9518adk80d_mars.conf
Original file line number Diff line number Diff line change
@@ -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
53 changes: 52 additions & 1 deletion src/platform/telink/tlsr9518adk80d_mars.overlay
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
#include <zephyr/dt-bindings/gpio/gpio.h>
#include <zephyr/dt-bindings/led/led.h>

/ {
aliases {
led-strip = &led_strip;
};

leds {
/delete-node/ led_3;

Expand All @@ -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;
Expand All @@ -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 = <LED_COLOR_ID_GREEN
LED_COLOR_ID_RED
LED_COLOR_ID_BLUE>;
in-gpios = <&gpiob 4 0>;
};
};

&gpioc {
Expand All @@ -39,6 +80,16 @@
pinmux = <B9x_PINMUX_SET(B9x_PORT_C, B9x_PIN_2, B91_FUNC_A)>;
};

/* PWMs */
pwm_ch0_pe3_default: pwm_ch0_pe3_default {
pinmux = <B9x_PINMUX_SET(B9x_PORT_E, B9x_PIN_3, B91_FUNC_C)>;
};
pwm_ch1_pb5_default: pwm_ch1_pb5_default {
pinmux = <B9x_PINMUX_SET(B9x_PORT_B, B9x_PIN_5, B91_FUNC_C)>;
};
pwm_ch2_pe2_default: pwm_ch2_pe2_default {
pinmux = <B9x_PINMUX_SET(B9x_PORT_E, B9x_PIN_2, B91_FUNC_C)>;
};
pwm_ch4_pe4_default: pwm_ch4_pe4_default {
pinmux = <B9x_PINMUX_SET(B9x_PORT_E, B9x_PIN_4, B91_FUNC_C)>;
};
Expand All @@ -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>;
};

0 comments on commit 87dab53

Please sign in to comment.