Skip to content

Commit 4a50a1b

Browse files
committed
[Telink] Add the functionality for the TL7218X ML7-M board
- add the TL7218X ML7-M configuration and overlay files, - support white and green LEDs, - support Factory Reset and Lighting On/Off buttons, - support USB-CDC. build command: west build -b tl7218x -- -DTLNK_7218X_ML7M_BOARD=y Signed-off-by: Hao Wu <[email protected]>
1 parent 55d454b commit 4a50a1b

File tree

3 files changed

+125
-0
lines changed

3 files changed

+125
-0
lines changed

examples/platform/telink/common.cmake

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,15 @@ if(${TLNK_7218X_ML7G_BOARD} MATCHES y)
7474
if(NOT EXISTS "${ML_CONF_OVERLAY_FILE}")
7575
message(FATAL_ERROR "${ML_CONF_OVERLAY_FILE} doesn't exist")
7676
endif()
77+
elseif(${TLNK_7218X_ML7M_BOARD} MATCHES y)
78+
set(ML_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${BOARD}_ml7m.overlay")
79+
if(NOT EXISTS "${ML_DTC_OVERLAY_FILE}")
80+
message(FATAL_ERROR "${ML_DTC_OVERLAY_FILE} doesn't exist")
81+
endif()
82+
set(ML_CONF_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${BOARD}_ml7m.conf")
83+
if(NOT EXISTS "${ML_CONF_OVERLAY_FILE}")
84+
message(FATAL_ERROR "${ML_CONF_OVERLAY_FILE} doesn't exist")
85+
endif()
7786
elseif(${TLNK_3218X_ML3M_BOARD} MATCHES y)
7887
set(ML_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${BOARD}_ml3m.overlay")
7988
if(NOT EXISTS "${ML_DTC_OVERLAY_FILE}")

src/platform/telink/tl7218x_ml7m.conf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CONFIG_CHIP_BUTTON_MANAGER_IRQ_MODE=y
2+
3+
# Disable PWM because PE1~5 are used for PWM
4+
CONFIG_PWM=n
5+
6+
# USB configuration (Disable it if need full logging)
7+
CONFIG_USB_DEVICE_STACK=y
8+
CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=n
9+
CONFIG_USB_CDC_ACM_LOG_LEVEL_OFF=y
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
2+
/ {
3+
model = "telink,tl721x";
4+
compatible = "telink,tl7218x";
5+
6+
chosen {
7+
zephyr,console = &cdc_acm_uart0;
8+
zephyr,shell-uart = &cdc_acm_uart0;
9+
};
10+
11+
aliases {
12+
/delete-property/ mcuboot-button0;
13+
};
14+
15+
leds {
16+
compatible = "gpio-leds";
17+
18+
led_green: led_1 {
19+
gpios = <&gpioe 2 GPIO_ACTIVE_HIGH>;
20+
label = "LED Green";
21+
};
22+
23+
led_white: led_2 {
24+
gpios = <&gpioe 1 GPIO_ACTIVE_HIGH>;
25+
label = "LED White";
26+
};
27+
};
28+
29+
keys {
30+
compatible = "gpio-keys";
31+
32+
key_1: button_1 {
33+
label = "User KEY1";
34+
gpios = <&gpioe 3 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
35+
};
36+
37+
key_2: button_2 {
38+
label = "User KEY2";
39+
gpios = <&gpioe 5 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
40+
};
41+
};
42+
43+
key_pool {
44+
compatible = "gpio-keys";
45+
46+
inp {
47+
gpios = <&gpioe 3 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>,
48+
<&gpioe 5 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
49+
};
50+
};
51+
52+
led_pool {
53+
compatible = "gpio-leds";
54+
55+
out {
56+
gpios = <&gpioe 2 GPIO_ACTIVE_HIGH>,
57+
<&gpioe 1 GPIO_ACTIVE_HIGH>;
58+
};
59+
};
60+
61+
/delete-node/ pwm_pool;
62+
63+
};
64+
65+
66+
&gpioe {
67+
interrupts = <39 1>;
68+
status = "okay";
69+
};
70+
71+
&uart0 {
72+
status = "okay";
73+
current-speed = <115200>;
74+
pinctrl-0 = <&uart0_tx_pb6_default &uart0_rx_pb7_default>;
75+
pinctrl-names = "default";
76+
};
77+
78+
/* Disable LSPI in overlay */
79+
&lspi {
80+
status = "disabled";
81+
};
82+
83+
&pinctrl {
84+
/* Set pad-mul-sel register value.
85+
* Note: Pins functions below (pinmux = <...>) depend on this value.
86+
*/
87+
pad-mul-sel = <1>;
88+
89+
/* UART0: TX(PB6), RX(PB7) */
90+
91+
uart0_tx_pb6_default: uart0_tx_pb6_default {
92+
pinmux = <TLX_PINMUX_SET(TLX_PORT_B, TLX_PIN_6,
93+
(TL721X_FUNC_UART0_TX | TL721X_PULL_UP))>;
94+
};
95+
uart0_rx_pb7_default: uart0_rx_pb7_default {
96+
pinmux = <TLX_PINMUX_SET(TLX_PORT_B, TLX_PIN_7,
97+
(TL721X_FUNC_UART0_RTX_IO | TL721X_PULL_UP))>;
98+
};
99+
100+
};
101+
102+
/* USB configuration (Disable it if need full logging) */
103+
&zephyr_udc0 {
104+
cdc_acm_uart0: cdc_acm_uart0 {
105+
compatible = "zephyr,cdc-acm-uart";
106+
};
107+
};

0 commit comments

Comments
 (0)